Commit graph

153 commits

Author SHA1 Message Date
Dave Peticolas
08272dc25d Remove unused imports. 2012-08-09 21:35:22 -07:00
Michael DeHaan
1c9b43df1b more whitespace 2012-08-06 21:00:21 -04:00
Petros Moisiadis
2ac4acbf97 fixes for tests 2012-08-01 22:17:16 +03:00
Will Thames
845a7ac5ae test_one not working as tests after skipped test failing, because
on_skipped callback being passed an extra item parameter that it wasn't
expecting.
Fixed it so that on_skipped in TestCallbacks accepts and ignores the
extra parameter
Extra parameter was added in 4b9b9a8a5b
but not really clear why from commit message
2012-08-01 12:35:17 +10:00
Michael DeHaan
d79900b434 Merge pull request #732 from willthames/fix_git_fail_json
Fixes for git module when it fails.
2012-07-31 05:04:47 -07:00
u348095
e863ba0cec Fixes for git module when it fails.
* module.fail_json *must* have msg argument
Using http://github.com/ rather than git://github.com/ as it gets through more
firewalls
2012-07-31 12:59:22 +10:00
Michael DeHaan
fe558f680a Fix some failing tests, script tests seem to indicate magic variables are not being provided
to scripted inventory so need to investigate this.
2012-07-30 19:21:49 -04:00
Michael DeHaan
47cead3603 Merge pull request #727 from sfromm/git
Git module ported to use module magic
2012-07-30 13:40:36 -07:00
willthames
1bcba4f4a2 test/TestRunner.py now executes false with no directory prefix
as it is /bin/false on many systems but /usr/bin/false on OS X
test/playbook1.yml now just does command true, rather than command /bin/true,
again so that it works on OS X

Changed from using which false to just using command false to
make it simpler and also match how playbook1.yml works
2012-07-30 21:39:58 +10:00
Stephen Fromm
90bf67cf56 Make test_git functional in TestRunner.py 2012-07-29 22:40:12 -07:00
Michael DeHaan
8fa4dc3920 Small change to previous patch, make ranges of hosts inclusive. 2012-07-24 20:10:05 -04:00
Chin Fang
e3b2521f01 Added a host expansion feature to ansible's inventory parsing 2012-07-24 12:38:52 -07:00
Michael DeHaan
dde11baa56 Remove YAML inventory tests since this is now deprecated. 2012-07-20 11:31:28 -04:00
Michael DeHaan
9e62fd42b5 update test utils code 2012-07-16 20:28:32 -04:00
Michael DeHaan
867b2437cc consolidate output code in callbacks.py, from utils, remove extra functions 2012-07-15 10:12:49 -04:00
Michael DeHaan
279b5965b8 Much streamlining around setup steps in playbooks, now only run setup once per play. 2012-07-14 12:24:19 -04:00
Michael DeHaan
931f9f1a61 Setup module no longer saves to disk, as templates are mostly useful in playbooks and this allows lots of simplifications
around file pathing and removes occasional permissions conflicts depending on how things are used.
2012-07-14 11:59:12 -04:00
Michael DeHaan
60f295f7a0 Squashed commit of the following:
commit 4430ce3eefcdff0b0ceffea0ef66ea8e876a807d
Merge: 631783b 649963c
Author: Michael DeHaan <michael.dehaan@gmail.com>
Date:   Thu Jul 12 01:28:43 2012 -0400

    Merge branch 'host-groups' of https://github.com/dagwieers/ansible into daggroups

commit 649963ca2c
Author: Dag Wieërs <dag@wieers.com>
Date:   Thu Jul 12 23:01:00 2012 +0200

    Added comments in the example yaml file as requested

commit 7f9718f185
Author: Dag Wieërs <dag@wieers.com>
Date:   Thu Jul 12 22:49:38 2012 +0200

    Add the default nose color too, to test specific overrides

commit eb63b9e899
Author: Dag Wieërs <dag@wieers.com>
Date:   Thu Jul 12 22:44:35 2012 +0200

    Introduce comics and cartoons to test yaml groups defined on a per-node basis

