Commit graph

1814 commits

Author SHA1 Message Date
James Cammarata
e6ad3b7792 Merge pull request #3895 from mscherer/fix_option_new_ssh
make sure ssh do not ask password
2013-08-22 10:26:54 -07:00
James Cammarata
157b697a83 Merge branch 'always_run-6' of https://github.com/stoned/ansible into stoned-always_run-6 2013-08-22 12:10:28 -05:00
James Cammarata
af4f0bd008 Fix for "argument must be an int, or have a fileno() method" error
The issue was that, when forks == 1, the _executor() function was
being called with None for the value of new_stdin.

Fixes #3841, #3902
2013-08-21 22:45:34 -05:00
James Cammarata
978af89175 Disallow running async tasks with lookup plugins
Fixes #2897
2013-08-21 16:44:10 -05:00
James Cammarata
ed3e4aff84 Place retry file in the user's home dir instead of /var/lib/tmp
Addresses CVE-2013-4260: predictable filename used for failed results
in world writable directory.
2013-08-21 11:40:46 -05:00
James Cammarata
6bf5d19506 SSH connection plugin creates ControlPersist socket files in a secure directory
Files were being created in /tmp, but will now be created in $HOME/.ansible/cp/
Addresses CVE-2013-4259: ansible uses a socket with predictable filename in /tmp
2013-08-21 11:40:46 -05:00
Stoned Elipot
f0743fc32a Introduce the 'always_run' task clause.
The 'always_run' task clause allows one to execute a task even in
check mode.

While here implement Runner.noop_on_check() to check if a runner
really should execute its task, with respect to check mode option
and 'always_run' clause.

Also add the optional 'jinja2' argument to check_conditional() :
it allows to give this function a jinja2 expression without exposing
the 'jinja2_compare' implementation mechanism.
2013-08-20 23:09:44 +02:00
Michael Scherer
2bdba17a85 make sure ssh do not ask password
For some reason, ssh seems to ask for password even when
PasswordAuthentication is set to no, adding PreferredAuthentications
with the 2 options removed do the trick.
2013-08-20 22:02:37 +02:00
Kavin Kankeshwar
7ac3bbc198 resolved #3609 Change max_fail_pct to max_fail_percentage as recommended 2013-08-20 13:55:34 -05:00
Kavin Kankeshwar
3f247fcbe3 fixes ansible/ansible#3609 Add max_fail_pct to playbook parameter, to complement serial option, So if total number of failures execeed max_fail_pct * total number of hosts, do not go to the next serial batch 2013-08-20 13:55:22 -05:00
Petr Svoboda
e3adfbf5f8 Add tests for undefined variable detection
Tests `test_playbook_undefined_varsX_fail` check if ansible detects
undefined variables when `error_on_undefined_vars` is enabled. These
tests fail without "Improve behavior with error_on_undefined_vars
enabled" patch.

Tests `test_playbook_undefined_varsX_ignore` check if ansible ignores
undefined variables when `error_on_undefined_vars` is disabled.

Also modify PlayBook._run_task_internal() so error_on_undefined_vars is
testable.
2013-08-20 00:40:49 -05:00
Petr Svoboda
fff4f1da33 Improve behavior with error_on_undefined_vars enabled
Pass fail_on_undefined flag to recursive calls to `template` function,
so more undefined variables are detected.

Works only for Jinja style variables. Undefined legacy variables are
never detected.
2013-08-20 00:40:49 -05:00
James Cammarata
39628d012d Minor fix to ipv6 detection for inventory with -i
For link-local addresses, it is sometimes necessary to append the
interface to use for the ipv6 address. This patch extends the ipv6
regex to allow for '%ifnameX' at the end.

See https://bugzilla.redhat.com/show_bug.cgi?id=136852 for more info
2013-08-19 15:27:21 -05:00
Michael Scherer
3aac187387 fix ssh connection plugin to work with ipv6 address
Due to various inconsistencies of ssh and sftp regarding ipv6 and
ipv4 handling, some special arguments must be passed, and the
ipv6 must be passed in a specific format.
2013-08-19 15:27:20 -05:00
Michael Scherer
c9d28e10ad add support for using a ipv6 in -i
testing with a ipv6 :
  ansible -u misc -i  '[2002::c23e]:22,' '*' -m ping

