Commit graph

1686 commits

Author SHA1 Message Date
Serge van Ginderachter
dd9919342b hide magic variables used bin/ansible output
'verbose_override' and 'verbose_always'
2013-05-27 14:42:55 +02:00
Serge van Ginderachter
5859af7285 script support for roles: use the files/ directory
instead of an additional scripts/ directory
2013-05-25 16:51:59 +02:00
Michael DeHaan
3a635d2d26 Lots of formatting fixes 2013-05-24 23:46:23 -04:00
Michael DeHaan
11792a9daa Merge pull request #2987 from kentfrazier/sudo_user
Fix bug with include-level vars and sudo_user.
2013-05-24 20:08:04 -07:00
Michael DeHaan
84623441e1 Merge pull request #2945 from jsmartin/new_fetch
Fetch destination path can now be overriden.
2013-05-24 19:57:19 -07:00
Michael DeHaan
4fc6be8579 Merge pull request #2993 from SirScott/pkgng
Make pkgng and with_items result in a single module call.
2013-05-24 19:55:56 -07:00
Michael DeHaan
4b988dbd43 Merge pull request #2978 from bryanlarsen/basename
add basename and dirname to the core jinja2 filters
2013-05-24 19:54:36 -07:00
Michael DeHaan
27236cf598 Merge pull request #2998 from SirScott/runner-permissions
Ensure the tmp_path is sufficiently open.
2013-05-24 19:52:23 -07:00
Michael DeHaan
159ba7d68a Merge pull request #2956 from akerl/unicodefix
ignore unicode errors in stdout
2013-05-24 19:46:25 -07:00
Michael DeHaan
98a4331107 Merge pull request #2999 from ngrilly/python
Python
2013-05-24 19:36:47 -07:00
Michael DeHaan
5fdca267ac Merge pull request #3018 from dsedivec/devel
Plug-ins loaded from top-level plug-in directory
2013-05-24 18:58:00 -07:00
Serge van Ginderachter
94028852d9 Make debug module always verbose in playbooks
Created a new flag 'verbose_always' handled by
on_ok callback, similar to the 'verbose_override'
flag used by the setup module.
2013-05-25 00:27:23 +02:00
Dale Sedivec
611d56dc4c Plug-ins loaded from top-level plug-in directory
PluginLoader._get_paths, as of 391fb98e, was only finding plug-ins that
were in a subdirectory of one of the basedirs (i.e. in a category
directory).  For example, action_plugins/foo.py would never be loaded,
but action_plugins/bar/foo.py would work.

This makes it so that "uncategorized" plug-ins in the top level of a
directory such as action_plugins will be loaded, though plug-ins in a
"category" subdirectory will still be preferred.  For example,
action_plugins/bar/foo.py would be preferred over action_plugins/foo.py.
2013-05-24 17:05:28 -05:00
Serge van Ginderachter
4c9ebe8522 Add roles support for the script module
allows to put scripts directly in a dir within the
role:

 roles/<role>/scripts/..

Same as the copy and template module.

As requested in and closes #2969
2013-05-24 22:10:46 +02:00
Nicolas Grilly
75ceb80572 Escape args injected in new style modules 2013-05-24 01:01:07 +02:00
Scott Sturdivant
5516ece859 Ensure the tmp_path is sufficiently open. 2013-05-23 12:13:09 -06:00
Nicolas Grilly
7aee588918 Idiomatic Python: use in operator instead of method find 2013-05-23 20:12:43 +02:00
Nicolas Grilly
7babd30cf7 Idiomatic Python: use isinstance instead of type 2013-05-23 20:12:43 +02:00
James Martin
3c131dbd2b Initial Commit. 2013-05-23 13:33:36 -04:00
Scott Sturdivant
d91bc1692e Make pkgng and with_items result in a single module call. 2013-05-23 09:43:38 -06:00
Kent Frazier
4c6583bd00 Fix bug with include-level vars and sudo_user.
If a variable was provided for an include, in either of these ways:

    ---
    - hosts: all
      tasks:
      - include: included.yml param=www-data
      - include: included.yml
        vars:
          param: www-data