commit aa13d23307
Author: Dag Wieërs <dag@wieers.com>
Date:   Thu Jul 12 19:33:15 2012 +0200

    A small fix to revert to old state

commit 264ebaa77c
Author: Dag Wieërs <dag@wieers.com>
Date:   Thu Jul 12 19:31:51 2012 +0200

    Combine both yaml unit tests into one example file

commit 7db49a8048
Author: Dag Wieërs <dag@wieers.com>
Date:   Thu Jul 12 16:46:53 2012 +0200

    Might as well fix this too

commit f36c6c8c5b
Author: Dag Wieërs <dag@wieers.com>
Date:   Thu Jul 12 16:42:00 2012 +0200

    Added unit tests for host-groups patch

    For the unit test I chose to keep the original yaml file in place as a reference.

    This patch also includes a fix.

commit a96f681352
Author: Dag Wieërs <dag@wieers.com>
Date:   Thu Jul 12 12:30:43 2012 +0200

    Allow groups to be defined on a per-host basis

    This makes it possible to define on a per-host basis what groups a host is in.
    When managing a large set of systems it makes it easier to ensure each of the
    systems is defined in a set of groups (e.g. production/qa/development,
    linux/solaris/aix) rather than having to add systems to multiple disconnected
    groups.

    ----
      - host: system01

      - host: system02

      - host: system03

      - group: linux
        hosts:
        - system01
        - system02

      - group: solaris
        hosts:
        - system03

      - group: production
        hosts:
        - system01
        - system03

      - group: qa
        - system02

      - group: dbserver
        hosts:
        - system01

      - group: ntpserver
        hosts:
        - system02

      - group: webserver
        - system03
    ----

    Can be redefined as:

    ----
      - host: system01
        groups: [ linux, production, dbserver ]

      - host: system02
        groups: [ linux, qa, ntpserver ]

      - host: system03
        groups: [ solaris, production, webserver ]
    ----
2012-07-12 01:29:51 -04:00
Michael DeHaan
efac68b636 Remove the -D module debug flag, which no longer is functional due to sudo pty requirements, and replace with -v/--verbose.
This flag will show playbook output from non-failing commands.  -v is also added to /usr/bin/ansible, but not  yet used.