fail due to parsing of ':' as a separator of port/ip with ipv4.
This commit add support for properly parsing 2002::c23 and the
bracket notation [2002::ce]:2222
2013-08-19 15:27:20 -05:00
Matt Saunders
9fd1b174f5 Fixed tiny bug with _meta handling in external inventory scripts 2013-08-19 18:54:30 +01:00
James Cammarata
5847720746 Fixing a small bug with the new role dependency feature
The block that added the original list of roles was indented too far,
and was only being reached if a role had dependencies. This resulted
in roles without dependencies from being added to the list of roles.

Credit goes to looped for reporting and diagnosing the issue.
2013-08-17 00:06:24 -05:00
Michael DeHaan
42648e2f0a Merge branch 'role_dependencies' of git://github.com/jimi1283/ansible into jimi1283-role_dependencies 2013-08-16 21:42:57 -04:00
Michael DeHaan
dacd311474 Removing synchronize momentarily as it looks like this won't make 1.3 dates 2013-08-16 15:22:39 -04:00
James Cammarata
d8a7a2d1b2 Adding evaluation of role vars as the dep tree is built
This allows variables to be inserted into the role scope specifically
while also being inserted into the global scope.
2013-08-15 20:53:23 -05:00
James Cammarata
e12b99dba6 Small cleanup, no need to call _get_role_path a second time 2013-08-15 09:29:51 -05:00
James Cammarata
9a401e73a6 Adding support for role dependencies.
Fixes #3686

Dependencies are enabled by adding a new directory/file named
meta/main.yml to the role. The format of the dependencies are:

dependencies:
- { role: foo, x: 1, y: 2 }
- { role: bar, x: 3, y: 4 }
...

Dependencies inherit variables as they are seen at the time of the
dependency inclusion. For example, if foo(x=1, y=2) has a dependency
on bar(x=3,z=4), then bar will have variables (x=3,y=2,z=4).

Different roles can have dependencies on the same role, and this
variable inheritence allows for the reuse of generic roles quite easily.
For example:

Role 'car' has the following dependencies:
dependencies:
  - { role: wheel, n: 1 }
  - { role: wheel, n: 2 }
  - { role: wheel, n: 3 }
  - { role: wheel, n: 4 }

Role 'wheel' has the following dependencies:
dependencies:
- { role: tire }
- { role: brake }

The role 'car' is then used as follows:
- { role: car, type: honda }

And tasks/main.yml in each role simply contains the following:
- name: {{ type }} whatever {{ n }}
  command: echo ''