and then that param was used as the value of sudo_user in the included
tasks:

    ---
    - name: do something as a parameterized sudo_user
      command: whoami
      sudo: yes
      sudo_user: $param

you would receive a "failed to parse: usage: sudo" error back and the
command would not execute.

This seemed to be due to a missing call to template.template somewhere,
because the final value being passed through ssh was still `$param`.
After some digging, the issue seems to instead have been a problem with
providing the wrong context to the template for expansion. Inside the
`Task` logic, it was passing `play.vars` as the context, where
`module_vars` seemed more appropriate. After replacing it, my test case
above ran without issue. There was a comment above suggesting that the
template call might be unnecessary, but removing it made the original
error return, since it is not getting escaped later down the line. I
removed the comment since it was inaccurate.

I tried to actually incorporate my test case above into the test suite
as a regression test, but was unable to figure out how to structure it.
The existing test infrastructure seemed to only be testing for correct
number of counts in things (ok vs. changed, etc.), without regard for
whether the content generated by the command is correct. If there is an
example of a test similar to this one (where I would want to check the
JSON generated to make sure sudo_user had been converted), please let me
know and I will be happy to submit an additional patch.
2013-05-23 00:05:11 -05:00
Bryan Larsen
f629baef11 add basename and dirname to the core jinja2 filters 2013-05-22 14:06:18 -04:00
Michael DeHaan
753ebea186 Prefer categorized modules to uncategorized, such that if someone does an install on top of old content
the categorized modules will win over the 1.1 uncategorized modules, as the packages may not automatically
clean up the old content.
2013-05-19 20:09:44 -04:00
Michael DeHaan
cd57d59913 If ansible is configured to use a log file but cannot write to it, exit, but don't traceback. 2013-05-19 20:05:04 -04:00
Michael DeHaan
496f06c3c9 Pass variables to lookup function for those that want to use them. 2013-05-19 19:26:30 -04:00
Michael DeHaan
16709ecd76 Replace tab with spaces. 2013-05-19 19:26:30 -04:00
Dimos Alevizos
e96bc981ce Set paramiko's logging level
Excplicity set paramiko's logging level to WARNING.
By default it inherits ansible's DEBUG logging level (set in
callbacks.py) and fills the log file with useless debug messages.
Obviously it only applies if log_path is set in ansible.cfg
2013-05-19 19:26:30 -04:00
Les Aker
1179d1bbd8 corrected indentation 2013-05-19 12:25:19 -04:00
Les Aker
2adc335481 ignore unicode errors in stdout 2013-05-19 11:57:08 -04:00
Maykel Moya
60f24bb077 Remove unused modules 2013-05-18 23:11:47 +02:00
Maykel Moya
f52e3dee70 Don't hardcode chroot executable path 2013-05-18 23:09:38 +02:00
Ben Ritcey
0938d4d89a Allow the remote MD5 checks to be run via sudo 2013-05-18 16:20:54 -04:00
Michael DeHaan
8475a92dec Merge pull request #2939 from mmoya/lookup-crypted-passwds
Add support for crypted passwords to password lookup
2013-05-18 13:17:41 -07:00
Stoned Elipot
94ba0f740a Fix for issue #2916 : for each host promote the host variables as globally scoped variables for the sake of the groups determination 2013-05-16 18:57:05 +02:00
Maykel Moya
45f5447f9f Fix name in copyright 2013-05-16 18:49:35 +02:00
Maykel Moya
96afc3f462 Add support for crypted passwords to password lookup
Added new parameter 'encrypt' with same semantics from that of
vars_prompt. When encryption is requested a random salt will be
generated and stored along the password in the form:
'<password> salt=<salt>'.

