Commit graph

3262 commits

Author SHA1 Message Date
Dag Wieers
9ea26c75f9 Make --list-hosts consider all plays (in multiple playbooks)
Currently when more than one playbook is provided on the commandline, ansible-playbook --list-hosts will only consider the first playbook and stop. This change will make it work for the various different playbooks.
2012-11-15 17:47:01 +01:00
Michael DeHaan
0ab3bd0034 Fix for #1577 (python 2.4 compliance for mysql_user), tested only for syntax, please exercise MySQL fans! 2012-11-14 20:02:39 -05:00
Michael DeHaan
ab5c0dfe7e __new__ does not take arguments, remove deprecation warning 2012-11-14 19:58:44 -05:00
Michael DeHaan
89bb1b8368 Fixup fireball installation playbook 2012-11-14 18:39:01 -05:00
Michael DeHaan
096607eea4 Allow fireball to transfer binary files, fixup fireball docs, make fetch work with fireball. 2012-11-14 18:37:17 -05:00
Michael DeHaan
8c0f83a2c9 Update "Who Uses Ansible" 2012-11-14 18:21:06 -05:00
Michael DeHaan
613539810e Missing import 2012-11-14 18:19:16 -05:00
Michael DeHaan
d500398e76 Merge pull request #1616 from dagwieers/skip-register
Do not register variable if host has been skipped
2012-11-14 06:33:30 -08:00
Michael DeHaan
52e2654faf Merge pull request #1621 from dhozac/lookup-with-vars
Lookup plugin arguments need to be templated
2012-11-14 06:32:39 -08:00
Michael DeHaan
73ae930659 Merge pull request #1623 from dhozac/group-hosts-set
Create a set of all the hosts in a group to prevent duplicates
2012-11-14 06:32:17 -08:00
Daniel Hokka Zakrisson
17e4ce97a4 Create a set of all the hosts in a group to prevent duplicates
Fixes #1516.
2012-11-14 13:35:21 +01:00
Daniel Hokka Zakrisson
e74ffd6764 Lookup plugin arguments need to be templated 2012-11-14 11:17:30 +01:00
Dag Wieers
302eeae65d Do not register variable if host has been skipped
Executive summary: skipping a host corrupts a variable (when it is registered)

We have a play existing out of multiple tasks that check a condition, if one of these tasks fails we want to skip all next tasks in the playbook. I noticed that if we skip a task because a certain condition is met, and this task has a register-attribute, I loose the value in the variable. Which means we cannot use that variable in subsequent tasks to evaluate because it was skipped:

```
- action: command test -d /some/directory
  register: task

- action: command test -f /some/directory/file
  register: task
  only_if: '${task.rc} == 0'

- action: do something else
  only_if: '${task.rc} == 0'
```

In the above example, if the second task is skipped (because the first failed), the third action will end with a "SyntaxError: invalid syntax" complaining about the unsubstituted ${task.rc} (even though it was set by the first task and used for skipping the second).

The following play demonstrates the problem:

```
- name: Test register on ignored tasks
  hosts: all
  gather_facts: no

  vars:
    skip: true
    task: { 'rc': 666 }

  tasks:
  - action: debug msg='skip = ${skip}, task.rc = ${task.rc}'

  - name: Skip this task, just to test if task has changed
    action: command ls
    register: task
    only_if: '${skip} != True'

  - action: debug msg='skip = ${skip}, task.rc = ${task.rc}'

  - name: Now use task value
    action: command echo 'Works !'
    only_if: '${task.rc} == 0'
```