TASK: [honda tire 1]
TASK: [honda brake 1]
TASK: [honda wheel 1]
TASK: [honda tire 2]
TASK: [honda brake 2]
TASK: [honda wheel 2]
TASK: [honda tire 3]
TASK: [honda brake 3]
TASK: [honda wheel 3]
TASK: [honda tire 4]
TASK: [honda brake 4]
TASK: [honda wheel 4]
TASK: [I'm a honda]  <- (this is in roles/car/tasks/main.yml)
2013-08-15 09:29:51 -05:00
James Cammarata
ad595eadea Enable error_on_undefined_vars by default 2013-08-15 09:28:34 -05:00
Michael DeHaan
bc02e20503 Merge branch 'rsynctake2' into devel
Conflicts:
	CHANGELOG.md
2013-08-11 16:22:36 -04:00
Michael DeHaan
17aa0d12de Merge pull request #3814 from ftao/inventory_dir_abs
fix inventory.basedir is not absolute path when hostfile is startswith "./"
2013-08-11 08:46:08 -07:00
Abhijit Menon-Sen
1a90d01ba9 Fix some typos discovered during casual reading 2013-08-11 18:41:23 +05:30
ftao
51a180b150 fix inventory.basedir is not absolute path when hostfile is startswith "./" 2013-08-11 10:50:47 +08:00
Michael DeHaan
f8c97d6e79 Style/docs cleanup, and also improve an error message. 2013-08-10 18:58:45 -04:00
Michael DeHaan
aeb8649da5 Merge branch 'ansible-rsync-take2' of git://github.com/tima/ansible into rsynctake2 2013-08-10 18:31:45 -04:00
Michael DeHaan
4d1f447908 Merge pull request #3650 from bcoca/forking_optimizations
forking least possible
2013-08-10 15:29:19 -07:00
Michael DeHaan
baffa8df72 These fields are booleans. 2013-08-10 18:16:01 -04:00
Michael DeHaan
633abca916 Merge branch 'nocolor' of git://github.com/amenonsen/ansible into devel 2013-08-10 18:11:27 -04:00
Michael DeHaan
ee11d69697 Merge branch 'better_ini_errors2' of git://github.com/bcoca/ansible into devel 2013-08-10 18:01:17 -04:00
Michael Vogt
89bc43cab0 support i18n on sudo failure 2013-08-10 17:56:39 -04:00
Serge van Ginderachter
9991a530ab fix an encoding bug in copy content = lookup plugin
closes #3518
2013-08-10 17:37:04 -04:00
Michael DeHaan
66b29b6813 Merge branch 'feature/gh-3789-inventory-file' of https://github.com/resmo/ansible into devel 2013-08-10 17:11:48 -04:00
Michael DeHaan
1d13ec2da3 Construct the multiprocessing manager only once. 2013-08-10 09:32:46 -04:00
René Moser
e8272e365d
implemented 'inventory_file' variable. Closes GH-3789. 2013-08-10 13:04:56 +02:00
Timothy Appnel
2288a11b6a Implemented setup method in rsync action module. 2013-08-09 21:24:50 -04:00
Timothy Appnel
4a9635e04e Straighten out local-remote-delegate logic in rsync action module. Force set delegate to local if one is not defined. 2013-08-09 21:24:49 -04:00
Timothy Appnel
adbca9d251 Fixed identity key logic. 2013-08-09 21:24:47 -04:00
Timothy Appnel
9f170f579a Introduced ansible-rsync to core. 2013-08-09 21:24:46 -04:00
James Cammarata
ceff3b6ba3 Minor modification to set_fact with_items patch
Previous patch was reverted due to the fact that there was an issue
with the results not always being a dictionary (they're sometimes
a unicode string, ie. when the with_items is used with yum). This
minor change corrects that by checking for a dict object.
2013-08-09 07:52:14 -05:00
James Cammarata
8be2fc745b Revert "Check for ansible_facts in results for with_ tasks"
This reverts commit 1a4e6e415e.
2013-08-08 20:32:30 -05:00
Serge van Ginderachter
1a4e6e415e Check for ansible_facts in results for with_ tasks
that loop over a lookup plugin. Fixes #3704 and #3735
2013-08-08 12:30:32 -05:00
Serge van Ginderachter
40e60c947d Host specifiers should be sorted
to ensure consistent behavior, hosts should look like this:

    hosts: webservers:&boston:!rack42

So when applying the host selectors, run those without the "&" first,
then the &s, then the !s.

Closes #3500
2013-08-08 18:32:24 +02:00
Abhijit Menon-Sen
0c96d8af6e Add a nocolor setting to ansible.cfg 2013-08-08 21:37:33 +05:30
Brian Coca
a937a6a66d now bad ini entries will throw friendlier error
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
2013-08-07 12:49:12 -04:00
Michael DeHaan
4cbfe3be57 Merge pull request #3773 from cchurch/devel
Update callbacks used for async tasks
2013-08-06 13:32:53 -07:00
Michael DeHaan
ff44c981e9 Merge pull request #3770 from rishid/devel
Add support for INI comments that begin with '#' or ';'
2013-08-06 13:29:39 -07:00