Also store passwords with an ending '\n' for easier looking at files
with console tools. File content was being already rstripped so this
is harmless.
2013-05-16 13:24:54 +02:00
Brian Coca
8dd72d2828 changed lockfile to be opened in write mode (solaris for one doesn't like
exclusive locks on read)
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
2013-05-15 16:56:20 -04:00
Michael DeHaan
f2a8c0d612 Fix listification inside of with_items so it runs more intelligently. 2013-05-13 21:31:45 -04:00
Michael DeHaan
161f3e3670 Merge pull request #2899 from sergevanginderachter/host-group-vars-no-subdirs
don't parse subdirs in host/group_vars
2013-05-13 15:59:58 -07:00
Michael DeHaan
ff3625b0c9 Merge pull request #2902 from timhabermaas/fix-grammatical-error
Fix grammatical error in error message
2013-05-13 05:47:46 -07:00
Serge van Ginderachter
7eeab168bc bug fix in first_found search path assembly 2013-05-13 13:48:56 +02:00
Tim Habermaas
4d24faeeb1 Fix grammatical error in error message 2013-05-13 13:22:57 +02:00
Serge van Ginderachter
a6b827ca07 don't parse subdirs in host/group_vars
as those are not supported in
core vars_plugins/group_vars.py
but might be used by other vars_plugins
2013-05-13 11:04:49 +02:00
Michael DeHaan
2a091a3505 Remove duplicate import. 2013-05-11 17:26:47 -04:00
Michael DeHaan
a78edbb45c More pep8 2013-05-11 17:26:06 -04:00
Michael DeHaan
50586928b2 No need for trailing semicolon. 2013-05-11 17:25:05 -04:00
Michael DeHaan
ea8302e68d Indentation. 2013-05-11 17:24:40 -04:00
Michael DeHaan
9f47d13306 Misc identation. 2013-05-11 17:24:12 -04:00
Michael DeHaan
0a1657080b Indentation fix 2013-05-11 17:23:45 -04:00
Michael DeHaan
3fdf15fa8a template code fixes for 'make pep8' 2013-05-11 17:22:56 -04:00
Michael DeHaan
3afa8b373e Improve check mode reporting for directories and file modes. 2013-05-11 15:05:00 -04:00
Michael DeHaan
05a4513a03 Merge branch 'group-by-global' of git://github.com/stoned/ansible into devel
Conflicts:
	lib/ansible/runner/action_plugins/group_by.py