I also gutted some internals code dealing with 'invocations' which allowed the callback to know what module invoked
it.  This is not something 0.5 does or needed, so callbacks have been simplified.
2012-06-19 21:57:43 -04:00
Jeroen Hoekx
d592e15dcc Correctly add ungrouped hosts to 'ungrouped' in YAML inventory. 2012-06-27 08:26:01 +02:00
Daniel Hokka Zakrisson
031c75e53a Update tests to reflect new API 2012-06-18 00:13:12 +02:00
Daniel Hokka Zakrisson
24d73b0fe6 Add tests of iterative templating 2012-06-16 13:13:01 +02:00
Daniel Hokka Zakrisson
05a7a3725b Add tests of host exclusions 2012-06-15 19:09:04 +02:00
Michael DeHaan
bd893b765b Merge pull request #459 from dhozac/with_items-variable
Allow a variable in with_items
2012-06-13 19:18:51 -07:00
Stephen Fromm
9cf182c225 Add assemble module
This adds a module that concatenates (ie. assembles) a file from
fragments in a directory in alphabetical order.  It chains the file
module afterward to fix up ownership and permission.  This also adds
tests for the assemble module with fragments in assemble.d.
2012-06-11 23:09:54 -07:00
Daniel Hokka Zakrisson
a05da2d312 Allow with_items to specify a variable 2012-06-09 21:59:22 +02:00
John Kleint
70837469c6 Properly template list of hosts in playbooks.
In playbooks, hosts can be a YAML list. We templated the list before
converting it to a semicolon-separated string, which actually templated its
repr. This converts to a string first. A basic unit test is included.
2012-05-31 16:06:21 -04:00
Matt Goodall
639763c138 Allow "=" in k-v values. 2012-05-23 00:58:05 +01:00
Michael DeHaan
8e88667f82 Fix hosts being in multiple groups, and duplicate host references in the same inventory file. 2012-05-19 17:24:54 -04:00
Jeroen Hoekx
ecc0b0770c If /usr/share/dict/words does not exist, use cracklib-small to test large output. 2012-05-15 14:26:43 +02:00
Michael DeHaan
d4f660edc3 Do not run unit tests against the EVENTS code because it is subject to change and that does not mean anything is broken.
If we want to test playbooks, it's best to test the result of a playbook to make sure it does the correct thing.  Also
remove playbook2/3 yml which were not used.
2012-05-09 23:21:44 -04:00
Michael DeHaan
f8807da57b Merge pull request #363 from jhoekx/template-only-if
Fix correct variable expansion in includes only_if.
2012-05-11 15:55:09 -07:00
Jeroen Hoekx
cd9f926b5f Fix correct variable expansion in includes only_if.
There's not need to run the complete include through the templating engine.
Several variables were not included before the conditional was evaluated.
2012-05-11 15:55:33 +02:00
Jeroen Hoekx
3cbc229990 Support list indexing in varReplace. 2012-05-10 19:25:28 +02:00
Jeroen Hoekx
74e21e6154 Fixup unicode varReplace templating.
The original patches should have conflicted?
53bde0bf51 vs efde61e537
2012-05-10 10:11:14 +02:00
Michael DeHaan
36639186e0 Merge pull request #362 from jhoekx/uppercase-vars
Allow camelCase variables in varReplace.
2012-05-11 10:06:21 -07:00
John Kleint
83b9a43e60 Add test for large output; fix indentation. 2012-05-11 11:38:15 -04:00
Jeroen Hoekx
dc60f2d844 Allow camelCase variables in varreplace. 2012-05-11 14:14:53 +02:00
Jeroen Hoekx
2bbc05185e Make no_engine the default templating action. 2012-05-09 16:15:43 +02:00
Jeroen Hoekx
82144fd543 Support nested variables in varReplace. 2012-05-09 16:15:43 +02:00
Jeroen Hoekx
e09572a8e1 Inventory: undefined group -> ungrouped.
Also change test name collision.
2012-05-08 09:44:59 +02:00
Jeroen Hoekx
d419a13ca7 Inventory: support list of vars in host. 2012-05-08 09:44:29 +02:00
Michael DeHaan
157d21b1c3 Add tests for new advanced inventory features (groups of groups, group variables) in the default INI format file. 2012-05-06 18:01:11 -04:00
Michael DeHaan
1a00e2635e Further work on making the YAML inventory parser use the new inventory objects. 2012-05-06 17:03:17 -04:00
Michael DeHaan
256377166a Reinstate external inventory script support this time using the new more OO-ey inventory system.
Next up: YAML format.
2012-05-06 14:47:05 -04:00
Michael DeHaan
0669ce858a Refactored inventory to make it object oriented, need to make YAML format and executable script
format compatible with this still, and add some tests for INI-style groups of groups
and variables.
2012-05-05 16:31:03 -04:00
Jeroen Hoekx
03541baba7 Define 'inventory_hostname' variable for hosts. 2012-05-02 09:56:58 +02:00
Jeroen Hoekx
029fe1273c Modify /usr/bin/ansible and playbooks to use the new async API. 2012-05-01 18:38:26 -04:00
Jeroen Hoekx
b87710a1df Introduce group_names in template variables.
This is a list of all the groups a host is in.
2012-04-28 18:23:44 +02:00
Michael DeHaan
b9982fc17b Reinstate --extra-vars, which can do things in playbooks like:
ansible-playbook release-my-app.yml --extra-vars="version=123"