And the enclosed fix, fixes the above problem.
2012-11-13 16:57:10 +01:00
Michael DeHaan
44af1408ee Merge pull request #1611 from dhozac/no-hostvars-templating
Keep hostvars from being templated
2012-11-13 05:20:48 -08:00
Michael DeHaan
6793bcbe4d Merge pull request #1613 from dhozac/use-all-vars-for-hosts-template
Use all available vars for hosts:, user: and sudo_user:
2012-11-13 04:47:03 -08:00
Michael DeHaan
2303f65a1a Merge pull request #1614 from dagwieers/missing-action-error
Print the task name (if any) when complaining
2012-11-13 04:46:41 -08:00
Michael DeHaan
7a48525357 Merge pull request #1612 from dhozac/play-vars-list
Make parameterized playbook includes work with vars as a list
2012-11-13 04:45:58 -08:00
Dag Wieers
b96877e5aa Print the task name (if any) when complaining
After spending 10 minutes to find which playbook had an action/local_action missing, I changed the error to include the task name (if set). The error eventually was caused because I added a name to a task, but the dash before the existing action was not removed.
2012-11-13 12:53:42 +01:00
Daniel Hokka Zakrisson
0be1f11ed5 Use all available vars for hosts:, user: and sudo_user: 2012-11-13 12:20:07 +01:00
Daniel Hokka Zakrisson
eebbbd3f0e Make parameterized playbook includes work with vars as a list
Fixes #1610.
2012-11-13 12:12:18 +01:00
Daniel Hokka Zakrisson
5752d2a850 Fix lookup plugin test properly 2012-11-13 12:09:42 +01:00
Daniel Hokka Zakrisson
c200c26ced Keep hostvars from being templated 2012-11-13 11:34:34 +01:00
Michael DeHaan
e3f7f86ac4 Merge pull request #1608 from dhozac/when_set-non-string
Try to ensure the entire value is quoted
2012-11-12 17:45:47 -08:00
Michael DeHaan
d5be13c3f0 Merge pull request #1605 from romeotheriault/add-md5-support-to-fetch-module
add bsd md5 support to fetch module
2012-11-12 17:45:07 -08:00
Michael DeHaan
96e5408046 Merge pull request #1607 from dhozac/j2-templated-vars
Templating fixes and features
2012-11-12 17:44:09 -08:00
Daniel Hokka Zakrisson
0ca1775bda Try to ensure the entire value is quoted 2012-11-13 02:40:29 +01:00
Daniel Hokka Zakrisson
25a8787e95 Template all variables before returning them to Jinja2 2012-11-13 02:39:33 +01:00
Michael DeHaan
df458fb3b5 Merge pull request #1606 from romeotheriault/minor-linux-user-fixes
minor linux user module fixups
2012-11-12 17:39:07 -08:00
Daniel Hokka Zakrisson
d2dce1d63f Make lookup plugin replacements part of the main variable logic 2012-11-13 02:18:05 +01:00
Daniel Hokka Zakrisson
f91fa9f765 Fix lookup plugin test 2012-11-13 02:13:10 +01:00
Daniel Hokka Zakrisson
a2bb3a09d2 Completely ignore stray $ in input
Previously, "a $ string $var" would not have gotten replaced at all.
2012-11-13 02:13:10 +01:00
Daniel Hokka Zakrisson
24b536d7ed Add some comments to templating system 2012-11-13 02:13:04 +01:00
Romeo Theriault
ae36fb1dc6 minor linux user module fixups 2012-11-12 11:13:51 -10:00
Romeo Theriault
4cd133ed8f add bsd md5 support to fetch module 2012-11-12 10:37:00 -10:00
Michael DeHaan
8f9bef9d51 Merge pull request #1604 from dhozac/consume-module_vars-early
Template using module_vars early
2012-11-12 08:24:00 -08:00
Daniel Hokka Zakrisson
233a36b9e8 Template using module_vars early
Since no basedir is available at that time, avoid invoking
lookup plugins since they assume it is present.
2012-11-12 16:53:24 +01:00
Michael DeHaan
f54af8f0f6 Merge pull request #1603 from dagwieers/rpm-makefile-fix
moduleformatter.py should include our own ansible clone
2012-11-12 05:25:38 -08:00
Dag Wieers
a162fa70da moduleformatter.py should include our own ansible clone
Without this, module_formatter.py relies on the installed ansible which is wrong in more than one way.
2012-11-12 14:22:30 +01:00
Michael DeHaan
c890ae18e7 Merge pull request #1575 from dhozac/parameterized-playbook-include
Add parameterized playbook includes
2012-11-12 05:17:38 -08:00
Michael DeHaan
3e855a5fcd Merge pull request #1593 from dhozac/lookup_generic
Add support for generic $XXX() to call $LOOKUP()
2012-11-12 05:07:52 -08:00
Michael DeHaan
451f05fa3d Merge pull request #1594 from sfromm/issue1342
Add ability to specify syslog facility for modules
2012-11-12 05:06:47 -08:00
Michael DeHaan
2f517f1cd3 Merge pull request #1600 from fdavis/devel
ansible-playbook verifies playbooks exist before running them
2012-11-12 05:05:03 -08:00
Michael DeHaan
753ee0b88d Merge pull request #1601 from romeotheriault/fix-remote-md5-for-solaris10
remove verbose option on digest call
2012-11-12 05:01:50 -08:00
Romeo Theriault
54b7f59416 remove verbose option on digest call 2012-11-11 19:43:40 -10:00
fdavis
7256c5af1a ansible-playbook verifies playbooks exist before running them
refers to #1345
2012-11-11 18:08:35 -08:00
Michael DeHaan
68e16773ae Merge pull request #1595 from sfromm/issue1564
Add --limit to calls to ansible and ansible-playbook
2012-11-11 16:23:34 -08:00
Michael DeHaan
da210c3eff Added changelog note about 'when' 2012-11-11 11:59:38 -05:00
Michael DeHaan
9c16b3fc91 Organize 0.9 changelog 2012-11-11 11:55:28 -05:00
Michael DeHaan
a56dc03180 update changelog 2012-11-11 11:43:31 -05:00
Stephen Fromm
06e54c0b97 Add ability to specify syslog facility for modules
Update constants.py so that one can specify environmental variable
ANSIBLE_SYSLOG_FACILITY or syslog_facility in ansible.cfg to define
the syslog facility to use.  Alternatively, you can specify
ansible_syslog_facility in inventory.  Runner now replaces
the syslog facility in the openlog() call with the default or
the injected variables ansible_syslog_facility.

This also updates hacking/test-module to behave similarly.
2012-11-11 00:14:08 -08:00