2013-05-11 14:28:04 -04:00
Michael DeHaan
11176c0711 Merge pull request #2878 from DavidMikeSimon/devel
Dealing with invalid symlinks and symlink permissions
2013-05-11 11:25:33 -07:00
Michael DeHaan
e4e6616169 Merge pull request #2872 from tima/fuzzy-match-localhost-127
Adds fuzzy matching of localhost to 127.0.0.1 host entries and vice versa
2013-05-11 11:15:49 -07:00
Michael DeHaan
344a30938c Merge pull request #2871 from tima/inv-host-entry-fix
Fixed bug where a host entry in the inventory represented as a dict w/o ...
2013-05-11 11:14:48 -07:00
Matt Coddington
542eeeb5d6 add option to ignore $legacy variable style substitution 2013-05-11 14:06:01 -04:00
Michael DeHaan
ad777f6538 Fix contrib link. 2013-05-11 14:03:07 -04:00
Stoned Elipot
75100201a2 Allow globally scoped variables with group_by module's conditionals and key argument 2013-05-10 00:02:14 +02:00
David Simon
190ce16bab Dealing with invalid symlinks and symlink permissions 2013-05-09 15:35:05 -04:00
Timothy Appnel
20bf5f130d Adds fuzzy matching of localhost to 127.0.0.1 host entries and vice versa. 2013-05-08 14:11:40 -04:00
Timothy Appnel
b15cc3e2b4 Fixed bug where a host entry in the inventory represented as a dict w/o a hosts or vars key was treated as a group and its vars essentially ignored. 2013-05-08 13:55:50 -04:00
Michael DeHaan
d1d3f4b4d2 Merge pull request #2842 from bcoca/cleanup
generalized cleanup and removed atomic_move return
2013-05-05 11:20:33 -07:00
Brian Coca
3ac6c45499 generalized cleanup function, in case modules want to use
removed return code as it doesn't make sense anymore
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
2013-05-05 13:26:29 -04:00
Michael DeHaan
f87ac5ce29 Merge pull request #2841 from jimi1283/issue_2820
BUGFIX - --start-at-task= works only with --step
2013-05-05 09:47:15 -07:00
Michael DeHaan
9ed177e25e Merge pull request #2840 from toshywoshy/devel
Patch so that delegate_to also uses ansible_ssh_private_key_file
2013-05-05 09:45:35 -07:00
James Cammarata
2440861b1b BUGFIX - --start-at-task= works only with --step
From issue #2820, --start-at-task does not actually run tasks
unless --step is specified. This appears to be because skip_task
is being evaluated as True in PlayBook._run_task(). This patch
ensures skip_task is set to False in the callback.
2013-05-05 11:05:32 -05:00
Toshaan Bharvani
62b53f4d2c changed the delegate_to to also use ansible_ssh_private_key_file from the inventory file 2013-05-05 16:54:26 +02:00
Gilles Cornu
68f7ea6099 Apply Gilles's patch to atomic_move based on github comment. (Email address not supplied
since wasn't from a pull request)
2013-05-04 19:31:52 -04:00
Brian Coca
bdeb370d79 fixed case in which move fails after remote user copies file and sudo to non root does the move
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
2013-05-03 21:58:27 -04:00
Michael DeHaan
c3547a2308 Moar SELinux. 2013-05-03 10:39:24 -04:00
Michael DeHaan
fb7bfa61a9 Fix SELinux context on atomic_move 2013-05-03 10:18:55 -04:00
Michael DeHaan
4ecc7ea2e0 Merge pull request #2817 from sfromm/issue2810
Set selinux context on file after shutil.move in atomic_move()
2013-05-03 06:45:42 -07:00
Serge van Ginderachter
53a7ab74c8 use os.path.join instead of hardcoded unix separator in first_found lookup plugin 2013-05-02 13:58:23 +02:00
Stephen Fromm
50e94e4a2f Set selinux context on file after shutil.move in atomic_move()
This is intended to fix #2810.  It sets the context of the tmp_dest file
after shutil.move() operation and before os.rename().  This should
retain the selinux context of the file across moves.
2013-04-30 10:15:09 -07:00
Michael DeHaan
7117ca5395 Allow modules in a "./library" directory to be referenced by their shortforms "modulename:" instead of just "action: modulename" 2013-04-28 21:05:19 -04:00
Michael DeHaan
e90023281d Slightly refine log output to include username in addition to pid. 2013-04-28 20:57:32 -04:00
Michael DeHaan
ba8f2fca26 Merge branch 'add_pid_to_logging' of git://github.com/mcodd/ansible into devel 2013-04-28 20:52:53 -04:00
Stoned Elipot
df3c4849e9 Also load Jinja2 extensions when processing template from string 2013-04-28 20:52:01 -04:00
Michael DeHaan
4bea9a612f Don't use "finally" here as it's not 2.4 compliant. 2013-04-28 16:03:03 -04:00
Michael DeHaan
68f711d5ae teach plugin loader to find modules in subdirectories 2013-04-28 15:22:46 -04:00
Michael DeHaan
391fb98ee2 Allow modules to be categorized, and also sort them when generating the documentation. 2013-04-28 15:03:45 -04:00
Michael DeHaan
a81089231e Register skipped tasks so we can at least check their changed/not-changed status. 2013-04-28 10:13:58 -04:00
Kahlil (Kal) Hodgson
9f90f0e856 fix arguments to isinstance() in env lookup 2013-04-28 14:58:26 +10:00
Matt Coddington
3b8f69bac8 add pid to log 2013-04-27 13:00:02 -04:00
Stoned Elipot
75b51f79b4 Add module path library/ if it exists in role directory 2013-04-27 18:43:56 +02:00
Michael DeHaan
75cf5c985b Allow playbook tags to be comma seperated strings as well as lists 2013-04-27 12:29:32 -04:00
Michael DeHaan
bcac289667 Cows don't need to display brackets around strings. 2013-04-27 11:50:53 -04:00
Michael DeHaan
016b04dff1 Merge branch 'roles_dir_search_order' of git://github.com/mcodd/ansible into devel 2013-04-27 11:46:29 -04:00
Brian Coca
caf6bd6ce5 Changed atomic_replace to atomic_move, now ti DOES move atomically in the last
step
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
2013-04-27 11:46:08 -04:00
Michael DeHaan
b8fdcff524 Merge branch 'nocows' of git://github.com/jpmens/ansible into devel
Conflicts:
	lib/ansible/callbacks.py
	lib/ansible/constants.py