And make $version available in the playbook without re-editing the file
2012-04-26 19:57:07 -04:00
Jeroen Hoekx
cc579a8aa2 Fix tests for facter and the ansible_facts API. 2012-04-24 17:01:48 +02:00
Jeroen Hoekx
2dc9a563ef Allow modules to return facts.
If the module result contains "ansible_facts", that will be added to the setup
cache.
2012-04-23 21:28:12 +02:00
Michael DeHaan
c0c691089d Fix bug in src. Should not code this early :) 2012-04-20 08:09:43 -04:00
Jeroen Hoekx
903e4f6eae Support dicts in inventory vars. 2012-04-19 09:40:17 +02:00
Michael DeHaan
30d06dbcea Don't force down ansible facts back to setup, the setup module won't like parsing them on input and that
data is already there.
2012-04-18 22:23:33 -04:00
Michael DeHaan
da0209dbc4 The fetch module really should preserve the whole directory structure being fetched to allow subsequent calls,
particularly in playbook, to recreate the host tree structure.  Making it thus.
2012-04-18 21:12:48 -04:00
Jeroen Hoekx
6f09b41eb5 Don't test modules that aren't present.
Also account for path difference in sleep in different distributions.
2012-04-17 13:30:30 +02:00
Michael DeHaan
3f26a1c7f6 verbose option is not being used, so remove it. debug variable still exists. 2012-04-16 23:47:41 -04:00
Michael DeHaan
9ce27be878 Remove extra_vars tests 2012-04-16 23:03:04 -04:00
Jeroen Hoekx
8c3206c99f Return a copy of the host variables. 2012-04-16 10:59:34 +02:00
Jeroen Hoekx
961ccdb2f4 List hosts in no group in the ungrouped group. 2012-04-16 10:55:08 +02:00
Jeroen Hoekx
3a24aa9a70 Add YAML inventory format.
See test/yaml_hosts for an example.

Hosts can be part of multiple groups.

