Commit graph

6429 commits

Author SHA1 Message Date
smoothify
494043947d Add support for role defaults. These are variables on a per role basis with lowest precedence. 2013-08-20 10:11:39 +01:00
James Cammarata
49b0ff18a7 Missed some typos in macros for the xattr doc 2013-08-20 00:50:56 -05:00
James Cammarata
230077fda9 Fixing docs in xattr module 2013-08-20 00:47:07 -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
Brian Harring
31061213fa Fix inconsistency in hostvars access.
Previously, hostvars would only expose a keys() list of hosts that had
been seen yet- however you could explicitly access the host if you knew
the name, and get the content that way.  This precludes template code
from being able to safely access information about other hosts if any
limiters/tags were in use.

Additionally, the object was inconsistent for hostvars['myhost'] access
and [x[1] for x in hostvars.items() if x[0] == 'myhost'] access; this is
due to the original derivation from the dict object.  .items() would be
handled by dict.items(), using the passed in setup_cache values without
using the actual lookup content.

This patch rebases the class implementation to a py2.6 dictmixin, fixing
those issues and restoring behaviour to match what the docs claim.
2013-08-19 23:57:08 -04:00
Brian Harring
902183ac0e Enforce alphanumeric ordering for plugins grabbed via glob.
If this isn't done, it's left to directory ordering which can result
in indeterminent behaviour.
2013-08-19 19:48:17 -04:00
James Cammarata
0747d41e76 Cleaning up some typos in the xattr module 2013-08-19 16:08:32 -05:00
James Cammarata
5e4f9657ca Merge branch 'xattr2' of https://github.com/bcoca/ansible into bcoca-xattr2 2013-08-19 15:42:51 -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
b655d5798b add tests for the -i option when used with raw string for ipv4
and ipv6 addresses.
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
Michael DeHaan
1509e995df Merge pull request #3874 from mscherer/relax_nova_compute_argument
image_id is not required to delete a vm from openstack
2013-08-19 12:16:04 -07:00
Michael DeHaan
8e23d509d3 Merge pull request #3885 from tidzo/devel
Fixed tiny bug with _meta handling in external inventory scripts
2013-08-19 12:08:48 -07:00
James Cammarata
a39aa57c5c Fixing small typo in redis module documentation 2013-08-19 14:04:58 -05:00
James Cammarata
17aa738872 Merge branch 'redis-config' of https://github.com/slok/ansible into slok-redis-config 2013-08-19 13:35:31 -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
77b98df63b Minor fix, vpc_id is not required for the ec2_group 2013-08-19 11:38:06 -05:00
Andrew de Quincey
58e85855e4 Add module to control EC2 security groups 2013-08-19 11:38:06 -05:00
Greg Buehler
500e6fa374 Added Zabbix inventory plugin 2013-08-19 16:40:40 +02:00
Michael DeHaan
00256af5bd Merge pull request #3878 from sjahl/apt_repository-perms-fix
setting 0644 permissions on mkstemp file handles. Fixes issue #3857
2013-08-18 13:17:14 -07:00
sjahl
4dd68c07a0 setting 0644 permissions on mkstemp file handles. Fixes issue #3857 2013-08-18 11:03:43 -04:00
Mark Harrison
a347bfa2bb Merge branch 'pacman_local' into pacman_local_plus_check
Conflicts:
	library/packaging/pacman
2013-08-17 17:56:33 -04:00
Mark Harrison
0419fb74bb Support check mode with pacman module 2013-08-17 17:44:41 -04:00
Mark Harrison
f52a1c8f46 Allow installation of local packages with pacman 2013-08-17 14:46:16 -04:00
Michael Scherer
472654447c Allow to use '*test*' in enablerepo for yum action
Yum commandline permit to use a wildcard to enable and disable
repositories in the --enablerepo switch, permitting to enable
a complete set of repository at once ( like all rpmfusion, all
update-testing, etc ).

However, this doesn't work in yum due to more stringent checks
that verify that a exact match is given for the name of the
repository , see commit 5c26805.

This commit enhance the check by permitting to test more than
1 repository at a time, thus permitting to use wildcards.
2013-08-17 18:43:53 +02:00
Michael Scherer
3f158a4688 image_id is not required to delete a vm from openstack
Since deletion do not check the type of image or anything,
and since that's tedious to keep track of the image_id and
just adding noise to add image_id for nothing, this commit
just relax the requirement.
2013-08-17 17:56:19 +02: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
5452f0062b Updated changelog 2013-08-16 22:14:15 -04:00
Michael DeHaan
15e2ccd2d9 Moving some role deps stuff around a small amount. 2013-08-16 22:05:26 -04: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
0eb1827936 Some install guide tweaks. 2013-08-16 17:02:35 -04:00
Michael DeHaan
f2ec0d5ff2 Update changelog 2013-08-16 15:24:33 -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
5429586985 Adding documentation on role dependencies and variable scope/inheritance 2013-08-16 10:34:45 -05:00
Michael DeHaan
33810c60cd Merge pull request #3867 from bcoca/pingdom_nicer_import_error
now missing dep gives nicer error and docs disambiguate lib
2013-08-16 04:45:48 -07: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
Brian Coca
52dd1dd4c5 now missing dep gives nicer error and docs disambiguate as several libs
out there have same name.
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
2013-08-15 21:26:35 -04:00
Darragh O'Reilly
fb42efc355 quantum_network should not default network provider type to local
It should allow the Quantum service to decide based on its configuration.
2013-08-15 19:51:22 +01: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
Jesse Keating
2b96c347dc Exit with status 3 if no failures but unreachable.
Provide hints to playbook callers that a playbook execution had
unreachable vs failures. 2 == failures, 3 == no failures, but
unreachable hosts. 0 continues to be all good.
2013-08-14 13:37:26 -07:00
Luca Berruti
eee278e02b fix 2013-08-14 13:26:14 +02:00
Luca Berruti
5048218ab5 Fix: with_items and complex_args 2013-08-14 11:49:46 +02:00
James Cammarata
10a0f03cdc Cleaning up of apt_repository module and removing wget parts 2013-08-13 16:11:03 -05:00
Michael Vogt
de404eac06 use either pycurl or wget to download from launchpad, also improve error message if neither is installed 2013-08-13 14:39:47 -05:00
Michael Vogt
5e56d42ed1 use pycurl instead of urllib2 when talking to launchpad to actually get SSL cert verification, see https://bugs.launchpad.net/ubuntu/+source/software-properties/+bug/915210 or CVE-2011-4407 for a previous similar issue in software-properties 2013-08-13 14:39:47 -05:00
James Cammarata
c4852f6954 Cleaning up some pep8 whitespace issues in mongodb_user 2013-08-13 13:00:37 -05:00