2013-04-27 11:34:39 -04:00
Michael DeHaan
553751aee1 Merge branch 'numeric_ids_refactor' of git://github.com/insom/ansible into testing_427 2013-04-27 11:21:30 -04:00
Michael DeHaan
aa55268514 Adds a logfile for ansible playbooks that can be set by the environment or configuration file. 2013-04-27 10:24:26 -04:00
Michael DeHaan
515fbd5a17 Restructure output to prevent rare cases of interlaced I/O in multiprocessing paths. 2013-04-27 09:46:48 -04:00
Matt Coddington
c164609dd6 typo fix 2013-04-25 23:04:17 -04:00
Matt Coddington
c83c534a7d Search for roles in the roles subdir first. Throw an error when no role .yml files are found. 2013-04-25 22:40:04 -04:00
Michael DeHaan
5af271911b Fix duplicate handler notification issue in 1.2 devel 2013-04-25 21:24:15 -04:00
Michael DeHaan
224e20ca60 complex_arg templating should be smarter. Make it so! 2013-04-25 21:11:17 -04:00
Aaron Brady
bd226eb826 Refactor user_and_group so it works off of numbers
There are various cases where a UID to username to UID mapping breaks
down. One UID can be used by two usernames, or no username. If we
always use UIDs internally, then these ambiguous cases won't be a
problem.
2013-04-25 13:23:07 +01:00
Aaron Brady
d2e457f81f Accept numeric user and group parameters 2013-04-25 13:23:07 +01:00
Jeroen Hoekx
ac7a632711 Remove leftover debug statement in template code. 2013-04-25 08:47:38 +02:00
Michael DeHaan
21fe750cef Flush handlers before pre and post task sections change, but not between task and roles, as this seems
to be confusing to people (and not usually neccessary)
2013-04-24 22:28:06 -04:00
Michael DeHaan
6fdfbb1a34 Improve variable smushing so it only has to be done in one place. This is related to shlex.split being called
on untemplated variables in some rare cases.
2013-04-24 22:00:40 -04:00
Michael DeHaan
af2fb56a10 Changes to allow WANT_JSON to allow JSON to non-Python modules 2013-04-24 22:00:40 -04:00
Stephen Fromm
189b210f5a Catch exception when logging to systemd journal fails
systemd journal will throw IOError exception when journal.sendv() fails.
This catches that and falls back to syslog.  See issue #2773.
2013-04-24 15:00:47 -07:00
Jan-Piet Mens
dfd885a012 Make ANSIBLE_NOCOWS configurable
nocows = 1 in ansible.cfg
	or old environment variable ANSIBLE_NOCOWS=1