Groups can also have variables, inherited by the hosts.
There is no variable scope, last variable seen wins.
2012-04-16 10:38:35 +02:00
Jeroen Hoekx
54f4526160 Export SSH port number as host variable. 2012-04-16 09:16:29 +02:00
Jeroen Hoekx
f04041b37d Ignore port numbers in simple inventory format 2012-04-16 09:16:29 +02:00
Jeroen Hoekx
746f1b92ae Reimplement the class method on Runner. 2012-04-16 09:16:29 +02:00
Jeroen Hoekx
195e6d617b Add tests for Inventory class. 2012-04-16 09:16:29 +02:00
Michael DeHaan
08c593bee1 Warn if no hosts matched 2012-04-11 21:05:46 -04:00
Michael DeHaan
b9e3b053f9 Simplify playbook tests so things are not timing dependent in the poll section, which is leading to tests
not being consistent between runs, even though there wasn't an error.  Now we'll just check the final change
counts, which should be just as solid and lead to less churn in the events file.
2012-04-11 20:27:17 -04:00
Michael DeHaan
e103bdda93 Rename test class to match what it is testing 2012-04-11 20:16:28 -04:00
Michael DeHaan
245aa9bf8e Some tweaks to the fetch module. 'err' return was for stderr, so that should be empty string.
Some minor code shortening.  Added a test to TestRunner.
2012-04-11 20:12:01 -04:00
Michael DeHaan
51e4faf7aa Update test file -- we probably should not include the poll as the number of polls is changing between test
runs (that's ok, it's not intended to be realtime accurate)
2012-04-10 21:17:02 -04:00
Michael DeHaan
1d75a29ec9 Allow variables coming in from the playbook and the API to be expressed as dictionaries throughout their full life cycle
such that nested data can be made available in templates and playbooks.
2012-04-10 20:58:40 -04:00
Michael DeHaan
eed4a2b717 Update tests to use 127.0.0.2 to bypass the smart "use local connection" code, and also to reflect
that commands now trigger change events.
2012-04-06 12:11:25 -04:00
Michael DeHaan
2a2b5ed73c Polling timing change results in need to change events file for tests. 2012-04-02 20:10:06 -04:00
Michael DeHaan
4792021f47 Fix syntax error in user patch 2012-04-02 20:08:40 -04:00
Michael DeHaan
2511992659 Surface module debug (-D) to /usr/bin/ansible also 2012-03-31 11:45:29 -04:00
Michael DeHaan
96a22b582b Disable ohai test as it's hanging for whatever reason, but doesn't do this in real life.
Run tests in verbose mode.
2012-03-31 11:18:26 -04:00
Michael DeHaan
3ded27fe35 Treat module args as strings everywhere to avoid unneccessary shlex and requoting 2012-03-30 22:47:58 -04:00
Michael DeHaan
6db87a5018 Minor style fix, update test to match quote fix patch 2012-03-30 21:57:34 -04:00
Michael DeHaan
6dda6f12dc Applying callback model to runner, and using that in playbooks, so output can be more immediate in playbooks.
(Runner still does not use callbacks for default output)
2012-03-25 19:05:27 -04:00
Michael DeHaan
44d4dede92 Split conditional imports in playbook into subfunction, fix small bug in event reporting on playbook
actions.
2012-03-23 21:03:25 -04:00
Michael DeHaan
6ab615c724 Code cleanup for playbooks, also added 'on_skipped' callback 2012-03-23 20:51:26 -04:00
Michael DeHaan
3814a46bbf Move playbook for user commands into examples dir 2012-03-22 00:33:10 -04:00
Michael DeHaan
6aa10691c1 Merge pull request #93 from sfromm/user-module
User module
2012-03-22 19:24:53 -07:00
Stephen Fromm
999bead9ed Add playbook to test user module 2012-03-22 11:36:11 -07:00
Michael DeHaan
e6406fa5a7 Allow variable expressions to be stored as variables themselves, do some things to allow setup strings
to more easily contain spaces without being mangled, which is neccessary because of the above.
2012-03-21 20:00:48 -04:00
Michael DeHaan
a5f4ca50b8 Ratchet up logging a few notches prior to controlling w/ verbosity settings 2012-03-20 22:29:21 -04:00
Michael DeHaan
b5c62ec068 Enhance logging, way to gate verbosity levels pending. 2012-03-20 21:44:01 -04:00
Michael DeHaan
dfbe591cc0 Add "only_if" capability, which allows task steps to be skipped if they do not match a conditional. 2012-03-20 19:55:04 -04:00
Michael DeHaan
4de7bbb169 Allow conditional imports, see examples/playbook3.yml comments for a full explanation. Extensive
refactoring of playbooks now warranted, which we'll do before we move on.   This variable assignment
system makes nearly all possible magic possible, for we can use these variables however we like,
even as module names!
2012-03-19 22:42:31 -04:00
Michael DeHaan
5ed2b894d9 Add an additional way to dereference a variable in a playbook, $foo
(Using varReplace function originally from yum, thanks Seth)
2012-03-19 19:32:38 -04:00
Michael DeHaan
c1fe0dd719 Quote long variables in playbooks when feeding them to the setup command 2012-03-18 19:50:22 -04:00
Michael DeHaan
5371a9e497 Regression tests for playbooks, logging the events they call via callbacks. 2012-03-18 19:25:56 -04:00
Michael DeHaan
b15c8e9cb1 Playbook test upgrades, made some notes about callbacks we need to add. Still need to compare events
recieved vs expected so we can be notified if this test breaks, and also to add some more detailed
playbooks that use includes & async, etc.
2012-03-18 18:50:25 -04:00
Michael DeHaan
45abe3c16b Add unit tests for playbooks, and fix an error caught by one 2012-03-18 18:29:11 -04:00
Michael DeHaan
4bde4926c3 Modules don't have to return JSON, key=value pairs is ok. 2012-03-14 21:16:15 -04:00
Michael DeHaan
40fd778e2c 'shell' is a magic module that executes the command module with shell=True 2012-03-14 20:40:06 -04:00
Michael DeHaan
73d20b81c6 Add basic test of yum module (VERY basic) just to make sure syntax remains ok. Need to do something
trivial for service and git module also.
2012-03-14 20:02:29 -04:00
Michael DeHaan
696b67f935 Fix async to use the new argfiles method (wrapping brain around rock, really must write module development guide) 2012-03-14 19:57:56 -04:00
Michael DeHaan
cb5929dad7 Setup module tests 2012-04-04 11:55:24 -04:00