add to ansible.cfg example
2013-04-23 16:43:23 +02:00
Michael DeHaan
bd0c22868e With fileglob should return full paths as in 1.1 2013-04-23 00:54:39 -04:00
Michael DeHaan
35e61d8f16 Merge pull request #2688 from dagwieers/module-global
New module 'set_fact' to define host facts
2013-04-22 21:16:46 -07:00
Michael DeHaan
be947e5266 Resolve merge conflict 2013-04-22 23:57:20 -04:00
Michael DeHaan
9871707998 If sudoing and the sudo user is not root, the original file is saved as you, therefore delete that file as you. 2013-04-22 23:43:13 -04:00
Michael DeHaan
e12f91799c Allow args: var to be used to pass a variable in bare, and also templated versions should also DWIM. 2013-04-22 22:17:55 -04:00
Michael DeHaan
6c778acd91 Smush the braces in various places (hey, that rhymes) to avoid undo key=value splitting surprises
in new template system.
2013-04-22 22:05:06 -04:00
Michael DeHaan
5cced79cf3 Allow variables to be used raw in with_nested 2013-04-22 21:35:09 -04:00
Michael DeHaan
fbea88b9d9 Allow the environment string to be referenced by a bare variable name like:
environment: foo
2013-04-22 21:29:15 -04:00
Michael DeHaan
f9f1d5ee42 Merge pull request #2745 from sfromm/issue2742
Fix test so that it is /bin/sh compliant (issue #2742)
2013-04-22 16:23:26 -07:00
Stephen Fromm
ab3cb4912e Fix test so that it is /bin/sh compliant (issue #2742)
The old test used syntax that appeared to be bash-specific and did not
work on platforms where /bin/sh did not point to bash.  See issue #2742
where copy to solaris hosts failed with the error:

    output: {'stdout': '', 'stderr': '/bin/sh: test: argument expected\n',
             'rc': 1}
2013-04-22 16:14:27 -07:00
Michael DeHaan
3e0c33c1fa Empty plays should still gather facts 2013-04-21 17:35:09 -04:00
Michael DeHaan
b08181e9b4 Merge pull request #2731 from stoned/flush_handlers-cleanup
handlers must be run once
2013-04-21 14:14:04 -07:00
Michael DeHaan
08324cb5d7 Allow play tagging in context of new meta-tasks. 2013-04-21 17:12:12 -04:00
Stoned Elipot
747c7f0dff handlers must be run once
so remove all occurences of each host from the handlers notified by
lists
2013-04-21 17:23:13 +02:00
Michael DeHaan
32fb6c807c Allow handlers to run in between pre_tasks, roles, tasks, and post_tasks. 2013-04-20 18:03:03 -04:00
Michael DeHaan
37789a852a Rename set_up and tear_down to pre_tasks and post_tasks 2013-04-20 16:19:01 -04:00
Michael DeHaan
d7623d1f91 Added a 'set_up' and 'tear_down' which are like tasks, but execute before and after roles. 2013-04-20 16:07:06 -04:00
Michael DeHaan
e6bf01a6b0 Make plugin loader path operations more efficient. 2013-04-20 12:31:14 -04:00
Michael DeHaan
5a8dff5bce Instantiate inventory plugins only once for efficiency reasons. 2013-04-20 09:59:40 -04:00
Michael DeHaan
817b0cdc80 Instantiate filter plugins only once to save some efficiency. 2013-04-20 09:51:20 -04:00
Michael DeHaan
6e1514e975 Merge pull request #2727 from dsedivec/devel
Don't send unicode instances to the selinux module
2013-04-20 06:21:27 -07:00
Michael DeHaan
5b44c3d52c Merge commit '53ac0bb' into devel 2013-04-20 09:13:10 -04:00
Michael DeHaan
87788b1d17 Ignore inventory config files when using an inventory directory. 2013-04-20 09:10:19 -04:00
Michael DeHaan
53ac0bbec2 Instantiate callback plugins only once so we can set play/task objects on them and they'll stick. 2013-04-20 09:09:35 -04:00
Dale Sedivec
c8f4a56cad Don't send unicode instances to the selinux module
This fixes #2632.  Briefly: specifying things like paths using complex
args in a playbook will make the objects unicode instances.  The selinux
module does not accept unicode instances for its char * arguments; it
wants str instances.

Per mpdehaan's comment on #2632 I just went ahead and converted all
paths to UTF-8.  I don't know if it would be better to do something like
converting to locale.getpreferredencoding(), but I factored all the
conversions out into new method _to_filesystem_str, so there's only one
place that needs to be changed in the future.
2013-04-19 20:12:11 -05:00
Michael DeHaan
df93d7dd97 Ignore inventory config files when using an inventory directory. 2013-04-19 19:01:19 -04:00
Michael DeHaan
8e7dc3c79c Remove an extra space in the module execution line if no environment was set. 2013-04-19 08:11:56 -04:00
Dag Wieers
b13beb3689 New module 'set_fact' to define host facts
This module allows you to set host facts (or export play variables to the playbook scope if you fancy that).

The module also accepts complex arguments.

```yaml
 - action: set_fact fact="something" global_fact="${local_var}"'
 - action: set_fact
   args:
      fact: something
      global_fact: ${local_var}
```
2013-04-18 23:06:58 +02:00
Seth Vidal
7b8cec3f59 clean up first_found to fix a few issues:
- add a skip option so it won't raise an exception if you don't match anything
 - make it work as a drop-in replacement for first_available_file
 - document in the module comments all of the above cases
2013-04-18 16:47:10 -04:00
Michael DeHaan
5f1e2afc34 Revert "make atomic_replace use shutil.copy2 instead of os.rename() so it will work across filesystems".
AR function was leaving some tmp files behind, want to revert, will have better implementation soon, this is the old way now.

This reverts commit f74a1fa4f0.
2013-04-18 15:46:42 -04:00
Michael DeHaan
d8bf87b008 (A) include errors in inventory scripts should they occur.
(B) allow registration with ignore_errors: True
2013-04-17 22:27:00 -04:00
Bernhard Weitzhofer
fb0a99e5d8 Fix if-statement that always evaluates True 2013-04-17 19:40:06 +02:00
C. Morgan Hamill
88eb5516eb Fix 'sequence' plugin error.
If 'terms' is a string, replace it with a single item list.
2013-04-17 11:45:28 -04:00
C. Morgan Hamill
663d37b537 Fix errors in lookup plugins.
Lookup plugins 'sequence' and 'template' now import 'ansible.utils'
appropriately in order to use the 'listify_lookup_plugin_terms'
function.

Also, 'dnstxt' and 'env' now check to see if 'terms' is a string;
without this calls like '{{ lookup('env', 'HOME') }}' fail.
2013-04-17 11:31:38 -04:00
Dale Sedivec
515fd9e915 copy action plug-in check mode respects force=no
The copy action accepts force=no, which tells it not to replace an
existing file even if it differs from the source.  The copy action
plug-in wasn't respecting this option when operated in check mode, so it
would report that changes are necessary in check mode even though copy
would make no changes when run normally.

Runner._remote_md5 was changed to make the logic for setting rc perhaps
a little more clear, and to make sure that rc=0 when the file does not
exist.
2013-04-16 20:22:51 -04:00
Michael DeHaan
7c6341718e Merge branch 'combine_vars' of git://github.com/laggyluke/ansible into exp
Conflicts:
	lib/ansible/inventory/vars_plugins/group_vars.py
	lib/ansible/runner/__init__.py
	lib/ansible/utils/__init__.py
	test/TestPlayBook.py
2013-04-16 20:06:06 -04:00
C. Morgan Hamill
863cb50530 Allow '.yml'/'.yaml' extension on group_vars files.
Look for a file with the base name of the group/host, first without
a file extension, then with a '.yml' extension, and, finally, with
a '.yaml' extension, loading vars from only the first one found.
2013-04-16 19:59:23 -04:00
Michael DeHaan
b54e955595 Remove a debug statement. 2013-04-16 19:09:12 -04:00
Michael DeHaan
86d47bce5f Make more lookup plugins tolerant of new variable system, with a little better 'do what I mean' logic to resolving
what happens if you get a string back as a template result.
2013-04-16 19:07:19 -04:00
Michael DeHaan
c0f8af5202 Make more lookup plugins happy with newstyle variables. Not quite done, but this fixes up with_items/with_nested/file/fileglob. 2013-04-16 18:50:30 -04:00
Seth Vidal
f74a1fa4f0 make atomic_replace use shutil.copy2 instead of os.rename() so it will
work across filesystems
2013-04-16 15:15:58 -04:00
Michael DeHaan
0944e7d56a Make less template calls on playbook objects. 2013-04-12 21:48:01 -04:00
Michael DeHaan
44a9352338 Also template handlers only at the end. 2013-04-12 20:32:35 -04:00
Michael DeHaan
e7f5186dec Merge pull request #2623 from willthames/when_set_bug
Prevent premature variable substitution in tasks
2013-04-12 17:19:25 -07:00
Michael DeHaan
3ab0ed5fd4 Allow 'when' and 'with_items' to be applied to roles. 2013-04-12 19:02:56 -04:00