Compare commits

..

4267 Commits

Author SHA1 Message Date
49f7e6a12c update submodule pointer 2016-02-23 14:22:01 -05:00
d70fd17cf9 Merge pull request #14618 from ogenstad/devel
Fixes authentication error bug when user has rsa keys
2016-02-23 14:20:49 -05:00
5d5abbb898 bump next VERSION for -network 2016-02-18 21:36:16 +00:00
3f7b7a1bb9 update submodule pointer 2016-02-18 21:34:02 +00:00
858a0a2339 bugfix on shared module utils from missed cherry-pick
One of the commits was missed when the branch was created.  This fixes the
modules so they work properly
2016-02-18 21:13:57 +00:00
61989f72cc VERSION rename for the -network release 2016-02-17 17:11:44 -05:00
b3da42a669 Updating submodule pointer for the network branch 2016-02-17 16:30:42 -05:00
e15daf186a minor bugfix that will catch connection errors in eos
This commit fixes a situation where connection errors would be caught
but no useful information display.  The connection error is now caught
and emitted in a call to fail_json
2016-02-17 15:41:44 +00:00
9c4467303f minor bugfix that will catch connection errors in ios
This commit fixes a situation where connection errors would be caught
but no useful information display.  The connection error is now caught
and emitted in a call to fail_json
2016-02-17 15:41:37 +00:00
df3f9345e1 minor bugfix that will catch connection errors in iosxr
This commit fixes a situation where connection errors would be caught
but no useful information display.  The connection error is now caught
and emitted in a call to fail_json
2016-02-17 15:41:30 +00:00
5c7c13b9c1 minor bugfix that will catch connection errors in nxos
This commit fixes a situation where connection errors would be caught
but no useful information display.  The connection error is now caught
and emitted in a call to fail_json
2016-02-17 15:41:23 +00:00
0ef6a7ae98 minor bugfix that will catch connection errors in junos
This commit fixes a situation where connection errors would be caught
but no useful information display.  The connection error is now caught
and emitted in a call to fail_json
2016-02-17 15:41:13 +00:00
1fd5bcdc09 minor bug fixes and updates to shell 2016-02-17 15:40:49 +00:00
d178c4be2a Move Conditional class to netcfg.
Added error handling for connect and execute methods.

Fix comments
2016-02-17 15:40:30 +00:00
be846c7053 initial add of action plugin ops_template
Adds new local action ops_config for handling openswitch configurations using
either dc or cli based configurations.  Implements the common net_config
local action.

Note this refactors the ops_config plugin to ops_template
2016-02-17 15:38:36 +00:00
fa2834d863 initial add of new action plugin junos_template
This adds a new action plugin, junos_template that allows the
the junos_template module to perform the templating function.  It
implements net_template
2016-02-17 15:38:29 +00:00
320e099c12 initial add of action plugin nxos_template
Adds new local action for working with cisco nxos configurations.  Implemements
the net_config local action.

Note this action plugin was refactored from nxos_config to nxos_template
2016-02-17 15:38:23 +00:00
f0ee61925a adds new action plugin iosxr_template
This adds a new action plugin iosxr_template that allows the
iosxr_template module to pass network device configurations through the
template engine.  It also allows configurations to be backed up.
2016-02-17 15:38:17 +00:00
d024517d4b initial add of action plugin ios_template
Adds a new local action ios_config for working with cisco ios configuration
files.  Implements the common net_confing local action

Note this plugin was refactored from ios_config to ios_template
2016-02-17 15:37:32 +00:00
651842a4ef initial add of action plugin eos_template
Adds a new local action for eos_config module to handle templating configs
and backing up running configurations.   Implements the local action
net_config

Note this action was refactored from eos_config to eos_template
2016-02-17 15:37:23 +00:00
ee7de10285 Add safety check on _backup key. 2016-02-17 15:37:11 +00:00
bec698052f New release v2.0.1.0-0.2.rc2 2016-02-15 16:02:44 -05:00
729dbe7e67 removed follow from common file docs 2016-02-15 14:14:22 -05:00
032d917e68 Update changelog for dnf fix 2016-02-13 02:09:26 -08:00
9ecdec0141 Update submodule refs 2016-02-13 02:09:26 -08:00
028c710380 Fix bugs related to task_includes and dep chain inheritance
* Fix the way task_include fields were created and copied
* Have blocks get_dep_chain() look at task_include's blocks for proper
  dep chain inheritance
* Fix the way task_include fields are copied to prevent a recursive
  degradation

Fixes #14460
2016-02-13 01:09:16 -05:00
8ee8872d6b Fixing bugs related to nested blocks inside roles
* Make sure dep chains are checked recursively for nested blocks
* Fixing iterator is_failed() check to make sure we're not in a
  rescue block before returning True
* Use is_failed() to test whether a host should be added to the TQM
  failed_hosts list
* Use is_failed() when compiling the list of hosts left to iterate
  over in both the linear and free strategies

Fixes #14222
2016-02-12 16:41:38 -05:00
caf1537510 Display the string which is causing an exception to be raised.
In the ansible template module, when there is an error while
expanding a templated string, displaying the string causing the
exception is very useful.
2016-02-11 22:51:26 -05:00
6f54b1ae2b removed signal trapping 2016-02-11 22:03:00 -05:00
f77690e652 update extras submodule ref
for ec2_vpc_net_facts and elasticsearch module updates
2016-02-11 13:37:41 -08:00
5336a51a9e Update submodule for fix to mysql_user password 2016-02-11 13:09:59 -08:00
9c049b757f Revert "Module params should default to str in most cases."
This reverts commit 9fae8501e2.

Reverting for 2.0.1 -- this has been broken in the 2.0 tree for long
enough that some modules are relying on the broken behaviour.  This fix
will definitely return for 2.1.0 and may return in 2.0.2 (impact needs
to be evaluated).
2016-02-11 12:58:41 -08:00
0ccbbe0c09 allow skipping tasks due to undefined var
mimic 1.x behaviour but give out big deprecation message, not only
for missing attribute but any undefined error.
2016-02-11 14:32:49 -05:00
43bbd4b6dc termination handling
- moved to base cli class to handle centrally and duplicate less code
- now avoids duplication and reiteration of signal handler by reassigning it
- left note on how to do non-graceful in case we add in future
  as I won't remember everything i did here and don't want to 'relearn' it.
2016-02-11 12:42:12 -05:00
517eec8c49 fix cartesian lookup
it seems that this was not working in 1.9 but we swallowed up the error
fixes #14437
2016-02-11 10:36:04 -05:00
b85d9acc09 update core submodule ref 2016-02-10 22:32:32 -08:00
ba5a3f2f67 Update submodule ref 2016-02-10 17:38:24 -08:00
eafc46512d fix typo 2016-02-10 17:37:18 -08:00
39a53c5623 add ismount function from python Lib/posixpath.py
needed for https://github.com/ansible/ansible-modules-core/pull/2737
2016-02-10 17:37:07 -08:00
9fae8501e2 Module params should default to str in most cases. 2016-02-10 15:33:30 -08:00
724761d2a1 read full file when doing diff
but avoid reading file at all or full file when file is too big for diffing
2016-02-10 15:47:44 -05:00
3e2b2b359c Clarify error message when module replacer encounters a bad import line for module_utils code 2016-02-10 08:47:45 -08:00
5ebd5c548c Catch exceptions during module execution so they don't fail the worker
Fixes #14120
2016-02-10 09:24:44 -05:00
18ffa8a4da avoid termination message when term is internal 2016-02-09 18:11:11 -05:00
fa88d0770c Proposed fix for ansible/ansible-modules-extras#1348 due to datetime.datetime type not being matched 2016-02-09 17:12:36 -05:00
24cae22e0b Submodule pointer update 2016-02-09 13:29:45 -05:00
4f2a2ec884 strip BECOME-SUCCESS at lower level
Fixes #14395
2016-02-09 13:12:46 -05:00
7d44063c1e Filter become success string from the stdout of script results
Fixes #14390
2016-02-09 12:38:31 -05:00
dcc0a2d596 Also hide the before state of files with --diff and no_log 2016-02-08 22:06:38 -08:00
c97afd0c48 fix winrm erorr formatting 2016-02-08 23:00:49 -05:00
7c726d197b correctly handle term signals
- adhoc now terminates gracefully
- avoid race condition on terminations by ignoring errors if
  worker might have been reaped between checking if active and termination call
- ansible-playbook now properly exits on sigint/term
- adhoc and playbook now give exceptions that we should not normally capture
  and rely on top level finally to reap children
- handle systemexit breaks in workers
- added debug to see at which frame we exit
partial fix for #14346
2016-02-08 17:23:13 -05:00
13c379dcd0 Added more info to the no action detected error
Error fix
2016-02-08 16:57:54 -05:00
9196a72c3f Add support ssh configs from /etc/openssh.
In Altlinux system config dir for openssh is /etc/openssh.
2016-02-08 10:32:46 -05:00
0b4a259444 Also chmod the args file path when using become for old-style modules
Fixes #14348
2016-02-08 10:02:34 -05:00
5353b8c3b6 Allowing multiple tags to be specified in include's tags argument. 2016-02-08 08:52:55 -05:00
6869ced587 Update core submodule ref to fix apt locale bug 2016-02-07 14:27:48 -08:00
87414e4fd1 Add locale fixes to changelgo 2016-02-07 13:11:32 -08:00
ef9c27e280 Update submodule refs 2016-02-07 12:56:57 -08:00
76ab1d2afc Allow setting run_command environment overrides for the life of an AnsibleModule 2016-02-07 12:55:58 -08:00
a316891968 tag the setup task with always
fixes #14228
2016-02-05 10:35:31 -05:00
3303f25a0c Fix --diff to respect no_log task parameter. 2016-02-04 12:47:44 -08:00
bee699a33a Update submodule refs 2016-02-04 11:12:10 -08:00
4133cf924a Also add 'null' as a possible JSON value 2016-02-04 11:39:20 -05:00
53559433ef Defined JSON booleans in global context for python eval()
We define 'false' and 'true' as variables so that python eval() recognizes them as False and True.

This fixes #14291.
2016-02-04 11:39:20 -05:00
8ca8459af5 Merge pull request #14214 from dvarrazzo/conflicting-actions-message
Better "conflicting action statements" message
2016-02-03 22:55:35 -05:00
6c559e904a Handle when the lookup-plugin is used in jinja-style
This fixes #14190.
2016-02-03 11:18:51 -05:00
901beeec55 avoid logging color codes 2016-02-03 11:00:08 -05:00
4604deca92 Change $() into backticks. Backticks should work for both POSIX and non-POSIX compatible shells.
Fixes #14176
2016-02-02 12:39:55 -08:00
d001c73699 Establish sh as the default shell plugin.
This is a fix for one of the problems pointed out in #14176
2016-02-02 12:19:43 -08:00
53cfde5096 better fix for ansible-pull inventory handling
now it mirrors what it did in previous versions
and properly uses inventory and limit options
2016-02-02 14:29:47 -05:00
6c9d2cc2b4 Note the dnf fix 2016-02-02 10:51:41 -08:00
4de1e26d5c Update submodule refs 2016-02-02 10:49:20 -08:00
8ac8f4c2ab make executable setting connection dependant
winrm shoudl not use executable, rest should?
fixes #14233
2016-02-02 10:22:09 -08:00
5035e53e80 Revert "load now does not modify the incomming data"
This reverts commit 2126e9fee1.
we judge this to be too big a change for stable, keeping in devel
we may still add part or all back to stable in the future.
2016-02-02 11:22:41 -05:00
2126e9fee1 load now does not modify the incomming data
also removed json loader as yaml loader can do both
2016-02-02 11:22:26 -05:00
93cab88663 Don't mark host as having gathered facts when peeking at next task
Fixes #14243
2016-02-02 11:12:28 -05:00
c5f857ec39 Make sure setup tasks inherit properly from their parent play
Fixes #13602
2016-02-02 11:12:24 -05:00
07dd83bc6e deprecate all bare variable conversions (not debug)
now deprecation message appears with variable name in all spots where this occurs
debug's var= option is excluded as this is only place where bare variables shold actually
be accepted.
2016-02-02 00:01:47 -05:00
acb556b3d4 fix incorrect environment processing
it was assumed it could only be a dict or string (it starts out as a list)
also a 2nd assumption that bare vars only would appear in one of the dict keys.

removed deprecation warnings from here as they should be signaled in the bare conversion itself.
2016-02-02 00:01:36 -05:00
48b20684f2 normalize error message on src != dir when local
now action plugin returns same error as module
2016-02-01 13:44:01 -05:00
d7a6ccc4c2 Use isinstance type checks in bool filter so we can handle unsafe proxy objects. Fixes #14240 2016-02-01 12:34:13 -06:00
7f2bc082fa harcoding inventory/hosts when pulling from repo
return to pre 2.0 behaviour which did not factor inventory into the repo pull
2016-01-30 11:39:51 -05:00
d975f32243 added back --profile to keep backwards compat
this was broken by #12548
2016-01-30 11:36:37 -05:00
e8e388a742 Some attributes of callbacks aren't in v2. Port plugins to the v2 way to do that
Update porting guide with info on callback porting
2016-01-30 08:18:19 -08:00
a6c25f143a Explicitly set validate_certs=False as the boto default is True
Fixes #14089
2016-01-29 16:38:18 -08:00
e957ab5a7f fixed code for v1 callback runtime compatiblity
old exception code obsoleted by exception avoidance
errors on callback produce warnings and don't stop play
2016-01-29 17:01:30 -05:00
46002111bb fix unicode input for template lookup
fixes #14207
2016-01-29 16:46:33 -05:00
05bb1b3cb0 Better "conflicting action statements" message 2016-01-29 18:20:09 +00:00
8d7056220d Fix for SLES 11.4, which has now also an /etc/os-release file. 2016-01-29 09:14:13 -08:00
76c941305b When setting up the local connection for the rsync we need to set the shell as well.
Fixes #13490
2016-01-28 20:32:56 -08:00
48da1b8e85 New release v2.0.1.0-0.1.rc1 2016-01-28 16:39:53 -05:00
1e56daf66c More CHANGELOG updates for 2.0.1 2016-01-28 16:32:19 -05:00
506b0a8b61 New release v2.0.0.2-1 2016-01-28 16:24:01 -05:00
ea1339de18 New release v2.0.0.1-1 2016-01-28 16:24:01 -05:00
d60764bc81 Add more entries to changelog 2016-01-28 13:19:31 -08:00
951fa36fca Return an error when synchronize is used with something other than an ssh connection
Suggested in #2832
2016-01-28 16:05:12 -05:00
43cf527fe7 Don't try to generate retry files if the tqm hasn't been initialized
Fixes #14144
2016-01-28 16:02:54 -05:00
a074ebedbc Make retry file generation not use StringIO 2016-01-28 16:02:23 -05:00
d29dfdc84b Re-implementing the retry file feature for 2.0
Fixes #13944
2016-01-28 16:02:19 -05:00
aac8ea0262 Fix lookup of parent attribute when parent doesn't have the attr
Fixes #14100
2016-01-28 16:02:09 -05:00
3db2073909 Only use os.path.basename if get_file_content returned a value, and ensure that service_mgr has line endings stripped. Fixes #14026 2016-01-28 16:01:43 -05:00
0fddd90f14 Handle the key 'prepared' in the 'diff' result from modules
So far, when a 'diff' dict is returned with module results, it is
checked for 'before' and 'after' texts, which are processed in
_get_diff() by python difflib.  This generates the changes to display
when CLI users specify --diff.

However, some modules will generate changes that cannot easily be
expressed in a conventional diff. One example is the output of the
synchronize module, which presents changed files in a common log format
as in `rsync --itemize-changes`.

Add a check for a diff['prepared'] key, which can contain prepared diff text
from modules.
2016-01-28 16:01:15 -05:00
5fe16bef6f Make sure blocks use their parents dependency chains
Fixes a bug inroduced in fb797a9 where included tasks in a role
were not being executed because the child blocks had no dep chain
set.
2016-01-28 15:59:43 -05:00
86b179d3d7 Allow certain base attributes to be used as role params
Role definitions typically require params to be different from those
which are specified as FieldAttributes on the playbook classes used
for roles, however a certain subset should be allowed (typically those
used for connection stuff).

Fixes #14095
2016-01-28 15:59:43 -05:00
7a8520ac1a Fixing role dependency chain creation
The dep chain for roles created during the compile step had bugs, in
which the dep chain was overwriten and the original tasks in the role
were not assigned a dep chain. This lead to problems in determining
whether roles had already run when in a "diamond" structure, and in
some cases roles were not correctly getting variables from parents.

Fixes #14046
2016-01-28 15:59:43 -05:00
8f7868aead Note bugfix for unicode characters and the pager 2016-01-28 11:48:58 -08:00
9ddb4a985c Changes to convert to unicode at the borders
The module docs and vault changes solve issues where tracebacks can
happen.  The galaxy changes are mostly refactoring to be more pythonic
with a small chance that a unicode traceback could have occurred there
without the changes.  The change in __init__.py when we actually call
the pager makes things more robust but could hide places where we had
bytes coming in already so I didn't want to change that without auditing
where the text was coming from.

Fixes #14178
2016-01-28 11:47:21 -08:00
55db4d9e23 Add squashing fix to the changelog 2016-01-28 11:00:23 -08:00
849def8d6e Squashing was occuring even though pkgs didn't have a template that would be affected by squash
This broke other uses of looping (looping for delegate_to in the
reported bug)

Fixes #13980
2016-01-28 10:58:18 -08:00
c0d6a0c11a Update submodule refs 2016-01-28 09:44:19 -08:00
97cd0bc803 fixed unit test to match new output of become/su 2016-01-27 16:50:06 -05:00
7c7e849a27 fixed issue with vars prompt warning causing error
sometimes display object is not magically available, use it explicitly,
no need to be classmethod anymore
fixes #14147
2016-01-27 16:14:03 -05:00
9eaa5fecc1 fix for so su works in more cases
should not fail anymore on csh, fish nor the BSDs
fixes #14116
2016-01-27 14:13:27 -05:00
a0b7620b8e Add fix for 2831 to the changelog 2016-01-26 15:06:37 -08:00
3906614538 Fix for inventory hosts on localhost with alternate ports.
Fixes https://github.com/ansible/ansible-modules-core/issues/2831
2016-01-26 15:05:40 -08:00
03a89e17b9 fixed permissions check for ansible.log
fixes #13990
2016-01-26 11:23:04 -05:00
c52a35ff34 [hotfix] add missed playbook file 2016-01-26 10:45:58 -05:00
16ee2090bd Adding support for scm-based role source urls (incl. integration test to cover it) 2016-01-26 10:45:58 -05:00
7e1a3da97c Add last few major fixes to the 2.0.1 changelog 2016-01-25 20:07:19 -08:00
625e8f2030 Update submodule refs 2016-01-25 19:58:01 -08:00
826f42a153 For synchronize, fix sudo to execute on the remote end of the connection
* In 2.0.0.x become was reversed for synchronize. It was happening on
  the local machine instead of the remote machine. This restores the
  ansible-1.9.x behaviour of doing become on the remote machine.
  However, there's aspects of this that are hacky (no hackier than
  ansible-1.9 but not using 2.0 features).  The big problem is that it
  does not understand any become method except sudo.  I'm willing to use
  a partial fix now because we don't want people to get used to the
  reversed semantics in their playbooks.
* synchronize copying to the wrong host when inventory_hostname is
  localhost
* Fix problem with unicode arguments (first seen as a bug on synchronize)

Fixes #14041
Fixes #13825
2016-01-25 19:55:56 -08:00
1fdf8bca2a python3 doesn't have raw explicit-unicode literals. Workaround it with a raw native string that we make unicode in py2. 2016-01-25 19:48:17 -08:00
6eaf9b9fa2 Transform tracebacks into unicode before printing
Fixes #14042
2016-01-25 19:22:43 -08:00
9a3515357b raise AnsibleError as an 'expected' exception
fixes #14065
2016-01-25 22:21:31 -05:00
cd0812a187 adhoc now respects limit when listing hosts
also removed cruft about localhost as if used it is specified inline
fixes #13848
2016-01-25 17:39:39 -05:00
864c67cec5 ensure stdout callback alwasy is loaded first
it is now called for every event prior to any other callbacks
fixes #14114
2016-01-25 17:13:37 -05:00
7fe91e1848 better error when host inventory script isnt dict 2016-01-25 16:32:57 -05:00
084bacc4a4 add webdocs as alias 2016-01-25 16:32:38 -05:00
e6c9d9c81b Update CHANGELOG.md 2016-01-25 14:42:31 -05:00
0c250f2b07 Use templated handler name during callback
Fixes #14082
2016-01-23 09:26:25 -05:00
a516f883ac convert winrm put_file script template to Unicode string literal
Fixes traceback on homedirs with non-ascii chars
2016-01-22 13:11:02 -08:00
95f7aa2b53 corrected submodule ref 2016-01-22 08:16:53 -05:00
da4a9d6da0 Fix bug with any_errors_fatal where task was not available 2016-01-21 16:41:05 -05:00
d18cc79873 add detect Altlinux distributive 2016-01-21 16:10:53 -05:00
2b3cd2577a Disallow setting state on template tasks
Fixes #14056
2016-01-21 15:37:31 -05:00
50bb0d08f1 Template the run_once value in the linear strategy as we use it there
This is pre-post_validation, so we have to template it on the fly
as we use it to determine if we bypass the host loop.

Fixes #11876
2016-01-21 15:37:25 -05:00
391420d88f Re-add cache clearing call to Inventory init
This prevents a bug where the existing cache outside of the class
is not cleared when creating a new Inventory object. This only really
affects people using the API directly right now, but wanted to fix it
to prevent weird errors from popping up.
2016-01-21 15:37:19 -05:00
4627b3efbb Standardize removal of BECOME-SUCCESS method and use it for async too
Fixes #13965
Fixes #13971
2016-01-21 15:37:10 -05:00
7d8794daa6 plugins/strategy: added significant details to parser error message.
See discussion at
https://github.com/ansible/ansible/issues/13753
2016-01-21 15:37:02 -05:00
2021362386 Fix incorrect handling of any_errors_fatal in the linear strategy
Instead of bombing out of the strategy, we now properly mark hosts failed
so that the play iterator can handle block rescue/always properly.

Fixes #14024
2016-01-21 15:36:27 -05:00
bb564075b5 Forward conditionals onto included plays when conditional eval errors
When using a playbook-level include, we now catch any errors raised during
the conditional evaluation step and set a flag to indicate we need to pass
those conditionals on to the included play (most likely because they contain
inventory variables for evaluation).

Fixes #14003
2016-01-21 15:36:06 -05:00
09b26b6373 Don't assign both parent blocks and task includes to blocks
This causes problems when fetching parent attributes, as the include
was being skipped because the parent block would fetch the attribute
from the parent play first.

Fixes #13872
2016-01-21 15:35:57 -05:00
8647fdc7f2 go back to defaulting wrapping commands in shell
this was taken out in an effort to default to the user's shell but creates issues as this is not known ahead of time
and its painful to set executable and shell_type for all servers, it should only be needed for those that restrict the user
to specific shells and when /bin/sh is not available. raw and command may still bypass this by explicitly passing None.
fixes #13882

still conditional
2016-01-21 15:35:49 -05:00
7fe0bfd4f9 Revert "Properly look for parent become attribute"
This reverts commit 1b46a422aa.
2016-01-21 15:35:35 -05:00
2b5caa23fb Properly look for parent become attribute
Corrects inheritence of the boolean value, which needs some special
consideration from other (string/int) values.

Fixes #13872
2016-01-21 15:35:16 -05:00
0d2a9d3f53 Relocate use of ERROR to display class, to avoid doubling up 2016-01-21 15:35:09 -05:00
34e3a8e6cb Catch INI section parsing misses and raise an appropriate error
Fixes #13917
2016-01-21 15:35:02 -05:00
1fc35117d3 Fix role hashing failure/traceback when params contain lists
Fixes #13857
2016-01-21 15:34:52 -05:00
fb81447581 Don't clear start at task flag until all hosts are advanced
Clearing the flag after the first host was advanced caused all other
hosts to not advance at all.

Fixes #13864
2016-01-21 15:34:23 -05:00
2dfcb218dc Fix with loop + delegate issues
* Don't re-use the existing connection if the remote_addr field of
  the play context has changed
* When overriding variables in PlayContext (from task/variables),
  don't set the same attribute based on a different variable name
  if we had already previously set it from another variable name

Fixes #13880
2016-01-21 15:33:44 -05:00
44ab6db535 Fix any_errors_fatal incorrect implementation in 2.0
Also adds that flag to blocks.

Fixes #13744
2016-01-21 15:32:33 -05:00
d9f03cf014 Update submodule refs to pull in doc fixes 2016-01-21 11:11:32 -08:00
c5e46efbd9 Avoid recursively checking JSON inventory for Unicode
by moving to en-bloc unicode conversion to act on scripts stdout

Both python-json and simplejson always return unicode strings when using
their loads() method on unicode strings. This is true at least since
2009. This makes checking each substring unnecessary, because we do not
need to recursively check the strings contained in the inventory dict
later one-by-one

This commit makes parsing of large dynamic inventory at least 2 seconds
faster.

cf: https://github.com/towolf/ansible-large-inventory-testcase
2016-01-21 08:43:52 -08:00
92579eb48f avoid shredding empty files, also x/0
also cleaned up unused import and exception var
2016-01-21 10:56:24 -05:00
d56e2fb80e corrected host/group match in inventory_hostnames
now the lookup works when using ! and & operators
fixes #13997
2016-01-20 18:33:00 -05:00
1f930f098f Update core submodule to bring in yum fix 2016-01-20 12:18:03 -08:00
63404821da rework run_command's env setting to not change os.environ for the rest of the module.
New param to run_command to modify the environment for just this invocation.
Documentation and comment adjustments.
2016-01-20 12:17:14 -08:00
cf75521bc8 updated submodule refs 2016-01-20 15:02:04 -05:00
50d34f90e7 clarified with_file 2016-01-19 21:20:54 -05:00
089f17bfc8 Don't tracback trying to retore settings
Can occur if we exit the timeout before the settings were changed
2016-01-19 14:11:16 -08:00
27bf701260 Set decoding of path to unicode to raise an exception if non-utf8
Letting it pass would just cause an error later on (no such file found)
so it's better to catch it here and know that we have users dealing with
non-utf8 pathnames than to have to track it down from later on.
2016-01-19 05:50:46 -08:00
299e42bc28 Make all parts of messages and pathnames into unicode so that we don't get UnicodeError tracebacks.
Note that the fix for display normalizing to unicode is correct but the
fix for pathnames is probably not.  Changing pathnames to unicode type
means that we will handle utf8 pathnames fine but pathnames can be any
sequence of bytes that do not contain null.  We do not handle sequences
of bytes that are not valid utf8 here.  To do that we need to revamp the
handling of basedir and paths to transform to bytes instead of unicode.
Didn't want to do that in 2.0.x as it will potentially introduce other
bugs as we find all the places that we combine basedir with other path
elements.  Since no one has raised that as an issue thus far so it's not
something we need to handle yet.  But it's something to keep in mind for
the future.

To test utf8 handling, create a utf8 directory and run a playbook from
within there.

To test non-utf8 handling (currently doesn't work as stated above), create
a directory with non-utf8 chars an run a playbook from there.  In bash,
create that directory like this: mkdir $'\377'

Fixes #13937
2016-01-19 05:45:56 -08:00
2f40903397 clarify role include paths 2016-01-19 08:48:55 -05:00
2ec31c2c79 fixed exception handling to be 2.4 compatible
previous 'fix' broke on 2.4
2016-01-19 08:33:37 -05:00
7afd8e9640 added missed ec2_vpc_net_facts 2016-01-18 22:06:05 -05:00
93781e0b05 be consistent about conversion to_str 2016-01-18 21:56:09 -05:00
edff4a9219 updated submodule refs 2016-01-18 21:15:30 -05:00
69b8a48ed1 Turn results that come from traceback messages into unicode, not str.
Fixes #13964
Fixes #13967
2016-01-18 14:44:57 -08:00
8f45660398 Update submodule refs 2016-01-18 13:59:46 -08:00
c8ffe94bf4 Fix proposed by @Yannig to fix become success detection when the output is multiline
See the Bug report for a specific error case with local connection,
sudo, and the raw module

Fixes #13728
2016-01-18 13:52:23 -08:00
c06b2e4622 correctly deals with non serializable type
combine_vars shoudl really be data types, but some just get in
in test, add dict to mock and avoid combine_vars using object
2016-01-18 15:18:18 -05:00
1394cdf6b9 Fix set_fact + run_once to assign variables to all hosts in the list
Fixes #13921
2016-01-18 11:55:39 -08:00
38a272b004 Allow module args as k=v pairs when using the module: option with local_action
This task format is valid in 1.x, but was broken in 2.x:
  - local_action:
     module: shell echo "hello world"
2016-01-18 11:55:30 -08:00
97a5804a2c Minor cleanup when reassigning play context to reused connections
* Relocate the assignment of the host address to the remote_addr field
  in the play context, which was only done when the connection was created
  (it's now done after the post_validate() is called on the play context)
* Make the assignment of the play context to the connection an else, since
  it's not required if the connection is not reused
2016-01-18 11:55:21 -08:00
8436a88b5d Fixes #13763 Update connections _play_context on every iteration
If this isnt updated, the _connection is reused, and thus has an outdated _play_context
This results in outdated `success_key` and `prompt` causing issues if sudo is run in a loop
Refer to the issue #13763 for more debugging and details
2016-01-18 11:55:12 -08:00
0bf20fab84 Fix erroneous fetch fail when fail_on_missing is set to False
Fixes #13832
2016-01-15 16:29:04 -08:00
22272fe5b8 Fix typos. 2016-01-15 15:10:44 -05:00
7d8afbd83d fix issue with add_hosts overwriting existing vars
fixes github.com/ansible/ansible-modules-core/issues/2799 and is alternative to #13841
2016-01-15 14:27:15 -05:00
f11e54bcff update core submodule ref 2016-01-15 09:36:08 -08:00
46a3a6a03e Non-newstyle modules can't use pipelining
This is because we pass arguments to non-newstyle modules via an
external file.  If we pipeline, then the interpreter thinks it has to
run the arguments as the script instead of what is piped in via stdin.
2016-01-14 17:24:25 -08:00
e29ae99b50 overwrite/merge not remove prev inventory data 2016-01-14 18:42:10 -05:00
363b74e498 Allow Ansible to return error with unicode within it.
Fix for https://github.com/ansible/ansible/issues/13899
2016-01-14 15:07:19 -08:00
17b60f4fbf Fix typo in 0b86aa6 2016-01-14 16:49:46 -05:00
b89f211ed4 Hack to work around callback API change for v2_playbook_on_start 2016-01-14 16:49:46 -05:00
cde5d8444d When setting fail state skip RESCUE/ALWAYS if cur_block doesn't have them
Fixes #13749
2016-01-14 15:59:40 -05:00
6cf0386a52 Tweak how strategies evaluate failed hosts via the iterator and bug fixes
* Added additional methods to the iterator code to assess host failures
  while also taking into account the block rescue/always states
* Fixed bugs in the free strategy, where results were not always being
  processed after being collected
* Added some prettier printing to the state output from iterator

Fixes #13699
2016-01-14 15:59:40 -05:00
b09f756195 now combine vars errors dump vars
very hard to debug w/o knowing what vars were being merged at the time of the error
2016-01-14 11:00:54 -05:00
27f9b9dc43 md5 now uses smaller salt
fixes #13891
2016-01-14 11:00:34 -05:00
31a951c4f7 only send event if tqm exists
fixes #13843
2016-01-14 11:00:18 -05:00
fe55e87ab4 Prevent traceback.
https://github.com/ansible/ansible/issues/13743#issuecomment-171520585

In some circumstance, the file fails to open.  When that occurs, we
can't try to close it in the finally clause.  Using a context manager is
the cleanest way to change the code to account for that case.
2016-01-13 20:52:22 -08:00
2ed31fc818 Add python-setuptools to the requirements for running ansible as
python-setuptools contains the egginfo needed to make pkg_resources
work.
2016-01-13 17:22:43 -08:00
be087575cc Fix circular import 2016-01-13 14:05:24 -08:00
79931041e2 do_encrypt import needed to move as well
Fixes #13861
2016-01-13 13:09:19 -08:00
832a739331 use integer division instead of floating point division.
Fixes #13855
2016-01-13 12:35:44 -08:00
b83ef89f09 Add windows/unix newline change to the changelog 2016-01-13 08:49:48 -08:00
419bd389d8 move core submodule ref for win_msi fix 2016-01-12 09:38:34 -08:00
e497e2b5c0 made loading of galaxy data files lazy 2016-01-12 12:28:47 -05:00
16ae952888 re-adding the dummy debian changlog entry for packaging 2016-01-12 12:20:23 -05:00
954eba8605 added galaxy data
not tested, but something like this seems to be missing in the Manifest.in
2016-01-12 11:31:54 -05:00
e4b701c00a added module name to missing interpreter error
fixes #13816
2016-01-12 11:26:18 -05:00
21c22a2416 Allow InventoryScript JSON with childgroups only
and without hosts and vars

Without this patch, the simplified syntax is triggered when a group
is defined like this:

    "platforms": {
        "children": [
            "cloudstack"
        ]
    }

Which results in a group 'platforms' with 1 host 'platforms'.

more details in https://github.com/ansible/ansible/issues/13655
2016-01-12 11:26:11 -05:00
4e98cc351c Update submodule refs so that new integration tests will pass 2016-01-12 08:02:47 -08:00
f53cb5f63e Integration tests for https://github.com/ansible/ansible-modules-core/pull/558 2016-01-12 08:02:05 -08:00
1cae019c79 cloudstack: fix case insensitivity
cloudstack: fix has_change reports changed for case insensitivity values
2016-01-12 08:02:05 -08:00
f3470c1062 cleaner implementation and random chunk length. 2016-01-12 08:02:05 -08:00
21a4c1380c use unix shred if possible, otherwise fast custom impl; do not shred encrypted file 2016-01-12 08:02:05 -08:00
4811504a6e add docs, remove unnecessary int() cast 2016-01-12 08:02:05 -08:00
08fee9bfc5 add os.fsync() so that the shredding data (hopefully) hits the drive 2016-01-12 08:02:05 -08:00
2cb2994371 shred ansible-vault tmp_file. Also when editor is interruped. 2016-01-12 08:02:05 -08:00
2eb59bedcf New release v2.0.0.0-1 2016-01-12 08:43:33 -05:00
14bf6b016c Split up comma-separated tags properly
Fixes #13795
2016-01-12 08:18:37 -05:00
28fecc9ce1 bugfix in nxos shared module for including defaults 2016-01-11 22:49:01 -05:00
2c647f18e5 bugfix in ios shared module for including defaults 2016-01-11 22:48:54 -05:00
4e087bb14f bugfix in eos shared module for including defaults 2016-01-11 22:48:43 -05:00
1f7fbf29f9 updated new windows module list in changelog 2016-01-11 16:24:30 -08:00
0681c2fd8f deletes nxapi from shared modules
The nxapi module has been superseded by the nxos shared module and is not longer needed. This commit removes (deletes) nxapi from module_utils.  All custom modules that have used nxapi should be using nxos instead.
2016-01-10 15:13:18 -05:00
4a6235e320 adds network config file parser to shared modules
This commit adds a new shared module that parses network device configuration
files.  It is used to build modules that work with the various supported
network device operating systems
2016-01-10 15:12:45 -05:00
94f13c7271 adds shared module shell for creating cli based transports
This commit add a new shared module shell that is used to build connections
to network devices that operate in a CLI environment.  This commit supercedes
the issh.py and cli.py commits and removes them from module_utils.
2016-01-10 15:12:29 -05:00
93eb60161c initial add of openswitch shared module
This commit adds a new shared module openswitch for building modules that
work with OpenSwitch.  This shared module supports connectivity to
OpenSwitch devices over SSH, CLI or REST.  It also adds an openswitch
documentation fragment for use in modules
2016-01-10 15:12:15 -05:00
2f1fc85002 adds shared module nxos for building cisco nxos modules
This commit refactors the nxapi into a new shared module nxos that supports
connectivity over both ssh (cli) and nxapi.  It supercedes the nxapi shared
module and removes it from module_utils.  This commit also adds a
documentation fragement supporting the nxos shared module
2016-01-10 15:12:05 -05:00
91f35363a2 adds new iosxr shared module for developing modules that work with IOS XR devices
This commit adds a new shared module for working with Cisco IOS XR devices over
CLI (SSH).  It also provides a documentation fragement for the commmon arguments
provided by the iosxr module.
2016-01-10 15:11:55 -05:00
f76633b347 updates the ios shared module with new shell
This update refactor the ios shared module to use the new shell shared
library instead of issh and cli.  It also adds the ios documentation
fragment to be used when building ios based modules.
2016-01-10 15:11:37 -05:00
9c9bfb962e initial add of eos shared module
This adds a shared module for communicating with Arista EOS devices over
SSH (cli) or JSON-RPC (eapi).  This modules replaces the eapi.py module
previously added to module_utils.  This commit includes a documentation
fragment that describes the eos common arguments
2016-01-10 15:11:08 -05:00
0e27fa4540 restructure vars_prompt and fix regression
pushed it to use the existing propmpt from display and moved the vars prompt code there also for uniformity
changed vars_prompt to check extra vars vs the empty play.vars to restore 1.9 behaviour
sipmlified the code as it didn't need to check for syntax again (tqm is made none prior based on that)
fixes #13770
2016-01-08 17:56:13 -05:00
3a972c9170 Restore ability for a module to specify WANT_JSON 2016-01-08 12:49:08 -05:00
91c7691a92 noted that regex_escape was added in 2.0
fixes #13759
2016-01-07 19:02:08 -05:00
502ad88506 New release v2.0.0-0.9.rc4 2016-01-07 13:41:47 -05:00
80f0380312 Fix typo 2016-01-07 06:01:44 -08:00
a8f160d2fd More fixes for unicode handling in the connection plugins.
Tested that ssh, docker, local, lxc-libvirt, chroot all work with the
updated unicode integration test.
2016-01-07 06:01:34 -08:00
6be48dd14c Revert "Show version without supplying a dummy action"
This reverts commit 21775d7866.
Parsing before action will fail if one of the action specific options is used
As per issue #13743
2016-01-07 08:29:43 -05:00
fcd074d40f Merge branch 'ktosiek-fix-playbook-hanging' into stable-2.0 2016-01-06 14:01:35 -05:00
21775d7866 Show version without supplying a dummy action
fixes #12004
parsing x2 does not seem to break anything
2016-01-06 11:54:19 -05:00
ab536c8aa8 Strip string terms before templating
The earlier code did call terms.strip(), but ignored the return value
instead of passing that in to templar.template(). Clearly an oversight.
2016-01-06 11:25:55 -05:00
93f37f5969 Don't drop noops from task counting code in linear strategy 2016-01-06 09:58:20 -05:00
ec3b7b7de8 linear strategy: don't look at tasks from the next block 2016-01-05 21:49:08 +01:00
7a4914aa9b Fix exception catching to be importable on python3 2016-01-05 12:04:22 -08:00
9ca5da82ff move hostvars.vars to vars
this fixes duplication under hostvars and exposes all vars in the vars dict
which makes dynamic reference possible on 'non hostvars'
2016-01-05 14:36:21 -05:00
3d608ef9fa simplified diff handling in callback
no need for the copy or other complexity
2016-01-05 14:27:33 -05:00
c14e099dd7 now handles 'non file diffs'
this allows modules to pass back a 'diff' dict and it will still show using the file interface
2016-01-05 14:27:33 -05:00
7e318e8398 Update extras submodule ref 2016-01-05 07:52:44 -08:00
add2e9cbd1 Fix problems with non-ascii values passed as part of the command to connection plugins
@drybjed discovered this with non-ascii environment variables and
command line arguments to script and raw module.
2016-01-05 07:46:24 -08:00
9f93c9c84b Clean up debug logging around _low_level_execute_command
We were logging the command to be executed many times, which made debug
logs very hard to read. Now we do it only once.

Also makes the logged ssh command line cut-and-paste-able (the lack of
which has confused a number of people by now; the problem being that we
pass the command as a single argument to execve(), so it doesn't need an
extra level of quoting as it does when you try to run it by hand).
2016-01-05 07:46:13 -08:00
b4e0b5503c move core submodule pointer 2016-01-04 16:10:29 -08:00
5536ddd118 Do not set 'changed' to True when using group_by
Since group_by is not changing in any way to the remote
system, there is no change. This also make things more consistent
with the set_fact plugin.
2016-01-04 16:23:25 -05:00
021ed1aa8b Replace to_string by to_unicode.
Fix https://github.com/ansible/ansible/issues/13707
2016-01-01 08:18:18 -08:00
a703f3a6d2 added newer vars to 'reset_vars'
these vars pass back info to the task about the connection
moved to their own block at start at file for readability and
added the newer standard vars
2015-12-28 12:50:04 -05:00
f7ea8b32a9 minor fix to become docs 2015-12-28 10:25:35 -05:00
ba7d2db8ad clarify idempotence explanation
Small typo; wasn't sure what to replace it with.
2015-12-28 10:24:55 -05:00
b50ed10a84 updated release cycle to 4 months instead of 2 2015-12-27 14:17:58 -05:00
b4fae25a96 CHANGELOG entry for bigip* validate_certs change 2015-12-25 12:24:19 -08:00
6142736946 Oops, core needs to stay on stable-2.0 2015-12-25 12:16:18 -08:00
25fc4217df Update submodule refs 2015-12-25 12:15:49 -08:00
d71e8fb870 bigip changes as requested by bcoca and abadger:
* Fix to error if validate_cert is True and python doesn't support it.
* Only globally disable certificate checking if really needed.  Use
  bigip verify parameter if available instead.
* Remove public disable certificate function to make it less likely
  people will attempt to reuse that
2015-12-25 12:15:24 -08:00
369ed9feed cloudstack: test_cs_instance: more integration tests
cloudstack: extend test_cs_instance addressing recovering

cloudstack: test_cs_instance: add tests for using display_name as indentifier.
2015-12-23 17:48:49 -08:00
ebd3b35d02 Update submodule refs 2015-12-23 14:29:36 -08:00
82df9041e7 Going to do this in the connection plugin
Revert "Transform the command we pass to subprocess into a byte string in _low_level-exec_command"

This reverts commit 6d76cb40c5.
2015-12-23 13:28:42 -08:00
dd59fc176e Going to do this in the connection plugin
Revert "Fix make tests-py3 on devel. Fix for https://github.com/ansible/ansible/issues/13638."

This reverts commit 725e40c5e6.
2015-12-23 13:28:42 -08:00
9af054addf Going to do this in the connection plugin
Revert "Convert to bytes later so that make_become_command can jsut operate on text type."

This reverts commit bfc082fb07.
2015-12-23 13:28:42 -08:00
7f29cb9dc6 corrected role path search order
the unfraking was matching roles in current dir as it always returns a full path,
pushed to the bottom as match of last resort
fixes #13645
2015-12-23 15:15:58 -05:00
2786908bac fixed tests to follow new invocation structure
also added maxdiff setting to see issues clearly when they happen
2015-12-23 11:45:50 -05:00
43331d8c31 better module error handling
* now module errors clearly state msg=MODULE FAILURE
* module's stdout and stderr go into module_stdout and module_stderr keys
which only appear during parsing failure
* invocation module_args are deleted from results provided by action
plugin as errors can keep us from overwriting and then disclosing info that
was meant to be kept hidden due to no_log
* fixed invocation module_args set by basic.py as it was creating different
keys as the invocation in action plugin base.
* results now merge
2015-12-23 10:59:01 -05:00
579a2ff739 fix no_log disclosure when using aliases 2015-12-22 17:17:06 -05:00
bfc082fb07 Convert to bytes later so that make_become_command can jsut operate on text type.
Conflicts:
	lib/ansible/plugins/action/__init__.py
2015-12-22 08:33:36 -08:00
725e40c5e6 Fix make tests-py3 on devel. Fix for https://github.com/ansible/ansible/issues/13638. 2015-12-22 08:33:36 -08:00
8216a659fa Also convert ints to bool for type=bool 2015-12-22 10:25:25 -05:00
a2120a3d63 Version bump for 2.0.0-0.8.rc3 2015-12-21 17:59:27 -05:00
6d76cb40c5 Transform the command we pass to subprocess into a byte string in _low_level-exec_command 2015-12-21 13:55:06 -08:00
b0e7ea78af Actually disable parallel makes for integration runner 2015-12-21 16:12:27 -05:00
6a0d2116b8 Delete new_inventory from stable-2.0 as it isn't used there.
leaving in devel for now as some people are planning on using it as
a starting place to update inventory in 2.1
2015-12-21 13:11:16 -08:00
37908735d4 Dropping instance size back down since we're not doing parallel builds 2015-12-21 15:55:16 -05:00
c0248873da Integration test runner tweaks 2015-12-21 15:53:19 -05:00
75695f5c70 Kick up the integration runner test image size 2015-12-21 15:53:19 -05:00
0a6bc57fa5 Parallelize make command for integration test runner
Also adds a new var, used by the prepare_tests role, to prevent it from
deleting the temp test directory at the start of each play to avoid any
potential race conditions
2015-12-21 14:09:02 -05:00
1d18964daa Merge role params into variables separately from other variables
Fixes #13617
2015-12-21 13:55:17 -05:00
8eb3963cd9 Adding documentation for the 'dig' lookup (#13126). 2015-12-21 13:49:49 -05:00
c605cd37f6 allow for non standard hostnames
* Changed parse_addresses to throw exceptions instead of passing None
* Switched callers to trap and pass through the original values.
* Added very verbose notice
* Look at deprecating this and possibly validate at plugin instead
fixes #13608
2015-12-21 13:42:47 -05:00
e1698fb4bf role search path clarified 2015-12-21 13:16:48 -05:00
81f09f3fbd Disable docker test for Fedora, due to broken packaging 2015-12-21 10:58:49 -05:00
b77d834239 Uncomment docker test for stable-2.0 2015-12-21 10:58:35 -05:00
7607e55a5a Save output of integration test results to files we can archive 2015-12-21 10:58:02 -05:00
d512717cd2 Fix logic in PlayIterator when inserting tasks during rescue/always
Because the fail_state is potentially non-zero in these block sections,
the prior logic led to included tasks not being inserted at all.

Related issue: #13605
2015-12-21 10:57:24 -05:00
ce17557b84 Fixed import typo for memcache module in tests.
The typo caused the test for the memcached cache plugin to be skipped
even when the necessary memcache python module was installed.
2015-12-21 10:27:36 -05:00
80e109e1ad And change the task a little more since different shlex versions are handling the quotes differently 2015-12-20 11:52:50 -08:00
fdc562e3c3 Fix test playbook syntax 2015-12-20 11:47:17 -08:00
1dcfd7ba02 Since the velox test server seems to be dropping using iptables to drop requests from aws, test via a different website instead 2015-12-20 11:38:54 -08:00
9cfa2d7e28 Fixing bugs in conditional testing with until and some integration runner tweaks 2015-12-20 12:45:33 -05:00
5bd01c09d6 Troubleshooting has reduced us to this 2015-12-20 12:45:28 -05:00
61bd0e1310 Fix the fedora host detection 2015-12-20 12:45:09 -05:00
bb1047c483 What is going on here 2015-12-20 12:45:03 -05:00
c2a29a01a2 Removing update all for test deps, it didn't fix the problem 2015-12-20 12:44:20 -05:00
6a1ebaa1bc Fix typo in integration test runner role 2015-12-20 12:44:10 -05:00
1d1a04008e Update mysql setup to handle installing mysql with dnf too. 2015-12-20 12:43:47 -05:00
1cde02058f Make integration tests run in parallel with async 2015-12-20 12:41:53 -05:00
48675550bf Try updating the centos7 image to a newer version (trying to resolve issue being unable to connect to some webservers) 2015-12-20 09:13:03 -08:00
3955ea5a8a Fixes for tests that assumed yum as package manager for systems that
have dnf
2015-12-20 08:11:05 -08:00
454c8ff5b8 Switch from yum to package when installing sudo so that dnf is handled as well 2015-12-20 08:10:58 -08:00
ba0b4afb6b Revert "removed invocation info as it is not no_log aware"
This reverts commit 6127a8585e.
2015-12-19 15:51:29 -08:00
76507bd567 Make return invocation information so that our sanitized copy will take precedence over what the executor knows. 2015-12-19 15:51:22 -08:00
d2bf615780 Fix unittests for return of invocation from fail_json and exit_json 2015-12-19 15:50:43 -08:00
3840fb267c corrected service detection in docker versions
now if 1 == bash it falls back into tool detection
2015-12-19 16:16:28 -05:00
fbccfc8b61 Add package module to squash list 2015-12-19 13:01:48 -08:00
2d179b376b Remove args from get_name() as we can't tell if any of the args are no_log 2015-12-19 11:51:51 -08:00
a0add9dda5 Comment to explain why we strip _ansible_notify specially 2015-12-19 11:32:31 -08:00
de9517dcc8 Also need redhat-rpm-config to compile pycrypto 2015-12-19 11:27:55 -08:00
bef2b70eae Make sure that yum is present on redhat family systems (makes things also work on fedora systems where dnf is the default) 2015-12-19 11:24:27 -08:00
df08ba37fe removed invocation info as it is not no_log aware
This was added in 1.9 and 2.0 tried to copy, but since it cannot
obey no_log restrictions I commented it out. I did not remove as
it is still very useful for module invocation debugging.
2015-12-19 11:45:59 -05:00
6dc42e376f update submodule refs 2015-12-18 22:18:25 -08:00
9689f00bb1 Add a Fedora latest host into the mix 2015-12-18 22:15:29 -08:00
2f0e8d9654 Make integration runner ec2 add_hosts use valid host names 2015-12-18 16:04:54 -08:00
6d9235e36d Fix the fedora host detection 2015-12-18 15:43:39 -08:00
eb606cc18b What is going on here 2015-12-18 15:43:32 -08:00
85ef768d51 Bugfix the fedora 23 install task 2015-12-18 14:39:27 -08:00
457e32128f Ubuntu images with hvm ssd 2015-12-18 14:39:20 -08:00
e8ce341f9c Fedora 23 needs to have python2 packages installed 2015-12-18 14:08:43 -08:00
87214005d2 Make tests that use kennethreitz retry. 2015-12-18 11:51:16 -08:00
dc0a4e74d6 added note about add_hosts 2015-12-18 13:57:58 -05:00
43409fa16c added missing features to changelog 2015-12-18 12:15:08 -05:00
b912923ef2 Do a full yum update to make sure packages are latest version
For the deps setup of integration tests, as we sometimes see odd
errors we can't reproduce, which may be related to slightly out of
date package dependencies.
2015-12-18 08:51:57 -08:00
46bc8253e1 Add awk to integration test deps list 2015-12-18 08:51:42 -08:00
1f70fc6424 Add state=latest to pip install of pycrypto 2015-12-18 08:51:34 -08:00
ed4ad5f6fb Add ca-certificates update to the integration deps playbook 2015-12-18 08:51:25 -08:00
69eb22c652 Install an updated version of pycrypto on Ubuntu12 from pip 2015-12-18 08:51:14 -08:00
dca880d04a kennetreitz.org times out but www.kennethreitz.org is fine 2015-12-18 08:34:07 -08:00
0c6364c771 debug line needs var not msg 2015-12-18 08:33:55 -08:00
c9cf07e3b5 Fixing bugs with {changed,failed}_when and until with registered vars
* Saving of the registered variable was occuring after the tests for
  changed/failed_when.
* Each of the above fields and until were being post_validated too early,
  so variables which were not defined at that time were causing task
  failures.

Fixes #13591
2015-12-18 11:08:06 -05:00
bcd66059ae Use --source instead of -e for awk in integration Makefile 2015-12-17 20:53:43 -05:00
72e6dbcd12 Fix get_url tests in light of distros backporting SNI support 2015-12-17 17:53:38 -08:00
184c2985fc Consolidating package lines for virtualenv install in test deps integration 2015-12-17 17:46:12 -05:00
4abbe8a989 Moving apt cache update to top to ensure cache is updated before deps installed 2015-12-17 17:46:12 -05:00
ce159ce2eb Switch virtualenv dep installation from pip to package manager 2015-12-17 17:46:12 -05:00
fdb94b9a7a Adding pip install of virtualenv to test deps integration role 2015-12-17 17:45:59 -05:00
be0e826091 remove .gitignore 2015-12-17 14:18:12 -08:00
f12ed5eba8 symbolic link role for testing 2015-12-17 14:18:06 -08:00
b1d5e9ff3c removed ansible_python_interpreter
* added missed renames of ansible_deps to ansible_test_deps
* removed acidential inventory.dynamic file
* modified README for ansible_test_deps role
2015-12-17 14:17:58 -08:00
dcb732b416 rename role ansible_deps to ansible_test_deps 2015-12-17 14:17:49 -08:00
ad6ec9610e playbook that Ansible jenkins runs moved into core
The playbook is already running in jenkins and works. This moves the
assets into core for ease of maintenance going forward.
2015-12-17 14:17:41 -08:00
fcceac5ff2 trigger jenkins integration tests 2015-12-17 14:17:35 -08:00
0a319a28f2 Update submodule for mysql_user fix 2015-12-17 13:47:07 -08:00
17fe156016 Fixing a mistake from tweaking list stuff too much
Use the action only if the task name is not set
2015-12-17 16:34:03 -05:00
5824a6d9bb Further tweaks to the output format of list tasks/tags 2015-12-17 16:31:02 -05:00
59cac03d3b Make --list-tasks respect tags
Also makes the output closer to the appearance of v1

Fixes #13260
2015-12-17 16:11:00 -05:00
cc2e0c1e3d Update submodule to pull in mysqldump fix 2015-12-17 13:02:11 -08:00
624556eb16 Add recent bugfixes to changelog 2015-12-17 10:35:24 -08:00
64737c80f9 Update submodule refs 2015-12-17 10:21:50 -08:00
5e9d182229 changed test to use filter for accurate reporting 2015-12-17 12:28:17 -05:00
1f7ed5d8ee Fix handling of environment inheritence, and template each inherited env
Environments were not being templated individually, so a variable environment
value was causing the exception regarding dicts to be hit. Also, environments
as inherited were coming through with the tasks listed first, followed by the
parents, so they were being merged backwards. Reversing the list of environments
fixed this.
2015-12-17 09:46:41 -05:00
f41dd578b3 Make sure we're using the original host when processing include results
Also fixes a bug where we were passing an incorrect number of parameters to
_do_handler_run() when processing an include file in a handler task/block.

Fixes #13560
2015-12-16 19:13:03 -05:00
407d76b8d5 Fixing template integration test for python 2.6 versions
No longer immediately fallback to to_json if simplejson is not installed
2015-12-16 18:24:12 -05:00
d2c43c421f Update core module ref for mysql_user fix 2015-12-16 14:10:00 -08:00
6c509b5364 Updating the porting guide to note the complex args/bare vars change
Related to #13518
2015-12-16 16:37:55 -05:00
4bce9947e5 fixed formating issues with rst 2015-12-16 16:37:55 -05:00
4ad7135690 Add first draft of porting guide for 2.0 2015-12-16 16:37:55 -05:00
bf9f6ce09c All variables in complex args again
Also updates the CHANGELOG to note the slight change, where bare variables
in args are no longer allowed to be bare variables

Fixes #13518
2015-12-16 16:37:55 -05:00
84a6b543a9 ensure additional args are a dict
They should already be templated before hitting this point?
otherwise the class needs the task variables passed into it.
relates to #13518 and  https://groups.google.com/forum/#!msg/ansible-project/esoBcphHwHs/Ghgi_M-MCQAJ
2015-12-16 15:32:26 -05:00
6cf7b792a3 Fix docs. The search command works with both galaxy.ansible.com and galaxy-qa.ansible.com. 2015-12-16 15:11:45 -05:00
abec9331d8 Fixed documentation typos and bits that needed clarification. Fixed missing spaces in VALID_ACTIONS. 2015-12-16 15:11:41 -05:00
ba16f2ae95 Add a section to intro_configuration for Galaxy. 2015-12-16 15:11:34 -05:00
1e605d727c Define and handle ignore_certs correctly. Preserve search term order. Tweak to Galaxy docsite. 2015-12-16 15:11:30 -05:00
6c48d52b4a Make sure it is clear that new commands require using the Galaxy 2.0 Beta site. 2015-12-16 15:11:26 -05:00
8bb598daa2 Updated ansible-galaxy man page. Removed -b option for import. 2015-12-16 15:11:22 -05:00
21edd6a5ab Fix overloaded options. Show an error when no action given. Don't show a helpful list of commands and descriptions. 2015-12-16 15:11:05 -05:00
e10e03f4d9 added releases doc 2015-12-16 15:10:48 -05:00
d5bdea0bab fix plugin loading for Windows modules
force plugin loader to only consider .py files, since that's the only place docs can live ATM...
2015-12-16 11:47:52 -08:00
cd1bdaa61d Update submodule refs for mysql refactor 2015-12-16 11:14:39 -08:00
9f69b6b585 Add shared connection code for mysql modules 2015-12-16 11:06:21 -08:00
9e52a7c769 Attempt at fixing strategy unit test failures on py2.6 and py3 2015-12-16 13:57:13 -05:00
8fd438000a Update url to site that has an invalid certificate 2015-12-16 09:47:56 -08:00
54ce8327cb Disabling docker test for stable-2.0 due to versioning issues 2015-12-16 11:24:29 -05:00
82519ab2a6 Preserve the cumulative path for checking includes which have parents
Otherwise, each relative include path is checked on its own, rather
than in relation to the (possibly relative) path of its parent, meaning
includes multiple level deep may fail to find the correct (or any) file.

Fixes #13472
2015-12-16 11:23:33 -05:00
5761c333a6 Update submodule ref to fix docs build 2015-12-16 08:13:54 -08:00
72b852a814 Update submodule refs 2015-12-16 08:03:34 -08:00
897569c1ca Conditionally create the CustomHTTPSConnection class only if we have the required baseclasses.
Fixes #11918
2015-12-16 08:02:11 -08:00
8e2cb2abb2 Fixes for proxy on RHEL5 2015-12-16 08:02:03 -08:00
b8d9b106de First attempt to fix https certificate errors through a proxy with python-2.7.9+
Fixes #12549
2015-12-16 08:01:56 -08:00
f68c0043de Fix typo 2015-12-16 10:53:10 -05:00
48fb0cdecb debug now validates its params
simplified var handling
made default message the same as in pre 2.0
fixes #13532
2015-12-16 10:42:30 -05:00
28602cddb0 Use the original host rather than the serialized one when processing results
Fixes #13526
Fixes #13564
Fixes #13566
2015-12-16 01:50:14 -05:00
5011d63f7e Fix a part of python 3 tests (make tests-py3, see https://github.com/ansible/ansible/issues/13553 for more details). 2015-12-15 07:57:05 -08:00
5ab25e2dfe clean debug output to match prev versions 2015-12-15 09:28:39 -05:00
6e1bb6c87d renamed ssh.py shared module file to clarify 2015-12-15 08:44:43 -05:00
ac7dc6bd81 the ssh shared module will try to use keys if the password is not supplied
The current ssh shared module forces only password based authentication.  This
change will allow the ssh module to use keys if a password is not provided.
2015-12-15 08:39:17 -05:00
b6dac26224 Make module_utils.known_hosts.get_fqdn work on ipv6 2015-12-14 11:10:02 -08:00
a7a3a34987 Add tests for ansible.module_utils.known_hosts 2015-12-14 11:09:49 -08:00
6df187da84 Fix for template module not creating a file that was not present when force=false 2015-12-14 10:57:34 -08:00
cf95619229 Optionally only use UUIDs for openstack hosts on duplicates
The OpenStack inventory lists hostnames as the UUIDs because hostsnames
are not guarnateed to be unique on OpenStack. However, for the common
case, this is just confusing.

The new behavior is a visible change, so make it an opt-in via config.

Only turn the hostnames to UUIDs if there are duplicate hostnames.
2015-12-14 13:27:33 -05:00
17a37844d4 Fix the refresh flag in openstack inventory
Refresh will update the dogpile cache from shade, but doesn't cause
the ansible side json cache to be invalidated. It's a simple oversight.
2015-12-14 13:27:33 -05:00
gp
0697c6e59d Fix typo in galaxy.rst
Fix typo
2015-12-14 09:15:15 -08:00
66be9d06c4 Minor: Correct type pyhton => python 2015-12-14 08:51:33 -08:00
62b2c9eb4e Update submodule refs 2015-12-14 08:34:49 -08:00
887319f95c add tests for encrypted hash mysql_user 2015-12-14 08:02:11 -08:00
fc233bf3f4 Use an octal representation that works from 2.4->3+ for known_hosts 2015-12-14 10:44:22 -05:00
8dcba63022 Fixing up some non-py3 things for unit tests 2015-12-14 10:44:22 -05:00
60f5fe76a1 use default settings from ansible.cfg 2015-12-14 09:19:15 -05:00
0b66ec0ddd Cleanup strategy tests broken by new forking strategy 2015-12-14 03:07:51 -05:00
e7bf204db4 A few tweaks to improve new forking code 2015-12-14 03:07:48 -05:00
c8e6461dee Changing the way workers are forked 2015-12-14 01:16:55 -05:00
3214ef8832 added that ansible-pull is now shallow to changelog 2015-12-13 12:18:28 -05:00
6a5444c2fe add --full flag to ansible-pull man page
add --full flag that was added in #13502
2015-12-13 12:17:36 -05:00
d4e06695fd Fix Doc mistake
Fix Doc mistake in ansible/docsite/rst/playbooks_variables.rst
2015-12-13 09:50:45 -05:00
d369e3ec72 fix whitespace 2015-12-13 09:37:48 -05:00
bff8db3c8f make shallow clone the default for ansibel-pull 2015-12-13 09:37:48 -05:00
8c6010cc86 add depth option to ansible-pull
Allows shallow checkouts in ansible-pull by adding `--depth 1` (or higher number)
2015-12-13 09:37:48 -05:00
13ffd3ee2d include all packaging in tarball
not juse rpm spec file
2015-12-13 00:34:56 -05:00
f9bff8e488 simplified skippy
thanks agaffney!
2015-12-12 17:51:25 -05:00
6d83bf8ca9 changed shell delimiters for csh
fixes #13459
2015-12-12 16:13:20 -05:00
17f06dd310 removed unused imports in galaxy/cli 2015-12-12 13:43:46 -05:00
82f893d65a Explain how 'run_once' interacts with 'serial' 2015-12-12 00:33:21 -05:00
40b55eda4c avoid set to unique hosts to preserver order
swiched to using a list comp and set to still unique but keep expected order
fixes #13522
2015-12-11 15:40:48 -05:00
7678ab05d8 removed merge conflict 2015-12-11 15:10:48 -05:00
5b801afa38 Don't mark hosts failed if they've moved to a rescue portion of a block
Fixes #13521
2015-12-11 14:58:38 -05:00
71cc791677 narrow down exception catching in block builds
this was obscuring other errors and should have always been narrow scope
2015-12-11 13:13:19 -05:00
3d1b3e2bb8 removed 'bare' example in environment
now shows how to use explicit templating
2015-12-11 09:35:19 -05:00
b0e5556d9a fix make complaint when git is not installed 2015-12-10 21:50:11 -05:00
75e6fb30d5 Fixing up docker integration tests a bit 2015-12-10 13:10:40 -05:00
9b5ec8f359 Update submodule ref 2015-12-10 08:10:13 -08:00
2dbcd8fc9e become_pass needs to be bytes when it is passed to ssh.
Fixes #13240
2015-12-10 07:30:20 -08:00
82789df231 allow custom callbacks with adhoc cli for scripting
missing import of CallbackBase
2015-12-10 07:05:41 -08:00
3fafc6d655 Missed one place we were appending the incorrectly escaped item to raw params 2015-12-09 17:59:06 -05:00
9b864811f8 Note that handlers inside of includes are not possible at the moment 2015-12-09 13:53:04 -08:00
ba62a8d559 Windows doc updates 2015-12-09 16:36:23 -05:00
b793fbc60a Remove the funcd connection plugin 2015-12-09 13:30:37 -08:00
7e6d546632 added winrm CP notes to changelog 2015-12-09 15:50:37 -05:00
45d2f59858 changed deprecation to removal warning 2015-12-09 12:39:11 -08:00
dd6e10ce43 Update submodule refs 2015-12-09 12:11:30 -08:00
6694e97a31 Make on_file_diff callback item-aware 2015-12-09 14:52:06 -05:00
699bb847a0 reenabled --tree for ansible adhoc command
previous fix to avoid callbacks now conflicted with tree optoin
which is implemented as a callback in 2.0
2015-12-09 10:14:43 -08:00
c02ca22894 adhoc avoids callbacks by default as it did before
Previous emptying of whitelist only affected callbacks that were
constructed for need whitelist. This now works for all callbacks.
2015-12-09 10:03:39 -08:00
1f9d66ef60 Clarify language of delegate_facts documentation 2015-12-09 08:46:49 -08:00
8f6f2fc920 Code smell test for specifying both required and default in FieldAttributes 2015-12-09 08:46:49 -08:00
4d7710806e attribute defaults that are containers are a copy
This is simpler way to prevent persistent containers across instances
of classes that use field attributes
2015-12-09 08:42:14 -08:00
c2665da3e8 removed unused 'pattern' from ansible.cfg
also moved the config param to a 'deprecated' list in constants.py
added TODO for producing a deprecation warning for such vars
2015-12-09 08:42:14 -08:00
186259eb80 removed default from hosts to make it requried
prevents writing a play w/o a hosts entry which would default to
all/empty
2015-12-09 08:42:14 -08:00
e571bf94d4 Revert "avoid persistent containers in attribute defaults"
This reverts commit 87969868d4.
found better way to do it
2015-12-09 08:42:14 -08:00
565b5097da clarified warning from tree callback 2015-12-09 08:40:56 -08:00
0a6f8b2bf3 Galaxy 2.0 2015-12-09 11:30:05 -05:00
f649dc71e7 avoid persistent containers in attribute defaults
moved from the field attribute declaration and created a placeholder
which then is resolved in the field attribute class.

this is to avoid unwanted persistent of the defaults across objects which introduces
stealth bugs when multiple objects of the same kind are used in succession while
not overriding the default values.
2015-12-09 11:11:49 -05:00
d93e1f4ccf added delegate_facts docs 2015-12-08 14:18:11 -08:00
9eb9f55a31 keep string type filters as strings
now we don't try to convert types if using a filter that outputs a specifically formated string
made list of filters configurable
2015-12-08 12:52:44 -08:00
dbcfce03d2 Add ssh_host support for MacOSX El Capitan.
OS X El Capitan moved the /etc/ssh_* files into /etc/ssh/. This fix
adds a distribution version check for Darwin to set the keydir
appropriately on El Capitan and later.
2015-12-08 15:36:49 -05:00
b3cfb630dc Make "make webdocs" compatible with Python 3
The `webdocs` make target fails under Python 3. It fails due to a variety of
syntax errors, such as the use of `except Foo, e` and `print 'foo'`. Fix #13463
by making code compatible with both Python 2 and 3.
2015-12-08 15:31:35 -05:00
058e02137a Preserve original token when appending to _raw_params in parse_kv
Fixes #13311
2015-12-08 15:06:01 -05:00
666cb07614 fixed typo in tree callback, added default dir
this would allow it to work with playbooks also
2015-12-08 11:59:51 -08:00
df04955572 updated with delegate_facts directive 2015-12-08 11:53:36 -08:00
422092b8bc Fix typo from 5ae850c 2015-12-08 14:34:37 -05:00
5ae850c3b2 Make fact delegating configurable, defaulting to 1.x behavior 2015-12-08 14:00:17 -05:00
7c8e1b41bb Revert "Fix always_run support in the action plugin for template when copying"
This reverts commit 45670eff81.
2015-12-08 09:26:24 -08:00
43bfd16666 have always_run override check mode for a task
Fixes #13418
2015-12-08 09:26:13 -08:00
45670eff81 Fix always_run support in the action plugin for template when copying
Fixes #13418
2015-12-08 11:55:35 -05:00
50e5b0f8e9 Merge pull request #13467 from bcoca/adhoc_callbk_fix
adhoc does not load plugins by default
2015-12-08 11:28:20 -05:00
e69064d0fc Merge pull request #13451 from bcoca/doas_fix
fixed doas from getting stuck when needing passwords
2015-12-08 11:13:01 -05:00
1aa775196b adds new device argument to nxapi command arguments
The device argument allows a dict of nxapi parameters to be passed to
the module to simplify passing the nxapi parameters
2015-12-08 10:36:47 -05:00
b07451eef8 adhoc does not load plugins by default
reimplemented feature from 1.x which kept additional callbacks from
poluting adhoc unless specifically asked for through configuration.
2015-12-08 06:37:15 -08:00
cc98528ecb Version bump for 2.0.0-0.7.rc2 2015-12-07 13:13:37 -05:00
f241c70740 corrected usage of ec2.py's profile option
this was never introduced into ansible-playbook though the docs
stated otherwise. We still explain how to use the env var to get the
same result.
2015-12-07 09:56:05 -08:00
2ed2c12f60 Fix issue when var name is the same as content.
See https://github.com/ansible/ansible/issues/13453 for more details.
2015-12-07 10:08:13 -05:00
d85b8adba6 More meaningful string representation for meta tasks (like 'noop' and 'flush_handlers') 2015-12-07 10:08:13 -05:00
8e16b481d0 added extract filter to changelog 2015-12-07 10:08:13 -05:00
d89dbf19fb bugfix for ios.py shared module argument creation
This patch fixes a bug in module_utils/ios.py where the the wrong shared
module arguments are being generated.  This bug prevented the shared module
from operating correctly.  This patch should be generally applied.
2015-12-07 06:59:43 -08:00
40c01f3739 Use self.args when we parse arguments that way the arguments can be constructed manually 2015-12-06 22:19:11 -08:00
71ffa5abdc Add representers so we can output yaml for all the types we read in from yaml 2015-12-06 22:19:02 -08:00
0533e0bc96 fixed doas from getting stuck when needing passwords
Also adjusted test to match new doas become output
fixes #13449
2015-12-06 00:35:28 -05:00
3974b13a5a Make no_target_syslog consistent.
no_target_syslog = False --> do log on target
2015-12-05 16:14:36 -05:00
d04d5bf0d5 only set become defaults at last possible moment
tasks were overriding commandline with their defaults, not with the
explicit setting, removed the setting of defaults from task init and
pushed down to play context at last possible moment.
fixes #13362
2015-12-05 15:59:51 -05:00
8a733d990f simplified get_hosts code to have 1 retrun point 2015-12-05 10:13:09 -05:00
895fc48700 Remove duplicates from host list *before* caching it
Ansible previously added hosts to the host list multiple times for commands
like `ansible -i 'localhost,' -c local -m ping 'localhost,localhost'
--list-hosts`.
8d5f36a fixed the obvious error, but still added the un-deduplicated list to a
cache, so all future invocations of get_hosts() would retrieve a
non-deduplicated list.
This caused problems down the line: For some reason, Ansible only ever
schedules "flush_handlers" tasks (instead of scheduling any actual tasks from
the playbook) for hosts that are contained in the host lists multiple times.
This probably happens because the host states are stored in a dictionary
indexed by the hostnames, so duplicate hostname would cause the state to be
overwritten by subsequent invocations of … something.
2015-12-05 10:13:09 -05:00
2068ff8926 updated pull location in changelog
it was in between of backslash description and example
2015-12-05 01:48:41 -05:00
da6670cca4 Add fullstop to make sentence make sense. Touch parargraph while at it. 2015-12-04 21:35:39 -05:00
d0337a8928 comment examples in default hosts file 2015-12-04 16:02:26 -08:00
4c21d58f4c Transform exceptions into ansible messages via to_unicode instead of str to avoid tracebacks.
Fixes #13385
2015-12-04 11:52:07 -08:00
86ca0bf3b1 Correct connection type returned by libvirt_lxc inventory script
The correct connection type for LXC containers managed via libvirt is
libvirt_lxc, not lxc.
2015-12-04 11:00:37 -08:00
627576a955 Adding a uuid field so we can track host equality across serialization too 2015-12-04 13:34:10 -05:00
3aa4db5083 Update submodule refs 2015-12-04 09:59:30 -08:00
cd76552724 Changing up how host (in)equality is checked
Fixes #13397
2015-12-04 12:58:16 -05:00
f630e140d2 fixed ansible-pull broken options
* sudo was not working, now it supports full become
* now default checkout dir works, not only when specifying
* paths for checkout dir get expanded
* fixed limit options for playbook
* added verbose and debug info
2015-12-03 20:51:51 -08:00
c03b8ef0c2 return unique list of hosts 2015-12-03 19:44:31 -08:00
46718ac3f4 reverted to previous pull checkout dir behaviour
This fixes bugs with not finding plays when not specifying checkout dir
Also makes it backwards compatible
2015-12-03 19:44:31 -08:00
3e5c7c540b corrected playbook path, reformated options help
the last just to make the help consistent and readable
2015-12-03 18:24:10 -08:00
7950f09d19 Now and/or shell expressions depend on shell plugin
This should fix issues with fish shell users as && and || are
not valid syntax, fish uses actual 'and' and 'or' programs.
Also updated to allow for fish backticks pushed quotes to subshell,
fish seems to handle spaces w/o them.
Lastly, removed encompassing subshell () for fish compatibility.
fixes #13199
2015-12-03 16:43:02 -08:00
f8911adbbc For now, skip tests of module_utils/basic functions that are failing on
py3 (these are only run on the target hosts, not on the controller).
2015-12-03 14:26:25 -08:00
6aa1b6d9b1 Properly compare object references for Hosts when adding new ones
Fixes #13397
2015-12-03 15:27:10 -05:00
013ace9ab2 fix sorting of groups for host vars
Fixes #13371
2015-12-03 14:23:14 -05:00
0d0ed35ba4 Properly default remote_user for delegated-to hosts
Fixes #13323
2015-12-03 11:33:11 -05:00
b9fbfaf64e Also some unicode tests for return_values() 2015-12-02 21:12:33 -08:00
2c5c7b54f6 Add some test data that has unicode values 2015-12-02 21:12:26 -08:00
c1aeda59bd Don't compare or merge str with unicode
Fixes #13387
2015-12-02 21:12:18 -08:00
0f813fd76a updated docs for 2.0 api 2015-12-02 12:11:58 -08:00
38c11e2239 Default msg param to AnsibleError to avoid serialization problems 2015-12-02 14:18:13 -05:00
ed4a06d8ef Don't use play vars in HostVars
Fixes #13398
2015-12-02 14:18:13 -05:00
65f4cbf487 Fix template test results on python2.6 2015-12-02 10:34:14 -08:00
48a3922d56 Add example for regex_replace using named groups 2015-12-02 09:44:26 -08:00
ca838d75e3 Get v2_playbook_on_start working
* Move self._tqm.load_callbacks() earlier to ensure that v2_on_playbook_start can fire
* Pass the playbook instance to v2_on_playbook_start
* Add a _file_name instance attribute to the playbook
2015-12-02 12:41:18 -05:00
f339184e29 Use CLI.expand_tilde also for the vault --output file 2015-12-02 09:24:36 -08:00
91f71b0ace added remote environment var setting to changelog 2015-12-02 09:09:35 -08:00
f2f310472f Make module_lang default to whatever LANG is set to on the control node 2015-12-02 09:07:26 -08:00
de7dc5d07f Catch additional assertion errors for load_list_of_blocks 2015-12-02 09:04:59 -08:00
ae5cfb2898 better error on invalid task lists 2015-12-02 08:14:37 -08:00
381409140e Minor tweak and comment addition to 974a0ce3 2015-12-02 09:10:20 -05:00
be92f909ee Update debug messages and comments
The comment was taken literally from lib/plugins/strategy/linear.py and
makes no sense in free.py where we have no noop tasks.

Also update the debug messages.
2015-12-02 09:00:27 -05:00
974a0ce3fb Fix issue #13370
all_blocks is referenced after the loop over included_files, so it needs
to be initialized before this loop, not inside.
2015-12-02 09:00:26 -05:00
1f1febaa0d Let PlayIterator.add_tasks accept empty task lists
PlayIterator.add_tasks raised an error when trying to add an empty task
list.  This was the root cause of ansible issue #13370.
2015-12-02 09:00:26 -05:00
3c25ae2e10 updated new module list
added missing modules and fixed alphabetical ordering
2015-12-01 23:53:43 -08:00
d9218ce33f reformated test, changed big assert to with_items
much easier to see the individual condition that causes the failure
when using with_items and evaluating each part of the assert individually
2015-12-01 21:26:36 -08:00
346a9fe87d unconditionally set vars on init to avoid issues with var precedence 2015-12-01 21:25:43 -08:00
5b5c6c4f47 fixes a syntax issue with module_utils/eapi.py
This patch fixes an issue with the common args dict in the eapi shared
module.  This patch is required for the eapi shared module to be properly
imported and is therefore should be applied to all instances.
2015-12-01 20:46:11 -08:00
02d059271c initial add of ssh shared module.
This ssh shared module is used for building modules that require an
interactive shell environment such as those required for connecting
to network devices
2015-12-01 19:15:41 -08:00
a6771b2255 adds module create function for eapi.py shared module
This commit changes the way modules create an instance of AnsibleModule to
now use a common function, eapi_module.  This function will now automatically
append the common argument spec to the module argument_spec.  Module
arguments can override common module arguments
2015-12-01 19:14:38 -08:00
a9e8b54246 initial add of the ios shared module
This adds shared module support for building modules that connect to Cisco
IOS devices.  It builds on the module_utils/ssh.py shared module.
2015-12-01 19:05:14 -08:00
d2108e9ff3 fixed signature for init on callbacks
also removed passing display to base class which already handles this
2015-12-01 14:07:47 -08:00
59dadc4f6b allow shell plugin to affect remote module filename
Fix for 13368, added get_remote_filename to shell plugins, powershell version appends .ps1 if necessary, base shell plugin no-ops
2015-12-01 14:02:01 -08:00
927d28e5d5 added pull's code sig verification to changelog 2015-12-01 09:55:06 -08:00
a61718cfc5 Revert "Note that su now works with local connection"
This reverts commit 93ef35e6a9.

bcoca already added this
2015-12-01 09:49:08 -08:00
93ef35e6a9 Note that su now works with local connection 2015-12-01 09:14:10 -08:00
b0e22d7701 _connect no longer takes a port argument 2015-12-01 09:12:55 -08:00
1b7db6316e updated changelog to show su now works with local 2015-12-01 09:11:30 -08:00
ca8c6e8e1c ignore password flags in become conflict check
since all the --ask pass options end up triggering the same code
and are functionally equivalent, ignore them when it comes to checking
privilege escalation conflicts. This allows using -K when --become-method=su
and so on.
2015-12-01 08:57:33 -08:00
204e27ca66 avoid inheritance issues with default=dict declaration at class level
this should avoid the issue of subsequent plays not prompting for a var
prompted for in a previous play.
fixes #13363
2015-11-30 15:12:53 -08:00
f96730003b Also make sure remote_user is defaulted correctly for delegated hosts
Fixes #13323
2015-11-30 16:16:11 -05:00
4f3f79d37b Call the function :-)
Fixes #13330
2015-11-30 12:34:55 -08:00
89f0207007 Ensure port is (re)set for delegated-to hosts
Fixes #13265
2015-11-30 14:41:05 -05:00
f8ed1c003a fixed typo 2015-11-30 09:21:26 -08:00
c5cd908c33 allow for bad stdout return from make temp dir command
fixes #13359
2015-11-30 09:20:24 -08:00
958da26d18 corrected become_methods class variable in winrm
This should now correctly react when using become with winrm
fixes #13331
2015-11-30 08:35:33 -08:00
a5d6be6dd2 Make sure run_once tasks properly set variables for all active hosts
Fixes #13267
2015-11-30 11:28:28 -05:00
7af506e7cf Use text_type instead of unicode 2015-11-30 11:28:25 -05:00
3a0f2475b2 Make sure the uuid in vars is string 2015-11-30 10:27:21 -05:00
2db3f12027 Re-implement lookup wantlist
Fixes #13285
2015-11-29 23:45:14 -05:00
bb52b45ea0 Do not copy variable_manager each time. Instead, keep host and local variable_manager sync.
Fix https://github.com/ansible/ansible/issues/13221
2015-11-29 23:15:01 -05:00
4114a3097f Tweak location of stats callback execution and properly relocate stats output code 2015-11-28 14:02:50 -05:00
73a269f9a5 Put in trap for args being None
_normalize_old_style_args can return None. If it does, the loop
"for args in args" blows up.
2015-11-28 13:44:44 -05:00
737e467b8a Trigger on_stats just once, not once for each play
Fixes #13271
2015-11-28 13:37:02 -05:00
cac0eea291 Explicitly accept become_success in awaiting_prompt state
If we request escalation with a password, we start in expecting_prompt
state. If the escalation then succeeds without the password, i.e., the
become_success response arrives, we must explicitly move into the next
state (awaiting_escalation, which immediately goes into ready_to_send),
so that we no longer try to apply the timeout.

Otherwise, we would leak the success notification and eventually
timeout. But if the module response did arrive before the timeout
expired, the "process has already exited" test would do the right
thing by accident (which is why it didn't fail more often).

Fixes #13289
2015-11-28 10:22:35 -05:00
54843d88ee Re-adding role_name/role_uuid variables 2015-11-28 10:00:42 -05:00
47651e6c22 More restrictive test against variable name to allow setting variable starting with _. 2015-11-28 10:00:38 -05:00
9e6ec4c6b0 Switch parameters validation after parsing in order to be more consistent between old and new style. 2015-11-28 10:00:34 -05:00
6457f88aab Fix missing word in developing_modules.rst 2015-11-28 10:00:25 -05:00
e210da3659 Fix typo in modules_core.rst 2015-11-28 10:00:22 -05:00
e0ecaac90d changelog: minor formating fix 2015-11-28 10:00:18 -05:00
dbedcd3538 avoids prompting for vars during syntax check
fixes #13319
2015-11-27 11:46:32 -08:00
4e6442fd19 removes editorial
I feel that Ansible is above the "my hosted Git community is better than yours" discussion and thus removed the editorial around Bitbucket
2015-11-27 11:15:57 -08:00
126249d69a Add assertions for ansible_date_time in setup result. 2015-11-27 00:49:02 -05:00
056372690f Do not double transform to unicode 2015-11-25 07:56:06 -08:00
9cee982a62 fixing errors with utf-8 values
removing utf-8 stanza

changing cast to binary_type instead

using to_unicode
2015-11-25 07:55:52 -08:00
b69942a6d2 added missing : 2015-11-25 10:57:55 -08:00
d9858ee73a added missing events to base class 2015-11-25 10:57:55 -08:00
64bcab9253 fixes to fetch action module
* now only runs remote checksum when needed (fixes #12290)
 * unified return points to simplify program flow
2015-11-25 10:57:04 -08:00
fc4326dc0c Fix ssh state issues by simply assuming it's never connected 2015-11-24 12:01:42 -05:00
92ea5c9f7b Properly check for prompting state when re-using ssh connection
Fixes #13278
2015-11-24 09:10:51 -05:00
90021104d5 Use to_unicode instead of str() 2015-11-23 16:49:00 -05:00
8bd5abaf1e Allow debug var parameter to accept a list or dict. Fix https://github.com/ansible/ansible/issues/13252 2015-11-23 16:49:00 -05:00
1ab60564ae Add integration tests for zypper
Modeled after the yum tests but also tests local package installations
as fixed with PR#1256.

This depends on PRs #1256, #1261 and #1262 in ansible-modules-extra.
2015-11-23 15:22:29 -05:00
af2e94e3c7 test_hg fix: remove reference to "head"
ERROR! error while evaluating conditional: head.stat.isreg

This is remnant from earlier change 50e5d81777
which removed stat on head file..
2015-11-23 14:34:21 -05:00
5378a6003a test_svn fix: remove hardcoded "~/ansible_testing/svn" path 2015-11-23 14:33:48 -05:00
2859933a79 We should give pipes.quote() a string every time 2015-11-23 14:27:56 -05:00
42bffeec7c Template (and include vars) PlaybookInclude paths
Fixes #13249
2015-11-23 14:04:14 -05:00
9a8e95bff3 Modify task executor to reuse connection inside a loop. Fix WinRM connection to set _connected properly and display when remote shell is opened/closed. Add integration test using raw + with_items. 2015-11-23 14:04:00 -05:00
54ec2a0b84 docsite: cloudstack: fix missing quotes in example 2015-11-23 14:03:55 -05:00
1e9e6339d1 marked spot that should send per item reulsts 2015-11-23 14:03:51 -05:00
5bc3efe34b Update submodule refs 2015-11-23 09:02:12 -08:00
7d19ad82eb Recommend using pywinrm >= 0.1.1 from PyPI instead of GitHub version. 2015-11-20 15:40:34 -08:00
c1bb3aea06 Documentation: Update the Vagrant Guide
This is an attempt to solve #7665.

Revert the change applied by f56a6e0951
(#12310), as the inventory generated by Vagrant still rely on the legacy
`_ssh` setting names for backwards compatibility reasons.
See also https://github.com/mitchellh/vagrant/issues/6570
2015-11-21 14:03:24 -08:00
011df4ad24 Update docker_login so docs work 2015-11-20 13:59:02 -08:00
c71ef9e3d7 Fix non-module plugins picking up files that did not end in .py.
This was caused by accessing the cache using the passed in mod_type
rather than the suffix that we calculate with knowledge of whether this
is a module or non-module plugin.
2015-11-20 13:51:29 -08:00
e9ed190f7b Update submodule refs 2015-11-20 12:45:27 -08:00
fe090b0fb9 Add docker_login module to the changelog 2015-11-20 12:44:48 -08:00
50a924bb04 Docker cp sets file ownership to root:root so we can't use it.
Fixes #13219
2015-11-20 07:54:07 -08:00
1e968d34cb Simplify code a little 2015-11-19 09:56:58 -08:00
c99fffa936 Use ansible_host in synchronize module
Fixes #13073
2015-11-19 09:56:49 -08:00
f2225395f9 winrm error handling tweaks 2015-11-19 09:58:33 -05:00
c33f60435b fast winrm put_file without size restrictions 2015-11-19 09:58:28 -05:00
ab8bb57f5e Version bump for 2.0.0-0.6.rc1 2015-11-19 09:15:45 -05:00
8a0d2e0ef2 Submodule pointer update 2015-11-19 09:08:49 -05:00
91500f8f5f Fix include param precedence in variable manager 2015-11-19 09:01:51 -05:00
78e4f176e6 Return skipped/failed async results directly
Fixes #13205
2015-11-19 08:30:00 -05:00
3b16ad973c Merge pull request #13201 from ma82/patch-1
Fix DataLoader's docstring
2015-11-19 08:13:02 -05:00
6912c046bb Merge pull request #13214 from mgedmin/fix-loops
Fix NameError when using loops
2015-11-19 08:10:27 -05:00
66347c9449 Fix NameError when using loops
vars_copy disappeared in 3d1255d190.

Fixes #13213.
2015-11-19 09:21:06 +02:00
3d1255d190 Don't update job vars too early when getting loop items in TaskExecutor
Fixes #13113
2015-11-18 19:12:38 -05:00
05b542eb8e added nsot inventory plugin 2015-11-19 14:32:42 -08:00
2f139dad3f Merge pull request #12368 from coxley/nsot-inventory
Contrib Inventory: NSoT
2015-11-18 14:31:15 -08:00
f8ed99e5e4 Revert "success should not include skipped"
This reverts commit 300ee227a2.
2015-11-19 11:12:18 -08:00
9dcfbb1130 Removed version argument from argparse
This was breaking standalone execution and isn't needed
2015-11-18 14:01:30 -08:00
0127d32652 Fix DataLoader's docstring
DataLoader.__init__ doesn't take an argument named vault_password
2015-11-18 11:20:34 +01:00
9b9fb51d9d Template the final_environment value in _compute_environment_string()
Fixes #13123
2015-11-17 15:39:03 -05:00
f5eca34fe4 Merge pull request #13194 from zarnovican/bza_unittest_run_command
unittest cover for 'run_command'
2015-11-17 12:35:33 -08:00
782aa9a7fd Update submodule refs 2015-11-17 12:09:46 -08:00
180159b01d Adding vars back in and trying to add a little more speed by avoiding copies 2015-11-17 14:44:46 -05:00
25807f5404 Don't modify things we've put on the queue
Fixes #12937
2015-11-17 14:22:52 -05:00
d35f615af8 added more debug info for command results 2015-11-18 11:18:03 -08:00
aa55db69fe Merge pull request #12687 from nitzmahone/pywinrm_arg_passthru
Force SSL transport for pywinrm updates, get host+group vars
2015-11-17 11:14:19 -08:00
f10d2c57c8 Restoring templating of hostvars returned by __getitem__ 2015-11-17 10:19:56 -05:00
9f31c073fe Fixing a few bugs in the HostVars performance areas
* Also refresh inventory in the HostVars manager process when things
  are changed via add_host/group_by
* Raise j2undefined rather than return it
2015-11-17 09:15:10 -05:00
4d024fc82a added os_project module 2015-11-17 15:05:29 -08:00
90f99f29ae unittest cover for 'run_command'
All os.*, subprocess.* is mocked to avoid side-effects.
Tests are skipped in Py3, since 'run_command' is not Py3-ready, yet.
2015-11-17 11:57:50 +01:00
e61882ca19 Merge pull request #13170 from robinro/integration_test_git_ansible-modules-core_pull_721
add test for changing git remote url
2015-11-16 14:53:47 -08:00
f6fb47be8c Merge pull request #13172 from gebn/docs-grammar
Removed erroneous apostrophe in installation documentation
2015-11-16 14:52:50 -08:00
984729016e Fix tag filtering on included files and add more debugging
Previously, we were filtering the task list on tags for each host
that was including the file, based on the idea that the variables
had to include the host information. However, the top level task
filtering is play-context only, which should also apply to the
included tasks. Tags cannot and should not be based on hostvars.
2015-11-16 17:15:52 -05:00
5cbeab5a3c Performance improvements for HostVars and some bugfixes 2015-11-16 17:15:52 -05:00
9d23acf302 Merge pull request #13189 from whereismyjetpack/SELINUX_SPECIAL_FS
add REPLACER_SELINUX back into module_common
2015-11-16 14:02:44 -08:00
1f34c6b214 updated yaml syntax and gotchas
specifically added example for getting strings that match boolean values
2015-11-17 12:05:57 -08:00
7f2cae5405 add REPLACER_SELINUX back into module_common 2015-11-16 16:35:55 -05:00
355fa4797a Merge pull request #13186 from nitzmahone/add_host_cache_fix
fix for dynamic (add_host) hosts not available in hostvars
2015-11-16 12:01:00 -08:00
6a2559be02 Merge pull request #13184 from nitzmahone/hostvars_undefined_fix
hostvars should return j2 undefined as instance, not type
2015-11-16 11:59:20 -08:00
fc7e2912f2 zone connection plugin bugfixes and pipelining and sudo become methods enabled!
Thanks to peinheber for helping test and debug this!
2015-11-16 11:14:13 -08:00
349e072a74 fix for dynamic (add_host) hosts not available in hostvars
Looks like there are two pattern caches that need to be cleared for this to work- added the second one.
Added integration tests for add_host to prevent future regressions.
2015-11-16 10:53:10 -08:00
3bb1f7a561 hostvars should return j2 undefined as instance, not type
Looks like someone forgot to create an instance of undefined here- we were returning the undefined type object, which broke all the undefined checks.

Added an integration test around add_host that will catch this (separate PR to follow)
2015-11-16 09:58:23 -08:00
db27541a0e Merge pull request #13053 from Etherdaemon/fix_13010_boto3_aws_profile
Fixes #13010 by updating boto3 methods
2015-11-16 09:46:26 -08:00
89646d4253 no need to be executable 2015-11-16 14:40:35 -08:00
2083a2dffa Merge pull request #13174 from sebi-hgdata/sebi/consul_kv_issue
Consul kv lookup super invocation fix
2015-11-15 14:37:51 -08:00
83f7942dcf removed print entries, corrected display calls to match latest devel 2015-11-16 11:35:10 -08:00
2c275ee1fc updated callback plugins info 2015-11-16 11:30:08 -08:00
78be81b96d Merge pull request #12510 from jcftang/devel
Initial add of logentries callback plugin
2015-11-15 11:28:02 -08:00
18c8a21a67 Merge pull request #13173 from willthames/mysql_drop_test
Handle unexpected database presence
2015-11-15 09:35:56 -05:00
f1db99caa7 updated with latest changes to default 2015-11-15 10:09:24 -08:00
eeedaf2cbc fixed var name typo 2015-11-15 08:43:42 -08:00
e174247734 evaluate includes for skipped tags
cannot evaluate for include tags as underlying tasks might have them, but skips override so this should be a performance boost
2015-11-15 07:51:36 -08:00
1f052d5ce6 fixed super invocation 2015-11-15 13:48:40 +02:00
4f3430ebeb Handle unexpected database presence
Check for database presence in a nice way, rather than
dropping the database.

Thankfully there was a syntax error in the previous
version, so no database would have been dropped.
There was no check for whether it succeeded or not.
2015-11-15 10:45:24 +10:00
0dedf444a1 Removed erroneous apostrophe in installation documentation 2015-11-15 00:04:11 +00:00
19ba54c9fd Don't be fatal on import errors so plays don't fail if plugin doesn't have required dependencies 2015-11-14 20:02:03 +00:00
125370ab48 Run when whitelisted 2015-11-14 19:46:00 +00:00
6cefdfe148 add test for changing git remote url
integration test for https://github.com/ansible/ansible-modules-core/pull/721
clone a repo from one url
clone an updated version of that repo from a new url
make sure the remote url and the working copy are updated
2015-11-14 17:03:41 +01:00
5f2f5e2b59 Add boilerplate and fix initialisation to match what 2.0 expects 2015-11-14 08:54:41 +00:00
c02ceb8f12 Remove threading and queues. Added license information and cleaned up callback. 2015-11-14 08:40:16 +00:00
85277c8aae Initial add of logentries callback plugin
This callback plugin will generate json objects to be sent to the
logentries service for auditing/debugging purposes.

To use:

Add this to your ansible.cfg file in the defaults block

    [defaults]
    callback_plugins = ./callback_plugins
    callback_stdout = logentries
    callback_whitelist = logentries

Copy the callback plugin into the callback_plugings directory

Either set the environment variables

    export LOGENTRIES_API=data.logentries.com
    export LOGENTRIES_PORT=10000
    export LOGENTRIES_ANSIBLE_TOKEN=dd21fc88-f00a-43ff-b977-e3a4233c53af

Or create a logentries.ini config file that sites next to the plugin with the following contents

    [logentries]
    api = data.logentries.com
    port = 10000
    tls_port = 20000
    use_tls = no
    token = dd21fc88-f00a-43ff-b977-e3a4233c53af
2015-11-14 08:40:16 +00:00
a766044b26 Merge pull request #13167 from amenonsen/release-name
Trivial: add 2.0 release name to RELEASES.txt
2015-11-13 20:41:03 -08:00
300ee227a2 success should not include skipped
fixes #13161
2015-11-14 14:39:42 -08:00
6e9cf88a87 The 2.0 release has a name now 2015-11-14 09:59:04 +05:30
07b588f6c0 Version bump for new beta 2.0.0-0.5.beta3 2015-11-13 16:48:25 -05:00
2b25b7974c Remove unnecessary sleep from result process 2015-11-13 16:45:45 -05:00
634e10e5b8 Merge pull request #13156 from amenonsen/broken-timeout
If ssh died, it's an error, not a timeout
2015-11-13 10:45:21 -08:00
49651221be Merge pull request #13147 from leedm777/connect-timeout
Increase the escalation prompt timeout
2015-11-13 10:45:01 -08:00
26ea9c4351 If ssh died, it's an error, not a timeout 2015-11-13 20:10:08 +05:30
5bd096208c Increase the escalation prompt timeout
It was set to match the SSH connect timeout. Unfortunately, they would
race when ssh fails to connect, and the connect timeout usually failed.
This led to some misleading error messages.

Fixes #12916
2015-11-13 08:02:37 -06:00
31b1abf580 Merge pull request #13146 from nitzmahone/gce_error_messaging
fix gce module error reporting
2015-11-13 08:46:51 -05:00
5d645f3a8b Merge pull request #13127 from willthames/test_become
Elevate privileges when checking for file existence
2015-11-12 22:35:01 -08:00
3952fc7f97 made python 3 compatible 2015-11-13 21:57:28 -08:00
4163655099 fix gce module error reporting
Error reporting was broken for GCE modules- pprint didn't work with exceptions, so you'd always get "Unexpected response: {}" instead of the real error.
2015-11-12 16:30:46 -08:00
958fb29b78 Merge pull request #12881 from Scypho/devel
fix for issue #11885 - allowing json in lookup template calls
2015-11-12 15:39:35 -08:00
13750f68ee Reduce spinning while waiting on queues 2015-11-12 14:41:09 -05:00
e2af57062c added rudder inventory script 2015-11-13 08:13:19 -08:00
7ce4903a8b Merge pull request #12139 from amousset/rudder_inventory_plugin
Add Rudder inventory plugin
2015-11-12 08:12:08 -08:00
2dad974048 Merge pull request #13141 from Val/update_debian_packaging_documentation
Update debian packaging documentation
2015-11-12 08:09:39 -08:00
6fe3f07e09 Merge pull request #13142 from unprofession-al/fix_jsonfile_fact_caching_connection
Make jsonfile fact cache handle fancy paths properly
2015-11-12 07:55:29 -08:00
0918416b83 substitute tilde and env vars before storing C.CACHE_PLUGIN_CONNECTION as instance attribute 2015-11-12 16:52:02 +01:00
fbe84d7fb2 Add missing xsltproc in Debian packaging README
fix #13140
2015-11-12 16:08:51 +01:00
ddefff5be0 Add missing docbook-xml in Debian packaging README
fix #13139
2015-11-12 15:59:53 +01:00
79c311a33f Merge pull request #13133 from amenonsen/changelog-update
Fix ordering quirks in CHANGELOG
2015-11-11 19:34:29 -08:00
c6d2eb0da1 Put settings/vars together, unsplit refresh_inventory item 2015-11-12 08:56:16 +05:30
d62cc30aa7 Merge pull request #12640 from amenonsen/ec2-csv-tags
Add an expand_csv_tags setting to ec2.ini
2015-11-11 19:23:07 -08:00
e6a9b2cae5 Add an expand_csv_tags setting to ec2.ini
If enabled, this will convert tags of the form "a,b,c" to a list and use
the results to create additional inventory groups.

This is based on PR #8676 by nickpeck (but not a straight rebase—both
the code and the nomenclature have been changed here).

Closes #8676
2015-11-12 08:48:53 +05:30
7fd8b86a10 Fix documentation build problems 2015-11-11 12:39:06 -08:00
d38ac6a394 Update submodule ref for another new module 2015-11-11 12:33:32 -08:00
7807e99bca A bunch of shipit's merged 2015-11-11 12:19:34 -08:00
8aa2cbd647 Fix traceback because we're using display from another object that no
longer has it.
2015-11-11 12:19:00 -08:00
b2b0fa8d13 Changed do/until failed color
Fixes #13130
2015-11-11 14:43:15 -05:00
94c20c9ac6 Cleanup failed/changed logic in TaskExecutor
Fixes #12980
2015-11-11 14:23:37 -05:00
62979efa14 Finish up plugin porting to global display
Also remove display = display which does nothing
2015-11-11 10:44:23 -08:00
2bd695ed42 Port cache plugins to global display 2015-11-11 10:44:22 -08:00
b05d0b8c9c Port lookup plugins to global display. 2015-11-11 10:44:22 -08:00
4c7128da17 Port action plugins to global display 2015-11-11 10:44:22 -08:00
186e034515 Move the rest of executor code to global display 2015-11-11 10:44:22 -08:00
7ecfa072da Move the rest of the playbook code to use global display 2015-11-11 10:44:22 -08:00
aa4f213cb5 Move connection plugins to using global display 2015-11-11 10:44:22 -08:00
318bfbb207 Migrate cli and dependencies to use global display 2015-11-11 10:44:22 -08:00
1b7d3f2898 updated submodule refs 2015-11-12 09:41:51 -08:00
99f45f2e19 pass task args without filtering, copy module needs to explcitly support
remote_src or it will remove the src file
2015-11-12 09:40:43 -08:00
206cc50bd9 breaks testing in non virtual envs, since env var can be used in those
cases removing it from here
2015-11-12 09:40:43 -08:00
c7b69127ec Remove dead code 2015-11-11 08:12:21 -08:00
ab44cf2a9a Start a pyflakes section to cut down on extra messages that we don't agree are problems 2015-11-11 07:50:19 -08:00
e45ce871a7 Fix for traceback when neither name nor pkg are in the module params 2015-11-11 07:32:21 -08:00
b2a9111b22 reversed the logic on new setting to control - replacment in groups as
it was wrong
fixes #13122
2015-11-11 13:35:09 -08:00
5bb759e7ab Elevate privileges when checking for file existence
Certain OSs default to home directories as 0700
Without elevating privileges, checking for file existence
fails.
2015-11-11 23:42:35 +10:00
4737305837 Remove dead code as this was moved to another class 2015-11-10 12:18:20 -08:00
be22a670e5 addes deprecated information to ansible-doc display
fixes #13118
2015-11-11 11:15:22 -08:00
1b349fdf34 Merge pull request #13112 from privateip/eapi
add initial support for Arista eAPI
2015-11-10 10:31:26 -08:00
74fe9d236a Add a disabled test for accessing private attributes of other objects
Need to cleanup the code before we can enable this test.
2015-11-10 09:50:27 -08:00
566144461f Remove internal use of display and use the top-level import 2015-11-10 12:02:29 -05:00
0fc187893d Catch import warnings in a common location for both get() and all()
Potential solution for #12979
2015-11-10 11:25:07 -05:00
9f0c2cfda5 Merge pull request #13114 from mgedmin/fix-plugin-loader
Check sys.modules before loading modules
2015-11-10 11:04:35 -05:00
54eae4a793 Check sys.modules before loading modules
Code for a plugin is usually loaded by a PluginLoader(), and henceforth
available from self._module_cache, which prevents duplicate loading.
However there are situations (e.g. where one action plugin imports code
from another one) where the plugin module might be already imported (and
resident in sys.modules), but not present in the PluginLoader's
_module_cache, which causes imp.load_source() to effectively reload the
module, overwriting global class declarations and causing subtle latent
bugs.

Fixes #13110.
Fixes #12979.
2015-11-10 17:57:43 +02:00
a99f2fd52f Save delegated vars in result for use in callback methods
Fixes #13014
2015-11-10 10:14:30 -05:00
2e98f7f429 add initial support for Arista eAPI
This commit adds the shared module support for Arisat EOS devices
running eAPI.  The shared module builds on top of module_utils/urls.py.
2015-11-10 07:59:59 -06:00
e56fd9e95d Make sure pattern cache components are converted to unicode 2015-11-10 08:28:45 -05:00
0b999c602a Properly figure subset and restrictions into host cache pattern
Fixes #13111
2015-11-10 08:23:51 -05:00
ea0da421df Merge pull request #13107 from resmo/patch-3
doc: update guide_cloudstack.rst
2015-11-10 06:55:13 -06:00
1d7982c599 Update guide_cloudstack.rst 2015-11-10 09:11:57 +01:00
d8fb5efa90 Merge pull request #13102 from Yannig/devel_cache_enhancement
New method template_no_cache for template object.
2015-11-10 02:23:42 -05:00
0c360d17cb New parameter for template method.
We do not compute hash when we know that the result does not need to be cached (like with_items loop).
It also result in a small speed improvement.
2015-11-10 07:19:19 +01:00
27398131cf Fixes #13010 by updating boto3 methods to update boto3_conn to check for profile_name and if detected, remove from params and set a new variable of profile which is passed into Session separately 2015-11-10 15:22:07 +10:00
09994c18f3 Correct logic around determining environment variable existence
Fixes #13105
2015-11-09 21:04:24 -05:00
c753ae6e22 Fixing up host pattern caching to avoid bugs
* Always cache and return unique list objects, so that if the list
  is changed later it does not impact the cached results
* Take additional parameters and the type of the pattern into account
  when building the hash string
2015-11-09 20:55:13 -05:00
e8f83dcba3 Revert "Temporarily disable template caching"
This reverts commit 4d1757ce64.
2015-11-09 20:41:59 -05:00
4d1757ce64 Temporarily disable template caching 2015-11-09 17:09:13 -05:00
995db275f8 Update submodule refs 2015-11-09 13:48:34 -08:00
db5d3f03a9 Fix first_found not finding files in roles (only templates) 2015-11-09 13:47:17 -08:00
ccbcfcddfc Move where we add environment and make it conditional on not existing
Also displays a warning now, because users should not be using that variable
name as it causes a collision with the internal variable of the same name.
2015-11-09 16:28:54 -05:00
37ae243587 made get_file_lines rely on get_file_content which deals with many error
conditions that the former did not.
2015-11-10 13:22:45 -08:00
74d76105aa Merge pull request #13100 from ghislainbourgeois/patch-2
Fix get_dns_facts on inexistent resolv.conf
2015-11-09 13:10:15 -08:00
eb850d7e5b Fix get_dns_facts on inexistent resolv.conf 2015-11-09 15:02:03 -05:00
e36b4e2a13 Merge pull request #13072 from Yannig/devel_cache_optimization
Cache optimization
2015-11-09 14:54:06 -05:00
76ae577519 Ensure environment is inherited properly (task->block/include->play) 2015-11-09 14:51:07 -05:00
937584cd52 Ensure 'environment' is set in the magic variables
Fixes #13033
2015-11-09 14:50:39 -05:00
d6f61d5397 Note undefined vars change 2015-11-09 11:15:06 -08:00
7e04947599 Be more selective about what variables we cache during templating
Fixes #13087
2015-11-09 14:07:48 -05:00
1a04f354f3 For with_first_found loops, set undefined variables to fall through rather than failing the task 2015-11-09 10:51:54 -08:00
317e908165 Merge pull request #13065 from tima/patch-2
Consistent inventory pattern delimiter in docs
2015-11-09 08:54:51 -08:00
240acb1924 Merge pull request #13092 from privateip/nxapi
initial shared module support for nxapi
2015-11-09 08:43:30 -08:00
b7481e1c1d Merge pull request #13085 from agireud/check_mode_fix
Fix check mode argument
2015-11-09 10:56:45 -05:00
087266ec24 Merge pull request #13083 from sradvan/devel
fixes for bsd doc
2015-11-09 10:56:25 -05:00
cb8683df7f Merge pull request #13082 from resmo/for-ansible
cloudstack: fixes in tags handling
2015-11-09 10:55:24 -05:00
f88273eb87 changes the nxapi argument spec to require url_password 2015-11-09 09:45:26 -05:00
d3d36eb766 fixes conditional statement for py24 compatibility 2015-11-09 09:36:17 -05:00
64e139adb1 add initial support for Cisco NXAPI
This commit adds the shared module support for Cisco NXAPI.  The shared
module builds on top of the urls shared module.  The urls module provides
the http/s transport.  This module only supports the JSON request message
format.
2015-11-09 09:18:38 -05:00
52ded67db5 Update check mode argument 2015-11-08 20:55:10 -06:00
ed487a0cf5 Merge pull request #1 from sradvan/sradvan-docs-patch-1
Update intro_bsd.rst
2015-11-09 12:43:57 +13:00
19b95e9106 Update intro_bsd.rst
Minor fixes/wording/capitalization.
2015-11-09 12:34:28 +13:00
1d59caed07 cloudstack: change order of tags handling, fixes update of tag value does not work 2015-11-08 20:27:01 +01:00
3410a855b0 cloudstack: use jop polling in tag handling, fixes outdated tags returned.
In some cases the async job did not finish fast enough, causing returning an unexpeded result.
2015-11-08 20:23:06 +01:00
12a6fb9633 Small speed improvement with huge inventory (100+ hosts). 2015-11-07 19:32:10 +01:00
da4b4a2a33 Merge branch 'Yannig-devel_cache_for_do_template_call' into devel 2015-11-06 22:22:23 -05:00
dd4ca66e1e Make sure hostvars cache is recreated during serialization 2015-11-06 22:21:50 -05:00
5040abaaf2 Merge branch 'devel_cache_for_do_template_call' of https://github.com/Yannig/ansible into Yannig-devel_cache_for_do_template_call 2015-11-06 22:04:52 -05:00
9a25e16140 set corrected force default 2015-11-06 19:06:58 -05:00
cc27fc368a Debian packaging updates
Fixes #13040
2015-11-06 15:51:17 -05:00
cdda49a097 Merge pull request #13064 from tima/patch-1
v1 variable precedence order was off.
2015-11-06 15:21:41 -05:00
a8e1ec585d Consistent inventory pattern delimiter in docs
The inventory pattern delimiter used in the examples switches between the comma and colon. While both are valid I've found this throws off new users so I've modified the examples to consistently use a colon, the more common of the two in my experience.
2015-11-06 13:54:39 -05:00
fde7c14cd0 v1 variable precedence order was off.
Noticed that the v1 variable precedence docs list facts discovered as having a lower precedence than inventory variables. It is in reality the other way around. The v2 section gets this right.
2015-11-06 13:48:35 -05:00
47f187b221 Update submodule refs 2015-11-06 10:30:42 -08:00
59b67a2f68 Reset workers list when recreating processes
Also renames some things to be more accurate
2015-11-06 12:10:15 -05:00
1655b08c77 added clarification to ssh user changes 2015-11-06 10:27:44 -05:00
5b84bd6b5d Merge pull request #13056 from alxgu/sles_sap_family
Add SLES_SAP as a Suse family
2015-11-06 08:58:31 -05:00
226c7f4c7b Revert "added setting of ansible_ssh_user to current user as backwards compatibilty issue"
scope was wrong, this var should not be 'reset' here.

This reverts commit c271c0eb04.
2015-11-06 08:31:56 -05:00
9c24f88eca updated forks comment 2015-11-06 08:31:56 -05:00
cf248941e4 Merge pull request #13058 from resmo/fix/template-force-false
[v2] template: fix regression bug in template in case force=false
2015-11-06 08:04:42 -05:00
768f2fe6d4 template: fix regression bug in template in case force=false
Fixes regression bug, previously reported in #12844 fixed with
4b20884719 re-introduced with
c64ac90560
2015-11-06 11:24:39 +01:00
215fc12234 Add SLES_SAP as a Suse family 2015-11-06 09:42:39 +01:00
5c7d717f31 made ansibledoc more consistent with term sizes, it now uses display class column calculations
cleared up snippet display
2015-11-05 17:42:14 -05:00
1027abd596 Cleaning up bugs related to perf improvement changes 2015-11-05 16:42:12 -05:00
f10022dbd2 Fix use of add_tqm_variables 2015-11-05 16:30:03 -05:00
efbc6054a4 Add variable compression option 2015-11-05 16:22:37 -05:00
63c47fb271 Fixing up performance 2015-11-05 16:22:37 -05:00
c64ac90560 fixed check mode change response in template
fixes #13049
2015-11-05 15:55:19 -05:00
483c25a609 Revert "switched host patterns to use sets, simplified logic which now uses buitins"
need this to be lists, for order and other considerations
This reverts commit 8e2f0b3f2c.
2015-11-05 15:41:17 -05:00
88ba46aee0 Revert "fixed append to add"
good change on top of bad
This reverts commit 699f344e17.
2015-11-05 15:40:52 -05:00
699f344e17 fixed append to add 2015-11-05 15:24:20 -05:00
8e2f0b3f2c switched host patterns to use sets, simplified logic which now uses buitins 2015-11-05 15:02:06 -05:00
883f451158 fixed snippet display, short_desc is a string, not a list 2015-11-05 14:32:18 -05:00
95604573ee improved the message when there is no module path override 2015-11-05 14:32:18 -05:00
aa034f4fcf Add unit tests for issue #12976 2015-11-05 10:52:37 -08:00
37052a983a Fix unittest dailure with the new squash items code 2015-11-05 10:45:54 -08:00
f68f7d0495 Merge pull request #12956 from bcoca/v1_callbacks
added callback fallback to v1 methods
2015-11-05 13:13:02 -05:00
f4912dd88a added callback fallback to v1 methods for backwards compat with existing callbacks 2015-11-05 13:04:50 -05:00
e2c56efca6 Merge pull request #12867 from bcoca/callback_whitelist_tweak
make callbacks declare needing whitelisting
2015-11-05 12:58:05 -05:00
4f6d4c6bf6 Set task_action when the action does not need to be templated
Fixes #13042
2015-11-05 08:38:21 -08:00
9753de35a7 Merge pull request #13038 from bcoca/min_forks_to_play
use minimal number of forks
2015-11-05 11:22:15 -05:00
23ff08ee6b Merge pull request #13016 from dvarrazzo/pip-vcs-changed
Added tests to verify pip installation with VCS urls
2015-11-05 08:16:12 -05:00
586cbb9fda Update core submodule ref 2015-11-04 19:44:42 -08:00
483491ddfb template the task_action before checking whether to optimize with_item loops for it.
Fixes the second problem discovered in #12976
2015-11-04 19:41:55 -08:00
9e758d3d97 Do not optimize with_items loop if the items are not strings
The code isn't sophisticated enough to understand lists and dicts yet.
This mirrors how 1.9.x handled non-string items so its not a regression.

One portion of a fix for #12976
2015-11-04 18:48:41 -08:00
931eb16e55 clearer selection of min value
cleanup workers at each run to avoid stragglers
2015-11-04 17:28:08 -05:00
ccbdd6229a Use static vars when computing host vars known to be static (inventory_hostname, inventory_dir etc.). 2015-11-04 22:16:14 +01:00
e0aa3ff232 Cache against hosts pattern (fix a part of problem describe in https://github.com/ansible/ansible/issues/13023). 2015-11-04 22:15:02 +01:00
da3087ffc4 Merge pull request #13039 from cmluciano/patch-1
Provide git based example
2015-11-04 15:48:19 -05:00
6677c8b8f0 Provide git based example
I found it difficult to find documentation for how to pull from a git-based scm that wasn't github. The only way I could find this option was to dig through the google-group.
2015-11-04 15:43:24 -05:00
b44f1428d0 use minimal number of forks taking serial, forks and play patterns into account 2015-11-04 15:16:20 -05:00
3c35655b52 removed serial as it is not avialable for fork control
fixes #13037
2015-11-04 14:04:47 -05:00
0abeff4511 better limiting of forks to lowest actual restriction 2015-11-04 12:47:10 -05:00
b529f8b964 Merge pull request #13036 from larsla/limit-forks
treat forks config parameter as max value...
2015-11-04 12:37:34 -05:00
113c4350e3 Force SSL transport for pywinrm updates, get host+group vars
I PR'd a change to pywinrm to allow server certs to be ignored; but it's only on the SSL transport (which we were previously ignoring). For this to work more generally, we're also now pulling the named ansible_winrm_* args from the merged set of host/group vars, not just host_vars.
2015-11-04 09:31:43 -08:00
3289670a04 treat forks config parameter as max value instead of always creating that number of workers 2015-11-04 17:13:26 +01:00
38cc0705c6 added note about implicit vs explicit handling of ssh login user 2015-11-04 09:38:48 -05:00
89bf30d885 Merge pull request #13029 from willthames/allow_commented_out_roles
Allow blank lines and comments/spaces in galaxy spec files
2015-11-04 07:41:13 -05:00
91b6004149 Allow blank lines and comments/spaces in galaxy spec files
Fixes #10641 again. (Regression)
Added test to discourage future such regression.
2015-11-04 15:36:20 +10:00
4b75308439 Fix up rst formatting 2015-11-03 17:29:02 -08:00
07d0d2720c Update submodule refs 2015-11-03 14:13:16 -08:00
eb8ec73ff3 Merge pull request #13022 from smiller171/patch-1
Update README.md
2015-11-03 14:23:29 -05:00
98b694f5ca Update README.md 2015-11-03 14:11:22 -05:00
9ce3adbeb1 remove assigned but unused variables in module_utils.
These were mostly saving exceptions but not using them.  Getting rid of
those will help with eventually running modules via either python2.4 or
python3.x.
2015-11-03 09:53:18 -08:00
c08648999d Remove some more unused stdlib deps. 2015-11-03 09:53:18 -08:00
658ea053ea Cleanup timer callback plugin's overwriting of modules it imported 2015-11-03 09:53:18 -08:00
127bb1fa77 Merge pull request #13021 from erjohnso/urls_patch
Allow PATCH to list of valid HTTP methods
2015-11-03 09:52:38 -08:00
dfad7c64fb Allow PATCH to list of valid HTTP methods 2015-11-03 17:38:52 +00:00
8d3da20302 fixed bsd service_mgr_facts using removed check_init fucntion 2015-11-03 11:43:50 -05:00
542a430e84 Added tests to verify pip installation with VCS urls
The test reproduces:
- bug ansible/ansible#1705
- bug ansible/ansible-modules-core#1645
2015-11-03 14:54:40 +00:00
e667c0af0d Merge pull request #13011 from amenonsen/patch-1
Fix typo
2015-11-03 08:18:56 -05:00
30f827d92d Fix python3 test. 2015-11-03 11:52:09 +01:00
7caefa5cd9 Fix typo 2015-11-03 10:57:48 +05:30
10fd717a44 narrow the scope of import error and make sure non - aliases to ansible get their own error 2015-11-02 22:17:37 -05:00
a7d1a39b81 Update core submodule ref 2015-11-02 17:38:28 -08:00
2df0022a3e Update submodule refs 2015-11-02 17:12:16 -08:00
eb04650ffb Merge pull request #12162 from bcoca/service_mgr_facts
fact gathering service_mgr info
2015-11-02 15:34:43 -05:00
a1a5dadef6 remove uneeded module 2015-11-02 15:36:11 -05:00
130139dc80 Fix unicode issue introduced by previous commit. 2015-11-02 21:32:49 +01:00
3219744d32 One more stdlib import in module_utils 2015-11-02 12:25:18 -08:00
d194e2c788 check_systemd is not inline but a private fact function now 2015-11-02 15:23:47 -05:00
e9efd008ed moved distutils import to mac, darn solaris would complain in certain cases 2015-11-02 15:23:47 -05:00
99d775a0c1 fact gathering service_mgr info
also added dragonfly facts support
2015-11-02 15:23:47 -05:00
4a8d1703d4 New patch against hostvars.py. With this patch, Ansible run lose 50% of time.
Little rewrite of previous patch to use sha1 signature.
Use fail_on_undefined to compute sha1 signature.
2015-11-02 21:04:20 +01:00
1bc75374dc Add imports for stdlib modules that are used.
This is cleanup that will aid us when we get ziploader implemented for 2.1
2015-11-02 12:02:26 -08:00
107d025d8a Update extras submodule ref for doc fixes 2015-11-02 11:39:57 -08:00
d0a22a7b45 made cli code more flexible to add new command line programs w/o need for updating bin/ansible 2015-11-02 14:35:06 -05:00
99561e88d4 Update submodule refs 2015-11-02 10:56:39 -08:00
56a2412dc2 now correctly traps unimplemented symlinks as subprograms 2015-11-02 12:46:33 -05:00
3c1fe28bed Correct broken DEB builds by fixing LC_TIME assignment
Fixes a `make deb` build failure introduced by
c41adc32c2
2015-11-02 12:30:36 -05:00
4a206cdde9 force egg deletion 2015-11-02 11:58:20 -05:00
5ee01d00bb Merge pull request #13005 from ansible/tgerla-clarify-role-tags
Clarify how tagged roles work
2015-11-02 11:51:12 -05:00
9008b7b0e7 Clarify how tagged roles work
This is a confusing part of roles and tags. Most people assume that tagging a role means that the tagged tasks inside the role will run based on the tags specified. But in reality, it tags the whole role with those tags.
2015-11-02 11:47:18 -05:00
61ace1d3c4 added ipify_facts to changelog 2015-11-02 09:32:40 -05:00
79bf66336b switched clean_data from hardcoded delimiters to actual currently set jinja2 environment delimiters 2015-11-02 09:00:56 -05:00
805f768dab Clear cache when updating template variables. 2015-11-02 07:57:44 +01:00
467c29e3db show task path on 2 vs 2015-11-01 17:43:11 -05:00
5e0d55ae5b Change the dict attribute collision warning to recommend using bracket notation 2015-11-01 13:32:45 -08:00
4ec0536168 made condition not simplifiable to 'in' 2015-11-01 16:31:23 -05:00
87a9485b2f Cache for _do_template call. May result in nice speed improvement (4-5 times faster). 2015-11-01 22:30:55 +01:00
2e33a87513 Merge pull request #12998 from abuduba/devel
Ensure english dates are generated in debian/changelog placeholder
2015-11-01 16:08:51 -05:00
21ffe8702d Merge pull request #12993 from ypid/avoid-python-object-name-in-complex-datatypes
Avoid key names which are valid attributes for data types in Python.
2015-11-01 16:08:09 -05:00
1dbde84337 Merge pull request #12994 from resmo/for_ansible
doc: cloudstack guide fix up
2015-11-01 15:47:21 -05:00
=
c41adc32c2 [Makefile] Ensure english dates are generated in debian/changelog placeholder when building deb package.
It
2015-11-01 21:37:02 +01:00
2ee5bb5e55 Merge pull request #12995 from resmo/fix/cloudstack-utils
cloudstack: clean up unneeded ";"
2015-11-01 12:23:47 -06:00
c09a34bb10 cloudstack: clean up unneeded ";" 2015-11-01 17:13:46 +01:00
f528ad1848 added xbps pkg mgr to facts 2015-10-31 22:03:12 -04:00
ad0d299c56 Avoid key names which are valid attributes for data types in Python.
Closes #12990.

Alternative to #12992

This PR excludes all attributes of the following data types: lists,
tuples, dicts, sets, integers, floats, strings and Unicode objects.

It is expected that only the attributes of dicts and sets would cause an
problem like in #12990.
2015-10-31 23:58:16 +01:00
0712ec756b commented out all settings in exampmle ansible.cfg as we really only want to set when diff from defaults 2015-10-31 18:57:27 -04:00
1243997c00 doc: cloudstack guide fix up 2015-10-31 23:51:03 +01:00
83686676e5 changelog updates:
- corrected inventory pattern info to match latest update
- arranged new headers for the release
- documented them band change
- added some missing changes
- rearranged and clarified some existing changes
2015-10-31 17:13:29 -04:00
3c3aff09c9 fixed documentation for host patterns separators 2015-10-31 16:35:40 -04:00
13bf62d0e6 remove deprecation for :, add ; functionality (its deprecated but it should work) 2015-10-31 16:35:40 -04:00
9c09dc3ef8 Revert "Document , instead of : in intro_patterns, update changelog"
due to , being broken in 1.9

This reverts commit b47bc343ea.
2015-10-31 16:35:40 -04:00
bb4763d1c4 Merge pull request #12989 from resmo/patch-2
doc: add cloudstack guide to the guides
2015-10-31 15:18:22 -04:00
090f450d18 doc: add cloudstack guide to the guides 2015-10-31 19:34:40 +01:00
d341ba14a5 fixed rekey password handling 2015-10-31 14:13:03 -04:00
00bc74404a vault noe preserves permissions on edit and rekey and sets a restricitve default umask for all other cases 2015-10-31 14:13:03 -04:00
35bedd1190 Merge pull request #12988 from resmo/cloudstack-guide
doc: cloudstack guide
2015-10-31 12:59:34 -04:00
c267e1906e removed invocation from tests as it is only available on very very verbose mode 2015-10-31 13:00:53 -04:00
3f26b31e47 Create guide_cloudstack.rst 2015-10-31 17:40:00 +01:00
7368030651 removed action plugin as service facts and separate modules don't work yet and this forces gathering facts 2015-10-30 17:56:05 -04:00
f5b095f6c8 properly sanitize registered vars 2015-10-30 16:42:06 -04:00
b6c92dacb5 removed key striping as they are read up the chain 2015-10-30 14:03:37 -04:00
57d3245d0d remove commented out prints 2015-10-30 14:02:41 -04:00
7ba4f5ee12 removed no_log redundant code 2015-10-30 14:01:47 -04:00
b97887ba41 simplified invocation removal, added no_log awareness 2015-10-30 10:17:19 -04:00
9f9655d3db Merge pull request #12975 from larsks/bug/12963
add missing configuration examples
2015-10-30 10:07:51 -04:00
dc8290ab7a add missing configuration examples
adds configuration examples missing from intro_configuration.rst.

Closes #12963.
2015-10-30 09:58:26 -04:00
c61499168e Merge pull request #12962 from bcoca/pull_fixes
fixes options for ansible pull
2015-10-30 09:46:09 -04:00
56e5e72aaa Make handlers obey run_once (or BYPASS_HOST_LOOP)
Fixes #12972
2015-10-30 09:44:35 -04:00
21b76dee6f Merge branch 'Yannig-devel_fix_debug_var' into devel 2015-10-30 08:37:48 -04:00
a5bd92ca4b Merge branch 'devel_fix_debug_var' of https://github.com/Yannig/ansible into Yannig-devel_fix_debug_var 2015-10-30 08:37:03 -04:00
000adca27b Merge pull request #12973 from bastianharren/patch-1
stdout_callback instead of callback_stdout
2015-10-30 08:10:07 -04:00
aeb0c2e5ba Merge pull request #12974 from jaamiller/patch-1
Update playbooks_lookups.rst
2015-10-30 08:06:50 -04:00
4359189884 Update playbooks_lookups.rst
I was caught out by the different behaviour of lookups & local tasks, and could not find the difference documented anywhere at all, so I took the liberty of proposing this change.

Lookups are always relative to the role or play.
Local tasks are relative to the cwd from which you execute.
2015-10-30 10:50:53 +00:00
9f2baf3f84 adding documentation 2015-10-30 10:34:47 +01:00
b39b474def stdout_callback instead of callback_stdout 2015-10-30 09:51:35 +01:00
237f8c9df7 removed debug print 2015-10-29 20:34:55 -04:00
479cbfc63c Don't immediately fail on PlayContext setup
As we may end up skipping the task due to conditionals.

Fixes #12774
2015-10-29 19:23:42 -04:00
9f148fc046 removed requirement of destination and set documented default 2015-10-29 16:28:46 -04:00
40d22be2ef fixes options for ansible pull
* remove requirement for host patterns, use the defaults
 * require destination directory (None in cwd is not a good default)
 * fixed usage messages
 * updated default inventory to use , and not deprecated :
2015-10-29 16:28:46 -04:00
b73941b95f updated submodule refs 2015-10-29 16:06:33 -04:00
6d89676a42 Merge pull request #12965 from matburt/fix_ec2_nested_groups
Fix ec2 infinitely nested groups
2015-10-29 13:31:59 -04:00
faeccb4e61 Fix ec2 infinitely nested groups
The ec2 inventory module will incorrectly place parent groups as child
groups of themselves, this fixes that.
2015-10-29 13:24:39 -04:00
508bffef02 Update extras submodule ref 2015-10-29 10:20:55 -07:00
b8bc15fe02 switched to backticks to allow for non bourne shells to work 2015-10-29 12:45:53 -04:00
27dc7e11a4 Merge pull request #12953 from larsks/bug/7890
add documentation for with_file loops
2015-10-29 10:45:05 -04:00
061b83cd74 Merge pull request #12957 from willthames/module_docs_guidelines
Clarify module documentation
2015-10-28 22:11:01 -04:00
ab55726fad Clarify module documentation
Make the position on _facts modules more emphatic
Add documentation for RETURN structure
2015-10-29 10:02:59 +10:00
1febf7cb88 Fix for issue #12952: this code interfere with debug+var and seems to be unnecessary. 2015-10-28 22:09:13 +01:00
097adec834 add documentation for with_file loops
This commit adds documentation for the `with_file` loop construct,
resolving #7890 and #9160.
2015-10-28 16:56:21 -04:00
bdf5f706eb Merge pull request #12950 from chrismeyersfsu/fix-ansible_test_service_checksum
update ansible_test_service checksum
2015-10-28 14:58:03 -04:00
4b88cce6a1 update ansible_test_service checksum 2015-10-28 14:55:13 -04:00
5d92b00d9c Cleanup some include logic
* Properly mark hosts with failures in includes as failed
* Don't send callbacks until we're sure we're done, and also fix how
  we increment stats so failures don't show up as ok's
* Fix a bug in the include file logic where a failed include could lead
  to an infinite loop in the task iteration logic

Fixes #12933
2015-10-28 14:02:24 -04:00
56b310b18d Update submodule refs 2015-10-28 09:04:52 -07:00
3677a32bee Add changelog to the tarball 2015-10-28 07:57:04 -07:00
299054852a Allow tags to be specified in included file params
Fixes #12940
2015-10-28 10:14:20 -04:00
174de1161b fixed removing -n in password sudo tests 2015-10-28 02:36:28 -04:00
7c10c16251 Revert "capture some install issues and give out a slightly nicer error"
This reverts commit e6b1dc45e1.

This is not ready yet and it's causing failures in some environments
(travis)
2015-10-27 23:23:25 -07:00
b2fc5142eb moved sudo -S and -n into configurable flags as they might be absent in much older systems
if password is supplied exsiting -n would get remove from flags
2015-10-28 02:06:25 -04:00
2e05304f66 typo fix 2015-10-27 20:02:40 -04:00
5719912e7f added a skip for the test dir in module repos 2015-10-27 19:59:43 -04:00
e6b1dc45e1 capture some install issues and give out a slightly nicer error 2015-10-27 19:59:43 -04:00
46acf892d5 clarified ignore_errors 2015-10-27 19:59:43 -04:00
b0da4dd3b3 Merge pull request #12938 from Petrox/patch-1
Typo fix: invenotry to inventory
2015-10-27 19:35:25 -04:00
cad053af04 Typo fix: invenotry to inventory
Typo fix: invenotry to inventory :)
2015-10-27 22:54:14 +01:00
e3e2db1119 Improve the warning message about duplicate yaml dict keys 2015-10-27 14:20:36 -07:00
87269599a0 Also consider the full role name when searching for --start-at-task 2015-10-27 16:31:23 -04:00
1910f23144 Merge pull request #12801 from chrismeyersfsu/fix-test_destructive_init
run correct init system tests
2015-10-27 15:58:19 -04:00
acbea65b1d Update core submodule ref to fix doc build 2015-10-27 12:52:41 -07:00
9b22004540 Merge pull request #12795 from chrismeyersfsu/fix-test_destructive_mysql_user
remove module param quotes
2015-10-27 15:51:45 -04:00
2c5da0923a Update submodule refs 2015-10-27 12:50:24 -07:00
7334389de6 Merge pull request #12930 from ansible/dict-key-overwrite-warning
Break apart a looped dependency to show a warning when parsing playbooks
2015-10-27 12:44:01 -07:00
4203850d1a Break apart a looped dependency to show a warning when parsing playbooks
Display a warning when a dict key is overwritten by pyyaml
Fixes #12888
2015-10-27 12:39:42 -07:00
3fc2209ca0 Fixing retry/until logic and default value for retries
Fixes #12928
Fixes #12929
2015-10-27 15:37:48 -04:00
57fe0d6aed Merge pull request #12911 from bcoca/manpage_fixes
Manpage fixes
2015-10-27 14:48:38 -04:00
1dc23ea779 Merge pull request #12866 from bcoca/more_inheritence
More inheritence
2015-10-27 14:46:42 -04:00
cace91df56 Allow hostvars cache to be invalidated so hostvars contain all hosts after add_host
Fixes #12925
2015-10-27 14:12:17 -04:00
2825c188bd Merge pull request #12901 from bcoca/sanitize_results
sanatize results
2015-10-27 08:42:34 -04:00
1baa9831df Merge pull request #12918 from Dwaligon/devel
Fxing typo
2015-10-26 17:16:16 -04:00
9dfa3719be Fixing typo 2015-10-26 17:13:49 -04:00
7b0e68917c Fixing typo 2015-10-26 17:13:00 -04:00
ac9b35cc2b Found another typo 2015-10-26 17:04:28 -04:00
80433c2a2d Fxing typo 2015-10-26 17:01:30 -04:00
de54f26376 Update submodule refs 2015-10-26 13:13:11 -07:00
c271c0eb04 added setting of ansible_ssh_user to current user as backwards compatibilty issue 2015-10-26 16:10:13 -04:00
4486e136ea Merge pull request #12899 from bcoca/vault_fixes
simplified vault password functions
2015-10-26 14:14:17 -04:00
2b8633cec0 Merge pull request #12855 from bcoca/ec2_inv_dash_group
make - replacement in group names optional
2015-10-26 13:28:35 -04:00
0fd1d1691b Merge pull request #12886 from bcoca/doc_with_include
added docs for include with_items and usage of multiple lopo vars (item)
2015-10-26 13:27:09 -04:00
5b33b0ddfd Merge pull request #12896 from bcoca/ssh_current_user_config
don't set user to current user
2015-10-26 13:26:43 -04:00
cd9d6c8b5b Remove unused ca_file_path as it has not been hooked up to code for a long time (if ever) and is confusing people For instance, #12884 2015-10-26 10:24:17 -07:00
677a2f95e5 Make sure Base attributes are copied cleanly
Fixes #12882
2015-10-26 12:09:58 -04:00
8f77dd1cf2 Update submodule refs 2015-10-26 08:37:37 -07:00
8eda94c591 normalized descriptions for most man pages
also removed the intermediate man page
added intermidieate manpages to gitignore
2015-10-26 11:03:50 -04:00
f3a0adcfa5 added info about using -i 'hostname,' to usage/help 2015-10-26 11:03:15 -04:00
8dfefa2233 Remove GNU extension from xargs invocation
Fixes #12845
2015-10-26 07:16:21 -07:00
7ebfe72015 added missing string_types 2015-10-24 15:49:30 -04:00
8ce864db6f sanatize results 2015-10-24 15:23:12 -04:00
368f4448dc simplified vault password functions
also fixes #12864
2015-10-24 15:06:43 -04:00
92dd563a75 Fix invocation from bad merge and note where it would need to go to keep
it out of registered vars as well.
2015-10-24 07:29:42 -07:00
f78c82b9ee don't set user to current user
also remove condition to bypass setting user if user matches current user
this enables forcing user when set to the same user as current user and ignoring .ssh/config
while keeping .ssh/config with current user if nothing is specified.
2015-10-23 23:15:45 -04:00
25e3fe04a8 finalized changed to use abridtged_result instead of result
removed no longer defined no_log
2015-10-23 23:10:57 -04:00
b109b83809 Update submodule refs 2015-10-23 14:34:40 -07:00
1644eeb6be Merge pull request #12892 from ansible/synchronize-remote-to-itself
Potential fix for #12816
2015-10-23 13:45:03 -07:00
ca32d5bacc Potential fix for #12816 2015-10-23 13:38:44 -07:00
3eea4e23d5 Manually add plugin directories when running the adhoc command
Fixes #12891
2015-10-23 16:33:51 -04:00
3812ec8d1d Implement invocation hiding for all callbacks if the verbosity is low 2015-10-23 11:11:34 -07:00
275764d4a5 avoid showing invokation when no_log is set or verbosity is low 2015-10-23 14:06:20 -04:00
63ea614b4c Version bump for 2.0.0-0.4.beta2 2015-10-23 13:34:30 -04:00
99c6f77e59 Fix callback 2015-10-23 09:15:22 -07:00
08ca749c94 added deploy_helper 2015-10-23 11:50:20 -04:00
6637982deb added docs for include with_items and usage of multiple lopo vars (item) 2015-10-23 10:32:31 -04:00
be82e4c614 Merge pull request #10362 from emonty/fix-kwarg
Clean up OpenStack inventory to use a cleaner interface
2015-10-23 08:37:50 -04:00
ecae636160 allowing json in lookup template calls 2015-10-23 14:21:46 +02:00
4fd4f3374a Merge pull request #12879 from larsks/bug/12876
allow include: directive to work during exception processing
2015-10-22 22:15:32 -04:00
914f68f9af allow include: directive to work during exception processing
prior to this commit, an attempt to use the `include:` directive would
fail in a `rescue:` or `always:` block if there were failures in the
main block task list.

Resolves #12876.
2015-10-22 22:12:20 -04:00
ce2b18174e Merge pull request #12878 from ansible/invocation-fix
Invocation fix
2015-10-22 16:17:40 -07:00
2e87c1f74e Two fixes to action plugins
* Fix the task_vars parameter to not default to a mutable type (dict)
* Implement invocation in the base class's run() method have each action
  module call the run() method's implemention in the base class.
* Return values from the action plugins' run() method takes the return
  value from the base class run() method into account so that invocation
  makes its way to the output.

Fixes #12869
2015-10-22 16:07:26 -07:00
5017a96948 Revert "make callbacks declare needing whitelisting"
another premature merge
This reverts commit df8ff85787.
2015-10-22 16:34:51 -04:00
3c1c5b060c Revert "Add slack callback plugin"
premature merge
This reverts commit 8713b999da.
2015-10-22 16:29:01 -04:00
86de1429e5 Cleaning up FIXMEs 2015-10-22 16:03:50 -04:00
1e50d31cdc Update submodule refs 2015-10-22 10:14:31 -07:00
43c1d0046b added ecs modules to changelog 2015-10-22 12:30:23 -04:00
8713b999da Add slack callback plugin 2015-10-22 12:30:23 -04:00
df8ff85787 make callbacks declare needing whitelisting
this will allow for custom or v1 callbacks locally loaded to automatically be triggered as they were in 1.x
2015-10-22 12:30:23 -04:00
75cff7129c Fix for invocation not being added to output.
We want invocation to be omitted when we are running async, not when we
aren't running async.
2015-10-22 09:03:35 -07:00
ed6aa75d63 Add parsing test to travis to catch that invocation is missing 2015-10-22 09:03:12 -07:00
6b6d03290a Restore the automatic addition of invocation to the output
Revert "Remove auto-added invocation return value as it is not used by v2 and could leak sensitive data."

This reverts commit 6ce6b20268.

Remove the note that invocation was removed as we've now restored it.

Revert "keyword not in ubuntu 14.04"

This reverts commit 5c01622457.

Revert "remove invocation keyword check"

This reverts commit 5177cb3f74.
2015-10-22 08:53:37 -07:00
498c27d09a Re-adding role_names magic variable
Fixes #12863
2015-10-22 11:06:47 -04:00
404ded2b03 Merge pull request #12868 from docschick/docschick-fixes
variables precedence reordering and added para …
2015-10-22 09:27:09 -04:00
bc14ed380e variables precedence reordering and added para to help explain precedence rules 2015-10-22 09:12:43 -04:00
c267c23020 make callbacks declare needing whitelisting
this will allow for custom or v1 callbacks locally loaded to automatically be triggered as they were in 1.x
2015-10-22 08:27:32 -04:00
54e821ca94 added deprecation warning to comma separated role spec 2015-10-22 08:10:51 -04:00
09899b7c43 Merge pull request #12783 from larsks/bug/12782
correct value of remote_user for local connections
2015-10-22 08:10:07 -04:00
9886829e40 Merge pull request #12861 from willthames/galaxy_spec_in_meta_main_fix
Allow meta/main.yml to include roles through spec file
2015-10-22 08:01:02 -04:00
d861e7dd5d moved several directives so they are not settable at play, block, role and task levels 2015-10-22 07:51:22 -04:00
fc3a44485b skip errors on conditional if task is include
fixes #12843
2015-10-22 07:50:43 -04:00
cc41354733 Merge pull request #12865 from aidanhs/aphs-document-env-vars-play
Document setting environment variables in a playbook
2015-10-22 07:18:14 -04:00
9f8c4d716a Document setting environment variables in a playbook 2015-10-22 12:07:54 +01:00
002972c6cf Allow meta/main.yml to include roles through spec file
ansible-playbook now works when run with a playbook
that includes a role that includes another role
specified using csv format

Updated one of the roles used in the tests to fix
broken tests - `make test_galaxy` now works

Fixes #11486. Also addresses the problem alluded to in #10620.
2015-10-22 13:30:42 +10:00
08c9e70307 made display part of variable manager and corrected reference to it
fixes #12859
2015-10-21 22:29:27 -04:00
aac20aa076 removed unused exception vars 2015-10-21 22:29:27 -04:00
2b3c5aa41e Support cmd param in Tasks by assigning it to _raw_params
Fixes #12856
2015-10-21 15:47:09 -04:00
5a0e63af1e Workaround seeming bug in python-2.6's sys.exit() 2015-10-21 11:54:02 -07:00
c642fe4b84 Merge branch 'mathieumd-devel' into devel 2015-10-21 14:04:57 -04:00
0e447e3f41 Merge branch 'devel' of https://github.com/mathieumd/ansible into mathieumd-devel 2015-10-21 13:59:51 -04:00
4b20884719 Return correct changed flag when using check mode with template and force=no
Fixes #12844
2015-10-21 13:51:39 -04:00
07d584c0a7 make - replacement in group names optional 2015-10-21 13:18:32 -04:00
04aa7701d1 fix prompt, static methods don't get 'self'
fixes #12833
2015-10-21 12:06:29 -04:00
42ce3de8d0 Merge pull request #12853 from ansible/winrm-return-bytes
In v2, exec_command should return bytes and the caller will take responsibility for converting to unicode
2015-10-21 08:42:54 -07:00
3d57a202b5 And another fix for docs 2015-10-21 08:40:30 -07:00
9dc9a606f6 Correct docs build 2015-10-21 08:36:21 -07:00
632d356d22 Update submodule refs 2015-10-21 08:31:58 -07:00
6e5055e786 Update the use of no_log values to cover everything that heuristic_log_sanitize does.
Fixes #12792
2015-10-21 08:15:46 -07:00
ec56b29ba4 Fix setting of interpreter values for delegated hosts
Fixes #12772
2015-10-21 11:05:45 -04:00
c845181dc1 In v2, exec_command should return bytes and the caller will take responsibility for converting to unicode 2015-10-21 07:59:46 -07:00
63a1416754 Merge pull request #12849 from bborysenko/docsite/handlers_order
Fix order of handlers that were notified in different sections
2015-10-21 10:09:38 -04:00
6c265cde49 invoke systemd test for ubuntu >= 15.04 else invoke upstart test 2015-10-21 09:15:27 -04:00
126276ce6c Fix order of handlers that were notified in different sections 2015-10-21 11:00:47 +03:00
6b419db9fa Merge pull request #12847 from godfreyduke/devel
Remove mutable default arguments.
2015-10-20 23:25:49 -07:00
744679601f Remove mutable default arguments. 2015-10-20 22:13:23 -07:00
10e2fc6f60 Update submodule ref 2015-10-20 15:37:50 -07:00
1126ce34e3 Merge pull request #12846 from ansible/nolog-for-return-value
Hide values in json returns which were given in parameters marked no_log.
2015-10-20 15:28:16 -07:00
cac00add8d Update to final shade inventory interface
shade has an inventory interface that is cleaner. We should use it.
2015-10-21 06:13:50 +09:00
c2d188baff Hide values in json returns which were given in parameters marked no_log. 2015-10-20 12:42:36 -07:00
3ddda2f460 Merge pull request #12842 from mcsalgado/include_with_items
Revert back to copying self._task.args
2015-10-20 15:33:34 -04:00
1ecad5aed2 now galaxy correctly detects empty requirements file
also allow for 'scm' and 'src' not to be populated in requirements entries
2015-10-20 14:39:22 -04:00
c5c5f3bf7a Revert back to copying self._task.args 2015-10-20 16:21:25 -02:00
0e671baa33 Fix typo 2015-10-20 16:18:01 -02:00
b46ce47a84 Don't use local transport for delegated hosts if the inventory_hostname isn't local
For some situations like Vagrant, the remote_addr may be a localhost addr, but ssh
is still desired. This corrects the assumption that any localhost remote_addr should
be using the local connection by checking the inventory_hostname value as well.

Fixes #12817
2015-10-20 14:04:39 -04:00
99e7bb35c1 Simplify UnsafeProxy as we don't need to use it for byte strings, only text 2015-10-20 10:57:23 -07:00
3c87c44af5 Fixing bug in includes caused by 892d9b8
Fixes #12837
2015-10-20 13:49:52 -04:00
31ebafcbdd Update submodule refs 2015-10-20 09:22:58 -07:00
35eff100f7 Merge pull request #12839 from zemanel/patch-1
Fixed docs typo
2015-10-20 12:01:49 -04:00
25e4a3ad2a Fixed docs typo 2015-10-20 16:38:16 +01:00
02c8b13cc6 Merge pull request #12835 from zarnovican/remove_yum_pkg
DOC: in yum examples, 'pkg' arg renamed to 'name'
2015-10-20 08:48:51 -04:00
84967e282a DOC: in yum examples, 'pkg' arg renamed to 'name'
* alternating both pkg/name in examples might be confusing
* even if pkg= is working, it is not documented in
  module's refrence guide
2015-10-20 13:49:04 +02:00
a22cf8ffc1 Properly add the new test and limit six test to lib 2015-10-19 18:39:15 -07:00
f34b55ac2b Add python3-compat boilerplate to all .py files in lib/ansible 2015-10-19 18:36:19 -07:00
de3ca57a33 avoid relative shlex import
fixes #12777
2015-10-19 19:55:22 -04:00
e5b6d802bf Removing some cruft related to _local_action value on Task, which was removed
Fixes #12819
2015-10-19 16:52:27 -04:00
260a3e5ce7 Fixes #11055 - Set locale via LC_ALL 2015-10-19 21:25:30 +02:00
923fc9fb15 Cleanup pyflakes warning (real error) 2015-10-19 12:01:01 -07:00
7aa9f6754a Cleanup more pyflakes warnings (2 real problems) 2015-10-19 12:01:01 -07:00
1fa975d81a Simplify group_by by removing BYPASS_HOST_LOOP from the action
Fixes #12825
2015-10-19 14:57:07 -04:00
0888d78b84 Cleanup some pyflakes warning (1 real error) 2015-10-19 11:42:46 -07:00
c6d44738ad Clean up some more pyflakes warnings 2015-10-19 11:35:10 -07:00
3da8bab3ff Cleanup pyflakes warning (real error) 2015-10-19 11:29:51 -07:00
a526eae543 Clean up a few more pyflakes warnings 2015-10-19 11:20:21 -07:00
a17ae6f07e Clean up pyflakes warnings in inventory 2015-10-19 11:13:56 -07:00
63add130d4 Tox seems to not like the subsitution key for some reason 2015-10-19 11:04:30 -07:00
892d9b8dfb Move post_validate for tasks after checking for an include
Simplifies logic and prevents us from accidentally post_validating
an include that would otherwise be skipped due to tags causing a
problem because of potentially missing variables.

Fixes #12793
2015-10-19 13:42:17 -04:00
1cfd941179 Adding a v2 callback for task includes 2015-10-19 13:42:17 -04:00
dc33d30c6d Update submodule refs 2015-10-19 10:25:36 -07:00
f864fa8727 run systemd tests for fedora 2015-10-19 13:21:34 -04:00
b67e51ea06 Information on when to use to_str() and what a native string is 2015-10-19 09:28:43 -07:00
f99341f05e Note removal of invocation 2015-10-19 09:17:39 -07:00
39d9bc3564 Update submodule refs 2015-10-19 09:09:07 -07:00
6ce6b20268 Remove auto-added invocation return value as it is not used by v2 and could leak sensitive data. 2015-10-19 09:08:25 -07:00
931792fc89 Merge pull request #12828 from resmo/changelog
changelog: add cs_loadbalancer_rule_member
2015-10-19 12:05:09 -04:00
67080e1251 changelog: add cs_loadbalancer_rule_member 2015-10-19 17:47:30 +02:00
afde1143e7 added cs_loadbalancer_rule to changelog 2015-10-19 11:47:15 -04:00
c1a404e6ec Merge pull request #12799 from resmo/for-ansible
cloudstack: add tests for cs_loadbalancer_rule and _member
2015-10-19 11:15:12 -04:00
210ee75a27 Merge pull request #12820 from mgedmin/py3k
Simplify tox.ini, remove outdated comment
2015-10-19 11:09:50 -04:00
43fe74f0fe Simplify tox.ini, remove outdated comment 2015-10-19 09:43:27 +03:00
1280e2296c changed warning to debug and expanded info on what is really happening, it was a bit misleading 2015-10-18 11:00:50 -04:00
2d1d21228a updated skippy to match default output 2015-10-18 11:00:50 -04:00
2346a7f170 Merge pull request #12800 from chrismeyersfsu/fix-test_destructive_yum
remove invocation keyword check
2015-10-18 10:19:08 -04:00
5081f52a64 Merge pull request #12803 from mscherer/patch-2
Correct small error in changelog (s/inhertited/inherited/)
2015-10-18 10:18:49 -04:00
549bdb2503 Merge pull request #12804 from chrismeyersfsu/fix-test_non_destructive_makefile
allow env variable override of creds file
2015-10-18 10:18:22 -04:00
0bbe9d5bd0 Make hostvars json/yaml serializable in filters
Fixes #12615
2015-10-18 10:09:05 -04:00
22cbfacab0 Merge pull request #12802 from alflanagan/patch-1
Update README.md (clarify release naming)
2015-10-17 18:14:33 -04:00
1b2d17b844 allow env variable override of creds file
This is important because there is an integration test, test_git, that
require an ssh key to clone a privileged github repo.
2015-10-17 12:45:29 -04:00
a88c59f451 Reset basedir for plays that are not from a PlaybookInclude
Fixes #12524 (again)
2015-10-17 12:44:28 -04:00
0aa018337a Fixing logic in json cache plugin get()
Fixes #12722
2015-10-17 11:50:14 -04:00
5f617c601b Remove obsolute tag evaluation in free strategy
Fixes #12784
2015-10-17 11:29:39 -04:00
8baea3cba8 Merge pull request #12796 from chrismeyersfsu/fix-test_destructive_mysql_variables
fix up mysql variable assertion logic
2015-10-17 10:14:08 -04:00
fea1d64b00 Correct small error in changelog 2015-10-17 15:41:48 +02:00
6cba303035 Update README.md
Clarify release naming policy pre-2.0.
2015-10-17 09:38:35 -04:00
d6dfd9f502 run correct init system tests 2015-10-17 09:25:49 -04:00
5177cb3f74 remove invocation keyword check 2015-10-17 09:24:03 -04:00
bb5dcc00b6 cloudstack: add tests for cs_loadbalancer_rule and _member 2015-10-17 14:01:02 +02:00
450c8d45c6 Merge pull request #12787 from chrismeyersfsu/fix-test_destructive_apt
keyword not in ubuntu 14.04
2015-10-17 07:43:34 -04:00
a10c5ca5f5 updated with remainding clc_ plugins 2015-10-16 19:25:26 -04:00
75833c248e fix up mysql variable assertion logic 2015-10-16 18:42:03 -04:00
ce4e98a6d0 remove module param quotes 2015-10-16 18:39:02 -04:00
6c8cf8acb7 now profile_tasks callback handles handlers correctly
fixes #12762
2015-10-16 18:01:27 -04:00
8effa23ad7 Add unicode integration tests to be run in travis 2015-10-16 13:00:08 -07:00
eebd3cc336 Merge pull request #12788 from chrismeyersfsu/fix-test_destructive_state
remove non-existant state var
2015-10-16 12:43:40 -07:00
a0264983ad remove non-existant state var 2015-10-16 15:40:31 -04:00
5c01622457 keyword not in ubuntu 14.04 2015-10-16 15:37:39 -04:00
1ab0e0e228 Disable RuntimeWarnings during all() plugin loading
Fixes #12778
2015-10-16 15:34:49 -04:00
71ffb86c30 don't let cowsay issues stop execution
fixes #12773
2015-10-16 15:20:59 -04:00
6d87bd405d Merge pull request #12765 from bcoca/lookup_inventory_hostname
implemented inventory_hostname lookup in v2
2015-10-16 15:05:23 -04:00
a567f28657 Update submodules for docs fixes# Please enter the commit message for your changes. Lines starting 2015-10-16 11:12:21 -07:00
49f2b84253 Add a code smell test to make sure we're not using the raw system six
(So we know we have a recent enough version)
2015-10-16 10:31:35 -07:00
5d8ab9b01b Update module refs 2015-10-16 10:05:57 -07:00
b23a083776 Make vault use a mapping of cipher name to classes instead of formatting the name for safety. 2015-10-16 10:05:27 -07:00
14c80b8a04 Merge pull request #12769 from ansible/six-compat
Bundle a new version of python-six for compatibility along with some …
2015-10-16 08:57:08 -07:00
baa309309d Bundle a new version of python-six for compatibility along with some code to make it easy for distributions to override the bunndled copy if they have a new enough version. 2015-10-16 08:21:28 -07:00
aa0b7536c9 correct value of remote_user for local connections
When using 'local' connections, privilege escalation would fail if
ansible_ssh_user was in the current context to the same value as
become_user.

This commit ensures that for 'local' connections we reset remote_user to
the local username.

This fixes #12782.
2015-10-16 11:17:58 -04:00
28c933ce5e properly fail_json when we don't have ssl on a non-redhat distro 2015-10-16 08:06:32 -07:00
4b4168bc92 Merge pull request #12781 from mgedmin/py3k
Python 3: print function in a shell oneliner in Makefile
2015-10-16 07:46:33 -07:00
04a7ef416e Python 3: print function in a shell oneliner in Makefile
Fixes

    File "<string>", line 1
      import string,random; print 'ansible-testing-' + ''.join(random.choice(string.ascii_letters + string.digits) for _ in xrange(8));
                                                   ^
  SyntaxError: invalid syntax

when running integration tests with

  . hacking/env-setup
  . .tox/py35/bin/activate
  make -C test/integration test_var_precedence
2015-10-16 17:41:01 +03:00
38b99a7a4d Merge pull request #12780 from mgedmin/py3k
Python 3: avoid %-formatting of byte strings
2015-10-16 07:40:10 -07:00
98958ec990 Simplify join expression 2015-10-16 17:39:27 +03:00
bd83410bdb Enable unit tests on Python 3.4 in tox and Travis
These now pass \o/
2015-10-16 17:19:26 +03:00
56184a3d8c Python 3: avoid %-formatting of byte strings
This is needed for Python 3.4 compatibility; Python 3.5 can use
`b'%s\n' bytestring` again.
2015-10-16 17:18:35 +03:00
89b0c3f6c4 Merge pull request #12775 from mgedmin/py3k
Python 3: fix vault tests
2015-10-15 23:44:01 -07:00
a412b27604 Enable unit tests on Python 3.5
This enables the tests in tox and in Travis.  This ought to prevent
regressions in Python 3 support.

Note that Python 3.4 isn't supported (yet) because the vault code relies on
%-formatting of byte strings, a feature that was ripped out of Python 3.0
and restored in 3.5.

Also note that passing tests don't mean that Ansible itself can already
be used with Python 3.5: test coverage is only 53%.
2015-10-16 09:14:36 +03:00
ec3ada1cda Fix test on Python 3: vault code expects bytes
(All tests now succeed on Python 3.5)
2015-10-16 09:13:46 +03:00
5c70f932bd Fix test on Python 3: vault code expects bytes
(Third failing test out of four.)
2015-10-16 09:12:49 +03:00
a1d95536f9 Fix test on Python 3: vault code expects bytes
(Different test than the last commit.)
2015-10-16 09:11:34 +03:00
f58f0c62e1 Fix test on Python 3: vault code expects bytes 2015-10-16 09:10:25 +03:00
174ecb843c Merge pull request #12770 from aslant/devel
Fix typo: comma not colon separates groups in patterns
2015-10-15 23:55:43 -04:00
17469d0781 Fix typo: comma not colon separates groups in patterns 2015-10-16 04:30:46 +01:00
4b60c2ec3b added taiga_issue to changelog 2015-10-15 19:47:53 -04:00
b1dfa94623 Merge pull request #12767 from ryansb/raw_install_python2
Document using the `raw` module to install a py2.X and simplejson
2015-10-15 15:16:20 -04:00
48e1396496 Add -y to yum command, otherwise it would hang indefinitely 2015-10-15 13:55:53 -04:00
9dcde77e0e Document using the raw module to install a py2.X and simplejson
In the installation guide, the raw module is mentioned as an option for
installing Python or simplejson on managed nodes that don't have them.
This change adds an example for users that may already be familiar with
using ansible but are checking install docs because they don't know the
requirements for managed nodes, or are using a distribution that doesn't
include Python 2 by default.
2015-10-15 13:35:07 -04:00
9b088a1e40 implemented inventory_hostname lookup in v2 2015-10-15 13:11:42 -04:00
aee6de5a76 group_names should not include implied 'all', fixes #12763 2015-10-15 11:46:43 -04:00
68121b7990 added iptables to changelog 2015-10-15 11:00:01 -04:00
66c02c119a added os_subnets_facts to changelog 2015-10-15 11:00:01 -04:00
31c3f59704 added os_port to changelog 2015-10-15 11:00:01 -04:00
40677ca4d2 added win_acl to changelog 2015-10-15 11:00:01 -04:00
dce58a78c9 Make random cowsay truly random
Also adds a cowsay whitelist config option, because there are some
truly NSFW stencils that come with cowsay by default.
2015-10-15 10:52:53 -04:00
ce0cedc4a7 Merge pull request #12764 from docschick/docschick-fixes
vault and variables best practices info added, edited, and referenced
2015-10-15 10:01:06 -04:00
8501a46baa vault and variables best practices info added, edited, and referenced
This work fulfills PR #11799. Moved the content out of the vault file,
into best practices, edited it, then referenced it from variables and
vaults content files.
2015-10-15 09:55:17 -04:00
fed7cea795 Merge pull request #12758 from mgedmin/fix-os-import
Fix Unexpected Exception: global name 'os' is not defined
2015-10-15 07:51:23 -04:00
4fb6f62f1b Fix Unexpected Exception: global name 'os' is not defined
I inadvertently introduced it in
ca826508d9 and didn't notice, because
there are no unit tests for playbook_executor.py.  Sorry!

(The "from ansible.errors import *" was used *only* to get the 'os'
module, which makes go "what?")
2015-10-15 10:41:00 +03:00
0526b43b5f Merge pull request #12757 from mgedmin/py3k
Python 3: fix AnsibleError formatting
2015-10-15 00:29:36 -07:00
ab569cea22 Move to_str alias into ansible.utils.unicode
@abadger suggested on IRC that it's useful enough to go into
ansible.utils.unicode.
2015-10-15 10:27:38 +03:00
d0ecceeacb Merge pull request #12707 from mgedmin/travis
Run Travis integration tests with the right Python version
2015-10-15 00:15:42 -07:00
ca826508d9 Python 3: fix AnsibleError formatting
If you convert the error string to bytes and embed it inside another
error string, you get

  Prefix:

  b'Embedded\nerror\nstring'

which is not what we want.

But we also don't want Unicode in error messages causing unexpected
UnicodeEncodeErrors when on Python 2.

So let's convert the error message into the native string type (bytes on
Python 2, unicode on Python 3).
2015-10-15 09:38:14 +03:00
5617f6aad4 Update synchronize to use the correct host when delegating
Fixes #12752
2015-10-14 18:57:10 -07:00
85abd61001 Add some more info to docstring 2015-10-14 18:57:10 -07:00
d923d05a33 Reworking the way all() works in plugin_loader
* Don't throw away the full path of the module code being loaded,
  as this can cause conflicts when files of the same name are being
  instantiated
* Generalize the module loading code

Fixes #12738
2015-10-14 17:53:28 -04:00
45b803efb4 Properly use test_loader from SharedPluginLoaderObj 2015-10-14 17:53:28 -04:00
cb9f350c8f Merge pull request #12720 from jhawkesworth/test_amc_2147
integration tests for ansible modules core 2147
2015-10-14 15:35:21 -04:00
8c29910587 Merge pull request #12751 from jdelaporte/patch-1
Fix links to dynamic inventory script example.
2015-10-14 10:18:31 -07:00
c2a5381438 Fix links to dynamic inventory script example.
:doc`aws_example` no longer existed.
2015-10-14 12:17:05 -05:00
bafcd7becd Merge pull request #12747 from docschick/docschick-fixes
reordering entries in glossary for alphabetical order
2015-10-14 09:08:32 -07:00
c8ad55103e Update extras modules ref to fix docs 2015-10-14 08:44:37 -07:00
1918604e72 reordering entries in glossary for alphabetical order 2015-10-14 11:37:27 -04:00
faca6e9dfe Add dnf rewrite to changelog 2015-10-14 08:12:31 -07:00
e00eeba9c3 Update submodule refs 2015-10-14 08:06:55 -07:00
91b0b4d40c Check is_directory() before not is_file() in inventory basedir
Fixes #12742
2015-10-14 11:03:10 -04:00
c57200925f made syslog import optional as intel's edison custom compiles python w/o it 2015-10-14 09:12:02 -04:00
2963bba901 Merge pull request #12740 from mgedmin/py3k
Python 3: don't convert module arguments to bytes
2015-10-14 00:36:19 -07:00
225fe85530 Skip test_module_utils_basic_ansible_module_creation on Python 3
This reverts commit 073f10a52a and instead
disables the failing test.

We're focusing on Python 3 support on the controller first; modules will
come later.
2015-10-14 09:32:26 +03:00
073f10a52a Python 3: don't convert module arguments to bytes
Fixes a test failure:

    ======================================================================
    ERROR: test_module_utils_basic_ansible_module_creation (units.module_utils.test_basic.TestModuleUtilsBasic)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/home/mg/src/ansible/test/units/module_utils/test_basic.py", line 250, in test_module_utils_basic_ansible_module_creation
        supports_check_mode=True,
      File "/home/mg/src/ansible/lib/ansible/module_utils/basic.py", line 470, in __init__
        self._check_required_arguments()
      File "/home/mg/src/ansible/lib/ansible/module_utils/basic.py", line 1050, in _check_required_arguments
        self.fail_json(msg="missing required arguments: %s" % ",".join(missing))
      File "/home/mg/src/ansible/lib/ansible/module_utils/basic.py", line 1445, in fail_json
        sys.exit(1)
    SystemExit: 1
    -------------------- >> begin captured stdout << ---------------------
    {"msg": "missing required arguments: foo", "failed": true}

because converting 'foo' to bytes yields b'foo' on Python 3, which
doesn't match the native-unicode 'foo' argument spec.
2015-10-14 08:43:26 +03:00
ee559e03f7 Merge pull request #12725 from mgedmin/py3k
Python 3: there's no basestring
2015-10-13 16:52:46 -04:00
3f2efddeb2 Merge pull request #12733 from docschick/ansible_ssh_docswork
added "include" for ansible_ssh_ change to another section
2015-10-13 11:22:31 -07:00
7dfce28e9a added "include" for ansible_ssh_ change note to another section of intro_inventory.rst for clarity 2015-10-13 13:59:44 -04:00
e6d3c6745f Revert to using local file/dir tests in inventory instead of loader's
Fixes #12719
2015-10-13 12:04:01 -04:00
c637d60a8d fixed deprecation message 2015-10-13 11:40:21 -04:00
f5227d494b added missing cachefile and changed str(e) to to_bytes(e) 2015-10-13 11:15:10 -04:00
3a0bf55ae3 better error catching for doc build 2015-10-13 11:14:28 -04:00
76c8318351 Merge pull request #12688 from docschick/ansible_ssh_docswork
Ansible ssh changes docswork
2015-10-13 07:59:49 -04:00
9ba6c087d3 Python 3: there's no basestring 2015-10-13 09:56:12 +03:00
3cae8a4394 Merge pull request #12724 from mgedmin/py3k
Python 3: there's no iteritems()
2015-10-13 02:49:49 -04:00
f03da5be42 Python 3: there's no iteritems() 2015-10-13 09:47:16 +03:00
2d77c643e4 Merge pull request #12723 from mgedmin/py3k
Make ansible.vars.unsafe_proxy Python 3 friendly
2015-10-13 02:45:55 -04:00
e511d6d458 Make UnsafeProxy work on Python 3
Instead of str and unicode we have to deal with bytes and str.
2015-10-13 09:41:08 +03:00
af6a316d9b Remove unused import
Fixes ImportError: No module named '__builtin__' on Python 3.
2015-10-13 09:37:48 +03:00
426187489f Add variable for format parameter 2015-10-13 02:33:18 -04:00
9802c006a2 Typo: TOKENV -> TOXENV
This is purely cosmetic: the logic worked correctly, since tox never saw
the TOKENV environment variable.
2015-10-13 09:17:57 +03:00
=
e141101314 integration tests for ansible modules core 2147 2015-10-13 06:34:18 +01:00
8277747a04 Fix password lookup when password file exists and the password is not encrypted 2015-10-12 15:52:03 -07:00
cd2cb178ae Totally rework the way UnsafeProxy does things 2015-10-12 18:13:09 -04:00
723dcba486 Merge pull request #12614 from ansible/py3-module_utils-log
AnsibleModules.log() fix for python3
2015-10-12 13:36:28 -07:00
15d7f53846 AnsibleModules.log() fix for python3
Also add unittests for AnsibleModules.log()

Fixes #12586
2015-10-12 13:30:27 -07:00
b49e0995cb Fix typo 2015-10-12 13:29:04 -07:00
b58d7470d4 Cleanup logic and be more paranoid about passwords with spaces 2015-10-12 12:55:33 -07:00
5c5806d669 Fixing bugs related to jfonfile cache plugin
* corrupt/invalid file causes tracebacks
* incorrect initialization of display/_display in BaseCacheModule class
* tweaking the way errors in get() on jsonfile caches work, to raise
  a proper AnsibleError in that situation so the playbook/task is stopped

Fixes #12708
2015-10-12 13:06:41 -04:00
b441bcb678 Fix display when run through a testing framework that overrides stderr/stdout 2015-10-12 10:06:13 -07:00
d15fcf05f0 Fix bug in the way temp vars were created for templating vars_files
Fixes #12711
2015-10-12 12:17:45 -04:00
32cb2fa215 removed repetition of note and replaced with an include directive
ansible_ssh_* changes from 1.9 to 2.0, original note made into a separate file
for easier editing, and an include for this new file added to each of the 6 file affected
by this change
2015-10-12 11:41:09 -04:00
2c24fbbd6a Merge pull request #12618 from AdThrive/devel
Added an option to use the private network IP address for DigitalOcean dynamic inventory
2015-10-12 11:35:43 -04:00
f5f3bf06e4 Merge pull request #12550 from redrampage/remove-pw-salt-deletion
Removed deletion of salt by 'password' lookup
2015-10-12 11:33:19 -04:00
73661d1761 Merge branch 'devel' of https://github.com/ansible/ansible into devel 2015-10-12 11:30:03 -04:00
424b623c5d Merge branch 'klshxsh-serial_should_be_string' into devel 2015-10-12 11:29:29 -04:00
0e1a5919c8 Adding unit tests for PlaybookExecutor _get_serialized_batches 2015-10-12 11:27:37 -04:00
3d533cb423 fixing calls to fail_json 2015-10-12 08:50:18 -05:00
50372eecc9 Merge pull request #12455 from privateip/devel
added methods for retrieving vapp and vm
2015-10-12 09:37:47 -04:00
82e76e42e5 Tweak to the way serial percentages are handled 2015-10-12 09:00:43 -04:00
63e288354e Fix bug in way omitted values were set 2015-10-12 09:00:27 -04:00
4c85ae0712 Merge branch 'serial_should_be_string' of https://github.com/klshxsh/ansible into klshxsh-serial_should_be_string 2015-10-12 08:28:07 -04:00
748ff72b6b fixed typo, depricated --> deprecated, in all 6 notes 2015-10-12 08:01:24 -04:00
ac00c9ced7 changed 'string' to 'percent' for _serial
Note that this allows both integers (e.g. 3) and percentages (e.g. "30%")
Also changed default back to 0 rather than '0'
2015-10-12 12:41:00 +01:00
43a65c7de4 Revert "Can we even ask for Python 2.4 on Travis?"
Becaue we can't: https://travis-ci.org/mgedmin/ansible/jobs/84866458

This reverts commit e31e866e79.
2015-10-12 09:30:37 +03:00
e31e866e79 Can we even ask for Python 2.4 on Travis? 2015-10-12 09:29:34 +03:00
29202454c6 Run Travis integration tests with the right Python version 2015-10-12 09:27:18 +03:00
eb60ce1b6e Merge pull request #12703 from keitwb/inventory_file_var
Adding the inventory_file var back
2015-10-11 16:04:34 -04:00
71a1a3c903 Submodule pointer update 2015-10-10 22:31:54 -04:00
1f82971283 Adding the inventory_file var back 2015-10-10 21:54:28 -04:00
6292520c45 Merge pull request #12444 from knakayama/bugfix/update-docs
Update docs (playbooks_loops.rst, playbooks_filters.rst)
2015-10-09 20:09:53 -07:00
297aaeac2d Backporting version release stuff from stable-1.9 2015-10-09 22:39:59 -04:00
d660381f98 Merge pull request #12450 from glnds/devel
Installation update for people using Fishshell
2015-10-09 19:39:30 -07:00
45a161b0a1 Merge pull request #12429 from edmstudio/devel
Update synchronize module plugin to work on OS X
2015-10-09 16:05:46 -07:00
6e035a3e94 Move nested function test for ipv6 to top level in synchronize module. 2015-10-10 00:01:22 +02:00
676e4232e3 Merge pull request #12438 from lekum/doc_shelvefile_lookup
Update lookups doc with shelvefile example
2015-10-09 14:34:51 -07:00
45788fbfad <homer>doh!</homer> 2015-10-09 16:58:01 -04:00
d24532757c remove fix for local_action/connection local that is now not needed 2015-10-09 16:53:17 -04:00
4a5e52b2d2 The serial keyword can be specified as a percentage, e.g '30%' or a number e.g. '3'; therefore it needs to be a string to allow both types 2015-10-09 21:34:37 +01:00
17c75df0ae Merge pull request #12627 from mgedmin/tox
Add Python 3.5 to tox.ini and Travis
2015-10-09 11:42:34 -07:00
b9d54e9a01 corrects previous fix to deal with missing item key in results dict 2015-10-09 13:01:32 -04:00
abf2e13955 Revert "Track local_action internally to prevent it from being overridden"
This reverts commit 49ca0eb797.
2015-10-09 13:01:32 -04:00
101c8785ec removed changes to make local action equate connection=local and brought it back to equate delegate_to=localhost 2015-10-09 13:01:32 -04:00
bcb173996b Merge pull request #12695 from matburt/fix_cache_plugins_for_v2
Fix an issue where cache plugins weren't updated in certain scenarios
2015-10-09 11:39:58 -04:00
fbf4cafab5 on skipped you 'might' not have an item, changed to getattr to avoid keyerror
fixes #12683
2015-10-09 11:28:11 -04:00
7da478a4f4 Fix an issue where cache plugins weren't updated
The first call to persisting facts would work due to the assignment of a
MutableMapping calling __setitem__ but subsequent module fact data would
not be propogated to the fact cache plugins because update() doesn't
invoke __setitem__.  This changes the behavior a little bit and ensures
set() is called on cache plugins.
2015-10-09 11:16:41 -04:00
ec02b255c3 Merge pull request #12689 from soarpenguin/bugfix
Remove some warning of undefined name and fix classmethod syntax error.
2015-10-09 11:09:50 -04:00
770032648a Show -> localhost for local_action tasks 2015-10-09 10:53:53 -04:00
f415d39dfd Merge pull request #12690 from stelligent/devel
Use AWS_DEFAULT_REGION env var if none specified
2015-10-09 10:02:48 -04:00
cfa62e7a2a Submodule pointer update 2015-10-09 09:50:16 -04:00
868819f9fa Make sure shlex split is returning properly encoded strings
Fixes #12676
2015-10-09 09:49:27 -04:00
55b3f9e4e5 Use AWS_DEFAULT_REGION env var if none specified 2015-10-09 10:27:36 +02:00
b11ea17385 fix classmethod syntax error. 2015-10-09 12:46:31 +08:00
5efa4d29e3 fix some warning of undefined name. 2015-10-09 12:43:42 +08:00
84240c9f28 fixed git conflict with double para 2015-10-08 21:44:50 -04:00
f24fbb04c9 note modified a bit, then reviewed/approved by jmartin
Ansible 2.0 has depricated the “ssh” from ansible_ssh_user,
ansible_ssh_host, and ansible_ssh_port to become ansible_user,
ansible_host, and ansible_port. If you are using a version of
Ansible prior to 2.0, you should continue using the older style
variables (ansible_ssh_*). These shorter variables are ignored,
without warning, in older versions of Ansible.
2015-10-08 21:41:27 -04:00
6af2b2a4cb added note about ansible_ssh_* change
added a note like the following to each file hit with unlabled 2.0 changes...
Ansible 2.0 moved away from using ansible_ssh_* variables to accepting
ansible_* variables. If you are using a version of Ansible prior to 2.0,
you should continue using the older style variables (ansible_ssh_*), such
as ansible_ssh_user instead of ansible_user and ansible_ssh_port instead of
ansible_port, which appear in the following content. These shorter variables
are ignored, without warning, in older versions of Ansible.
2015-10-08 21:39:26 -04:00
59d655c543 Double echo temp directory name to handle spaces and ~ expansion both
Fixes #12667
2015-10-08 16:22:38 -04:00
d1b98ec776 Correct typo 2015-10-08 08:44:25 -07:00
2f5e817007 Do not mix byte str with unicode type 2015-10-08 08:31:12 -07:00
01ba2e94c0 Wait until later to convert to byte strings for output
Also some pre-emptive python3 compat and a code simplification
2015-10-08 08:22:17 -07:00
76feba00c4 avoid callbacks during syntax check and listing
fixes #12682
2015-10-08 10:15:48 -04:00
4463ced8ba simpler safe output 2015-10-08 10:15:48 -04:00
de792ba3c2 Improve handling of unicode errors
Fixes #12669
2015-10-08 10:04:15 -04:00
5a0f5f1254 Load vars for localhost when created implicitly
Fixes #12666
2015-10-08 09:26:20 -04:00
8f18e6574e Merge pull request #12679 from yfix/devel
zabbix.py: Added additional ini file search path
2015-10-08 08:02:14 -04:00
cf7763ab46 Merge pull request #1 from ansible/devel
update from origin
2015-10-08 11:46:01 +03:00
a2422bfb60 Added additional ini file search path into contrib/inventory/zabbix.py 2015-10-08 11:44:27 +03:00
ae69409d9c added openstack fact modules 2015-10-07 21:38:11 -04:00
27e5271cdf Added bigip_gtm_wide_ip module to changelog 2015-10-07 21:25:38 -04:00
d8769c93c7 updated ec2 region description to add missing other env var 2015-10-07 16:41:58 -04:00
c77733e64e added docs for commonly used region parameter in some ec2 modules 2015-10-07 15:52:06 -04:00
638bc14566 now deps is always a list 2015-10-07 15:41:11 -04:00
8a1426059f added entry for task path/line when verbose 2015-10-07 15:40:00 -04:00
d7fe5d1e72 Merge pull request #12672 from wenottingham/patch-9
Update playbooks_blocks.rst
2015-10-07 14:59:36 -04:00
aec58bfbb3 Update playbooks_blocks.rst
Remove heading that appears to be extraneous.
2015-10-07 14:26:23 -04:00
ac53ed47f8 Merge pull request #12671 from deyvsh/patch-1
Indicate that credstash plugin is new in v2
2015-10-07 12:44:06 -04:00
155282f94a Indicate that credstash plugin is new in v2
Also offer a poor-man's alternative.
2015-10-07 17:40:50 +01:00
dac3684fd1 changed task color to dark gray to keep it from being confused with ignore/skip 2015-10-07 12:12:35 -04:00
c459dd4e18 Merge pull request #12663 from Juraci/task-path
Displays the absolute path of a given task when verbosity is above level 3
2015-10-07 12:09:21 -04:00
dbae110f6f Merge pull request #12660 from apollo13/fix_galaxy_init
Show a nice error if the role name is missing.
2015-10-07 10:31:47 -04:00
fb0294be03 Merge pull request #12657 from jhawkesworth/powershell_strict_mode_version_2
Explictly set the version of strict mode to use for powershell modules.
2015-10-07 10:30:36 -04:00
13184a0c30 Merge pull request #12661 from deyvsh/patch-1
Add an example for map() to the filters page.
2015-10-07 10:16:03 -04:00
e52950a939 Displaying task_path on task start when verbosity is more than 3 2015-10-07 10:11:50 -03:00
254d6be520 Adding get_path method to Task class 2015-10-07 10:10:57 -03:00
c4c8493f1b Add an example for map() to the filters page 2015-10-07 12:33:39 +01:00
354383874f Show a nice error if the role name is missing. 2015-10-07 11:37:23 +02:00
=
345ce424c6 Explictly set the version of strict mode to use for powershell modules. 2015-10-07 06:24:37 +01:00
9e364c2eb5 Don't modify results in callbacks
Fixes #12654
2015-10-06 21:43:43 -04:00
8107c4efc7 Fixing a bug in galaxy parsing of text spec file lines 2015-10-06 21:25:28 -04:00
7a815b7296 Force connection to local when localhost is delegated to 2015-10-06 20:37:57 -04:00
97e8d25eb4 Fix for encoding errors when a command returns non-utf8 encoded values 2015-10-06 14:10:25 -07:00
4f6f2c21e8 range vs xrange doesn't matter here and six.moves.range isn't available in six-1.3.0 (rhel7) 2015-10-06 12:19:03 -07:00
5ae74f7d38 Version bump for 2.0.0-0.3.beta1 2015-10-06 08:19:20 -04:00
d9b79b1bbc Also template the role name when loading roles
Fixes #12602
2015-10-06 03:33:08 -04:00
3e0fbad4bb We need Python.h to build pycrypto on 3.5 2015-10-06 09:28:16 +03:00
6fec8fef6c For some reason Python 3.5 wasn't preinstalled on Travis 2015-10-06 09:23:49 +03:00
9c9897805f More ansible-galaxy fixes for the old spec file format 2015-10-06 01:54:48 -04:00
fb822a4305 Merge pull request #12637 from rcleere/rekey_fix
Fix ansible-vault rekey
2015-10-05 23:33:32 -04:00
3b8eaf6128 Cleaning up some ansible-galaxy stuff 2015-10-05 22:59:08 -04:00
0400ab8c0f Fix ansible-vault rekey 2015-10-05 16:41:34 -05:00
d91b3c6b9d Make sure magic variables are available when templating vars_files
Also does some reorganization/cleanup on the magic vars/delegated
variable generation portions of VariableManager to make the above
possible.

Fixes #12633
2015-10-05 16:32:58 -04:00
284bd118a0 Properly switch to the default transport when delegating from localhost 2015-10-05 16:32:58 -04:00
97c2b2ecc5 Merge pull request #12636 from bcoca/galaxy
Galaxy
2015-10-05 15:35:30 -04:00
6f88f79de9 removed dupe install code, now trap errors forom role.install 2015-10-05 13:04:12 -04:00
f73329401b galaxy updates
better error reporting on fetching errors
use scm if it exists over src
unified functions in requirements
simplified logic
added verbose to tests
cleanup code refs, unused options and dead code
moved get_opt to base class
fixes #11920
fixes #12612
fixes #10454
2015-10-05 11:43:08 -04:00
a3ed9fc131 updated to 'fixed' get_url so docs build again 2015-10-05 09:07:54 -04:00
130ba70598 added missing blank line for markup separation 2015-10-05 09:05:59 -04:00
f3d0468726 updated submodule refs 2015-10-05 08:59:10 -04:00
da458bbfd6 added way to display inventory vars for host to faq + some minor fixes/edits 2015-10-05 08:57:43 -04:00
323012be2e Pop tags out of playbook include params
Fixes #12605
2015-10-05 08:41:34 -04:00
f1f3bc9e50 Add Python 3.5 to tox.ini 2015-10-04 10:59:19 +03:00
e9b114a39b Simplify tox.ini
Use the factor-conditional settings feature of tox >= 1.8 to reduce
duplication:
https://tox.readthedocs.org/en/latest/config.html#factors-and-factor-conditional-settings
2015-10-04 10:57:49 +03:00
3e0330ad3b Remove redundancies from tox.ini 2015-10-04 10:51:37 +03:00
10a4a4e986 Quote any file paths that we have to use with dd to copy.
This is because we pass the whole dd command string into the shell
that's running on the contained environment rather than running it
directly from python via subprocess without a shell.
2015-10-03 18:07:27 -07:00
b83988d9fb Port libvirt_lxc connection plugin to v2 2015-10-03 17:42:49 -07:00
567deb5ac2 Add explicit substitution of relative paths on the remote host just in case the connection programs do something unexpected. 2015-10-03 17:33:57 -07:00
8528b20702 fixed usage text 2015-10-03 12:02:51 -04:00
04a2b221b9 removed conflicting short options 2015-10-03 10:05:23 -04:00
38528c8ef3 Show more info in the minimal callback for unreachable hosts
Fixes #12621
2015-10-03 01:41:57 -04:00
613e87db6c FIx typo arg_path (not plural) 2015-10-02 19:55:32 -07:00
5680a9fa32 removed redundant tests, adjusted makefile expected count 2015-10-02 22:37:19 -04:00
4ba5ebd1c8 Merge pull request #12538 from yesbox/url_lookup_plugin_httperror_fix
Fix url lookup plugin HTTPError message not being reachable
2015-10-02 21:30:16 -04:00
bdd3ae9d61 Set the default use_private_network setting to False 2015-10-02 19:18:37 -04:00
eddfc649de Added an option to use the private network IP address
This option defaults to disabled and can be set from the digital_ocean.ini file.
2015-10-02 19:16:44 -04:00
ab3239ecd7 added methods for retrieving vapp and vm 2015-10-02 18:01:35 -04:00
a1f6de8745 Merge pull request #12593 from ansible/py3-unicode-exec
Since Connection.execute_command() returns bytes, deal with the repurcussions
2015-10-02 12:43:26 -07:00
10750214ea Since Connection.execute_command() returns bytes, deal with the repurcussions here. 2015-10-02 12:39:36 -07:00
e2ae3215f6 corrected no_log for items and skipped tasks
corrected output from default callback
added new tests for no_log loops
updated makefile test to check for both positive and negative occurrences of no_log
2015-10-02 14:35:33 -04:00
86ef20c73b Merge branch 'amenonsen-ssh-args' into devel 2015-10-02 13:38:47 -04:00
c28758d2a8 Merge branch 'ssh-args' of https://github.com/amenonsen/ansible into amenonsen-ssh-args 2015-10-02 13:38:00 -04:00
82faba619e Also add args_path param to powershell shell plugin 2015-10-02 13:25:26 -04:00
30d481ac57 Fix old-style (non-python) module support 2015-10-02 12:58:35 -04:00
e40e08d799 Update core sumodule ref to fix docs 2015-10-02 09:22:43 -07:00
ba98c70bea Mention new ssh argument variable in the changelog 2015-10-02 21:52:12 +05:30
b127221f50 Pass default None to getattr, remove repeated call 2015-10-02 21:26:25 +05:30
478e234bc3 Reword the jump host section in the FAQ
It's just s/extra_args/common_args/, but I reworded some parts to make
things a bit clearer too.

Closes #12335
2015-10-02 21:26:25 +05:30
96c4dc273a Set explicit default for ANSIBLE_SSH_ARGS
The earlier code behaved exactly as though this default had been set,
but it was actually handled as a(n unnecessary) special case inside the
connection plugin, rather than set as an explicit default.

If the default is overriden either in ansible.cfg or the environment,
the new code will continue to work (in fact, it won't know or care,
since it just uses the value set in the PlayContext).

This is submitted as a separate commit for easier review to address
backwards-compatibility concerns.
2015-10-02 21:26:25 +05:30
1981bf2b95 Aggregate ssh arguments in PlayContext instead of the connection plugin
Using set_host_overrides() in the connection plugin to access the ssh
argument variables from the inventory didn't see group_vars/host_vars
settings, as noted earlier. Instead, we can set the correct values in
the PlayContext, which has access to all command-line options, task
settings, and variables.

The only downside of doing so is that the source of the settings is no
longer available in ssh.py, and therefore can't be logged. But the code
is simpler, and it actually works.

This change was suggested by @jimi-c in response to the FIXME in the
earlier commit.
2015-10-02 21:26:25 +05:30
3ad9b4cba6 Rework additional ssh argument handling
Now we have the following ways to set additional arguments:

1. [ssh_connection]ssh_args in ansible.cfg: global setting, prepended to
   every command line for ssh/scp/sftp. Overrides default ControlPersist
   settings.
2. ansible_ssh_common_args inventory variable. Appended to every command
   line for ssh/scp/sftp. Used in addition to ssh_args, if set above, or
   the default settings.
3. ansible_{sftp,scp,ssh}_extra_args inventory variables. Appended to
   every command line for the relevant binary only. Used in addition to
   #1 and #2, if set above, or the default settings.
3. Using the --ssh-common-args or --{sftp,scp,ssh}-extra-args command
   line options (which are overriden by #2 and #3 above).

This preserves backwards compatibility (for ssh_args in ansible.cfg),
but also permits global settings (e.g. ProxyCommand via _common_args) or
ssh-specific options (e.g. -R via ssh_extra_args).

Fixes #12576
2015-10-02 21:26:25 +05:30
f13d5201b8 Update module refs 2015-10-02 08:34:05 -07:00
42198a7a59 updated adding os_router and deprecating quantum modules 2015-10-02 10:14:17 -04:00
4c9f58a152 added no_log censoring to item output
should be last commit that fixes #12214
2015-10-02 09:11:41 -04:00
5c39538a73 added no_log tests as per #12214 2015-10-02 09:11:41 -04:00
ba4afcbbb6 added no_log to results
normalized outputs to use display class
cleaned up unused imports
2015-10-02 09:11:41 -04:00
c27bd4fab0 {sudo,su}_user does not imply become 2015-10-02 09:11:41 -04:00
57372906aa Pull host/group vars when adding hosts/groups
Fixes #12582
2015-10-02 02:47:09 -04:00
aa3687d736 Fix syntax error for octal in encrypt methods 2015-10-02 02:27:57 -04:00
538568305a Submodule pointer update for accelerate module fixes 2015-10-02 00:50:02 -04:00
8ef78b1cf8 Fixing accelerated connection plugin 2015-10-02 00:50:02 -04:00
00b8a24299 Merge pull request #12579 from acogdev/devel
Alphabitize retry_files_enabled and retry_files_save_path
2015-10-01 20:01:04 -04:00
3705d54485 fixed error reporting on splitter 2015-10-01 19:03:04 -04:00
de2f62bd9e fixed error reporting for unkown become user 2015-10-01 18:58:16 -04:00
6d6bfbc3d2 added missing import for pwd, was being obscured by exception catching and fallback 2015-10-01 18:56:30 -04:00
a680ef66dd fixed vault password file script execution 2015-10-01 18:49:51 -04:00
6b842d9c49 fixed incorrect data passing on certain events 2015-10-01 18:49:51 -04:00
2463922306 fixed error reporting when missing redis import 2015-10-01 18:49:51 -04:00
6e96188085 added missing entry for dealing with bcc 2015-10-01 18:49:51 -04:00
0a21e2ab4d Add github ID to documentation example 2015-10-01 14:20:06 -04:00
6ec5abf1c3 fixed some pyflakes 2015-10-01 14:14:20 -04:00
75f99f873b Merge pull request #12379 from bcoca/document_vars
Document vars

merging so we can push PRs against the common repo
2015-10-01 12:57:51 -04:00
9c42a4cc69 Merge pull request #12595 from amenonsen/fixups-1
Remove mysterious old cruft
2015-10-01 11:32:18 -04:00
49b35ad5dd Remove mysterious old cruft
The two lines were added in 2673eb0a and modified in 60e1a1f8, but foo
is completely unused. Removing it doesn't break anything: out it goes!
2015-10-01 20:32:08 +05:30
775486c9d6 Merge pull request #12589 from jemmyw/consul-http-checks
Update consul integration test with http checks
2015-10-01 10:44:31 -04:00
fe0e4f27ad Merge pull request #12584 from amenonsen/fixups
Remove an unwanted FIXME annotation
ok, confirmed we don't want to support it
2015-10-01 10:24:58 -04:00
6c190aa8a4 updated ansible-doc to ignore more stuff that has been added to the module repos 2015-10-01 10:17:41 -04:00
1a56a5c442 created debug method, renamed debug attribute to _debug 2015-10-01 10:17:41 -04:00
deff045aa9 Fix bug caused by options not having start_at_task when used through adhoc
Fixes #12590
2015-10-01 10:09:58 -04:00
a0920c06e1 Pull submodule refs to fix docs builds 2015-09-30 19:57:55 -07:00
4dae7eeca1 Update submodule refs 2015-09-30 19:41:56 -07:00
56fa9a5098 Port to v2 API 2015-09-30 19:39:07 -07:00
d35c9a30fb Minor refactorings 2015-09-30 19:39:06 -07:00
888bcd65a8 Create error messages instead of tracebacks. 2015-09-30 19:39:06 -07:00
93515468c4 Remove an unwanted FIXME annotation
<crab> jimi|ansible: do you think it should be possible to add both
       foo:22 and foo:23 to the inventory?
<jimi|ansible> no

…so we don't want an invitation to FIXME.
2015-10-01 06:56:29 +05:30
946c56657b Merge pull request #12583 from trondhindenes/windows_docs_improvement
Windows: Updated docs
2015-09-30 19:32:10 -04:00
e9786db541 Windows: Updated docs to reflect the new name of get-attr, along with examples 2015-09-30 23:29:05 +02:00
4cfcf5d61b Merge pull request #12568 from mgedmin/py3k
Python 3: fix most tests for ansible.module_utils.basic
2015-09-30 12:47:29 -07:00
e6958df9a8 Put retry_files_enabled and retry_files_save_path into alphabetical order. Found when investigating #11491 2015-09-30 13:41:51 -06:00
044acdae40 Merge pull request #12578 from trondhindenes/powershell_getattr_improvements2
Windows: Added parameter validation to the get-attr function / Get-AnsibleParam
2015-09-30 15:23:14 -04:00
94cfbe7ee9 Get-AnsibleParam 2015-09-30 21:02:12 +02:00
dcb8caf9e8 Remember if we already skipped tasks via --start-at-task
Fixes #12482
2015-09-30 14:12:38 -04:00
57adf11262 Fix metadata description for galaxy_tags. 2015-09-30 13:36:28 -04:00
f4690e3bfe Changing tag to galaxy_tag. 2015-09-30 13:36:23 -04:00
8360a1b3f2 Replace categories with tags.
Also added --ignore-certs option for use with install and search commands. Helpful when
overriding server and server has self signed cert.
2015-09-30 13:36:17 -04:00
6d8abe84e4 Merge pull request #12572 from amenonsen/vault-pager
Make ansible-vault view not write plaintext to a tempfile
2015-09-30 12:50:59 -04:00
0bb34fd076 Make «ansible-vault view» not write plaintext to a tempfile
CLI already provides a pager() method that feeds $PAGER on stdin, so we
just feed that the plaintext from the vault file. We can also eliminate
the redundant and now-unused shell_pager_command method in VaultEditor.
2015-09-30 22:13:36 +05:30
bf06e36382 updated async to pass along no_log setting 2015-09-30 11:52:27 -04:00
cc1e1648f5 Tweak comment style 2015-09-30 18:46:50 +03:00
0371b14567 Fix test: selinux gets passed byte strings
(I don't have a system with selinux to test if the module still wants
byte strings even on Python 3.)
2015-09-30 18:46:50 +03:00
500e7a1263 Fix test: _to_filesystem_str produces byte strings 2015-09-30 18:46:49 +03:00
213029a21e Python 3: don't convert unicode to unicode 2015-09-30 18:46:49 +03:00
c7be004c19 Python 3 has no dict.iteritems()
(Reminder: cannot use six here, module_utils get shipped to remote
machines that may not have six installed -- besides six doens't support
Python 2.4.)
2015-09-30 18:46:49 +03:00
9f3e5ceb14 Make sure 'basestring', 'bytes' and 'unicode' are defined
Python 3 doesn't have 'basestring' and 'unicode'.

Python 2.4 doesn't have 'bytes'
2015-09-30 18:40:47 +03:00
f7571cb37f Python 3: there's no __builtin__ module
This caused an ImportError in a test module and showed up as one test
failure.  Now the test module can get imported and many more tests fail
(on Python 3).  Such is life.  ;-)
2015-09-30 18:40:47 +03:00
ddafed4403 Merge pull request #12528 from bcoca/task_logging
task logging revamp
2015-09-30 11:38:34 -04:00
7b64126c9d pushed up openvz detection for cases of 'stacked' virtualization 2015-09-30 11:27:50 -04:00
1fbe168dcd Merge pull request #12574 from LinusU/patch-1
facts: correctly detect docker inside a xen host
2015-09-30 11:24:23 -04:00
d380cc7e7d Merge pull request #12543 from DevOps4Networks/devel
Guidance for pycrypto install on Mac OSX
2015-09-30 11:10:53 -04:00
45f9800754 facts: correctly detect docker inside a xen host 2015-09-30 17:08:21 +02:00
af1f462ba0 Fix to exclude forward slashes from git info during 'make rpm'
Fixes #12558
2015-09-30 09:32:09 -04:00
3bd71d0619 Use delegated_to field for play context remote_addr, if none other exists
Fixes #12527
2015-09-30 09:27:29 -04:00
40bdf09998 Merge pull request #12561 from srvg/anotherdirpy
Inject existing groups at InventoryDir initialization
2015-09-30 08:18:34 -04:00
6fcd292c5e Merge pull request #12569 from amenonsen/fixes
Bring groups handling in ini.py up-to-date (trivial fix)
2015-09-30 08:16:14 -04:00
dc7a0b7a5b Merge pull request #12564 from geerlingguy/update-readme
Releases are named after Led Zeppelin songs as of 2.0.0.
2015-09-30 08:10:53 -04:00
5a1ca2b191 Merge branch 'amenonsen-tests' into devel 2015-09-30 08:07:13 -04:00
6339bf8a82 Merge branch 'tests' of https://github.com/amenonsen/ansible into amenonsen-tests 2015-09-30 08:06:52 -04:00
dfa33d0f23 Tweak variable manager use in role includes to avoid test failures 2015-09-30 08:05:55 -04:00
d100db837b Add basic tests for expand_hostname_range 2015-09-30 16:28:45 +05:30
838e71edb7 Add more exhaustive tests for various IPv6 address notations 2015-09-30 16:15:39 +05:30
50d75f8d6d Bring groups handling in ini.py up-to-date
Since c8f2483d, ini.py expects to always be passed in a pre-created list
of groups, and can no longer deal sensibly with an empty list; this just
makes that expectation clear.
2015-09-30 15:13:37 +05:30
e7029a90e6 #12454 changing to footnote. 2015-09-30 10:45:43 +02:00
76bd9e9239 Releases are now named after Led Zeppelin songs as of 2.0.0. 2015-09-29 16:28:17 -05:00
a89412ecb1 Fail all hosts if a run_once task fails
Fixes #12563
2015-09-29 15:10:00 -04:00
7173f587ed Allow delegate_to on a role again
Fixes #12560
2015-09-29 15:07:32 -04:00
a3e913da62 Don't assume handlers exist in the same role (if any)
Fixes #12536
2015-09-29 14:52:43 -04:00
8095b027bf Merge pull request #12562 from halostatue/patch-1
Describe the units for fact_caching_timeout
2015-09-29 13:03:13 -04:00
7461ba9998 Inject existing groups at InventoryDir initialization
This fixes a corner case where ini files live in a subdir
of the main inventory directory.

Reproducing the original error:

mkdir -p inventory/ini
cat > inventory/ini/hosts << EOF
[www]
www1
EOF

$ ansible -i inventory/ all -m ping
ERROR! 'all'

(or without the [www] group, it would complain about 'ungrouped')
2015-09-29 18:16:05 +02:00
67a980c9ef Describe the units for fact_caching_timeout 2015-09-29 11:59:55 -04:00
79e364d98b Properly template role dependency names
Fixes #12505
2015-09-29 09:55:57 -04:00
f42f5e6740 Merge pull request #12552 from mgedmin/py3k
Python 3: there's no basestring
2015-09-29 09:30:15 -04:00
68a927466e Updating Mac OSX guidance comment to make it a note for issue #12454. 2015-09-29 11:14:28 +02:00
420589c715 Adding Mac OSX guidance comment for issue #12454. 2015-09-29 11:10:26 +02:00
5edd6d9be4 Python 3: there's no basestring
Fixes another failing test.

(I don't want to do a global search/replace for 'basestring' because I
want to have unit tests covering each occurrence.  When I run out of
existing failing tests, I'll try to write new ones.)
2015-09-29 09:01:57 +03:00
95ede22a1e Add a comment about the docker connection and usage by non-root users 2015-09-28 22:50:06 -07:00
0e110d23f8 Misc cleanups and some fixes for docker connection plugin
* Remove extraneous imports
* Fix some error handling
* Enable pipelining
* Disable su since it doesn't work
* Add error message when installed docker is not recent enough to
  support this plugin
* Move nested functions to class level
* Make transport a class attribute
* Make exec_command, put_file and fetch_file more robust
2015-09-28 22:35:52 -07:00
1d119a1f46 Cleanup some extraneous imports 2015-09-28 22:35:52 -07:00
ffdba96668 Save the included directory for playbook includes for use as the basedir
Fixes #12524
2015-09-29 00:28:45 -04:00
4226e49bc6 bugfix: statement had no effect => statement now has assumed effect 2015-09-28 23:33:48 -04:00
1ccfeafa76 bugfix: use correct close calls 2015-09-28 23:33:32 -04:00
c1ad96e5cf removed fixme as it is already implemented below. 2015-09-28 23:32:57 -04:00
922b5c8109 Removed deletion of salt by 'password' lookup
Removed deletion of salt param from lookup file by 'password' lookup_filter.
Old behaviour leads to constant changed status when two tasks uses same lookup,
one with 'encrypt' parameter, and other without.

For example:

    tasks:
      - name: Create user
        user:
          password: "{{ lookup('password', inventory_dir + '/creds/user/pass' ncrypt=sha512_crypt) }}"
          ...
    # Lookup file 'creds/user/pass' now contain password with salt
      - name: Create htpasswd
        htpasswd:
          password: "{{ lookup('password', inventory_dir + '/creds/user/pass') }}"
          ...
    # Salt gets deleted from lookup file 'creds/user/pass'
    # Next run of "Create user" task will create it again and will have 'changed' status
2015-09-28 23:28:01 +03:00
12a2585e84 chroot plugin minor touchups:
* Disable su as it's not currently working 100% (and was disabled in v1).
* Move BUFSIZE out of the class to match other conenction plugins
* _connect shouldn't return self.
2015-09-28 13:16:56 -07:00
7a4266e9c5 One more try -- the error message should reference the become method
requested via play context
2015-09-28 11:28:33 -07:00
696cf32d63 Correct name of variable 2015-09-28 11:28:33 -07:00
8d024c3747 Merge pull request #12472 from resmo/for_ansible
cloudstack: improvements and tests
2015-09-28 14:27:22 -04:00
0dfa1fb43a Correct call to method typo 2015-09-28 11:24:00 -07:00
4225c0677d Merge pull request #12548 from amenonsen/pr-9130-rebase
#9130 rebase: EC2 Inventory Boto Profile Support
2015-09-28 10:47:12 -07:00
d827325644 Re-order the methods in ssh.py so that methods needed for implementation are near and just above the relevant public methods.
Standard with the rest of the code base.
2015-09-28 10:34:02 -07:00
37844a5c1b Update submodule refs 2015-09-28 09:47:16 -07:00
c811668a4d Merge pull request #12546 from amenonsen/ssh-cleanups
A couple of ssh cleanups
2015-09-28 09:46:24 -07:00
b0133d9c8f Move connection handling failure to connect_to_aws
Make use of better error handling mechanism
2015-09-28 21:35:46 +05:30
c08137a3d2 Update ec2 inventory documentation to refer to AWS_PROFILE 2015-09-28 21:35:46 +05:30
57754b5a71 Fix security_token typo in ec2 inventory 2015-09-28 21:35:46 +05:30
e7890e66f3 Combine ansible/ansible#5987 and ansible/ansible#8582
Fixes merge conflicts and standardizes option naming
2015-09-28 21:35:46 +05:30
8c11ea5666 Add an ec2 inventory option "boto_profile" that allows
the use of boto profiles for separating credentials as
specified in

http://boto.readthedocs.org/en/latest/boto_config_tut.html
2015-09-28 21:35:46 +05:30
9c967dd054 Allow ec2 inventory to use a boto profile
This allows the EC2 inventory plugin to be used with
the same configuration against different EC2 accounts

Profile can be passed using --profile variable or using
EC2_PROFILE environment variable e.g.

```
EC2_PROFILE=prod ansible-playbook -i ec2.py playbook.yml
```

Added documentation on profiles to EC2 dynamic inventory doc

Only tries to use profiles if --profile argument is given
or EC2_PROFILE is set to maintain compatibility will boto < 2.24.

Works around a minor bug in boto where if you try and use
a security token with a profile it fails (boto/boto#2100)
2015-09-28 21:35:46 +05:30
05af4c8e91 Merge pull request #12471 from amenonsen/pipelining
Make pipelining a connection variable
2015-09-28 09:02:43 -07:00
38c7422da5 Move ControlPersist/Path checking into a separate method
This is also peripheral to what _build_command needs, can be improved
and tested independently, and so makes more sense in a separate method.

This commit doesn't change any functionality (and I've verified that it
works with the various combinations: control_path set in ansible.cfg,
ssh_args adding or not adding ControlMaster/ControlPersist, etc.).
2015-09-28 21:11:56 +05:30
c3a05b1181 Update to fix one more doc error 2015-09-28 08:38:24 -07:00
f33d541964 Move sshpass checking into a separate method
Checking for sshpass is peripheral to the calling code, so it's easier
to follow when the details are moved into a method.
2015-09-28 20:58:30 +05:30
d4af7d256b Mention ansible_ssh_pipelining in intro_inventory 2015-09-28 20:55:14 +05:30
565c6f1ae7 Make ansible_pipelining a connection variable
SSH pipelining can be a significant performance improvement, but it will
not work if sudoers is configured to requiretty. With this change, one
could have pipelining enabled in ansible.cfg, but use sudo to turn off
requiretty in a separate play (or task) where pipelining is disabled:

    - hosts: foo
      vars:
          ansible_pipelining: no
      tasks:
        - lineinfile: dest=/etc/sudoers line='Defaults requiretty' state=absent
          sudo_user: root

(Note that sudoers has a complicated syntax, so the above lineinfile
invocation may be too simplistic for production use; but the point is
that a separate play can do something to disable requiretty.)
2015-09-28 20:55:14 +05:30
fd267989fb Fix docs build 2015-09-28 08:23:12 -07:00
69ebb899a7 Update submodule refs 2015-09-28 07:52:04 -07:00
c860775b5d Another fix for --limit in adhoc 2015-09-28 10:39:33 -04:00
ee6317ca07 Adding Mac OSX guidance comment for issue #12454. 2015-09-28 15:46:37 +02:00
c8835b873b Adding Mac OSX guidance comment for issue #12454. 2015-09-28 15:40:32 +02:00
f5c453f2b2 Adding Mac OSX guidance comment for issue #12454. 2015-09-28 15:39:35 +02:00
babf47decb Clean up some bugs related to --limit on adhoc commands 2015-09-28 09:02:24 -04:00
621575681a Merge pull request #12542 from amenonsen/qfix
Clarify why we add -q only for ssh
2015-09-28 08:18:31 -04:00
ed73b45ec7 Merge pull request #12540 from mgedmin/py3k
Python 3: the StringIO module is gone
2015-09-28 08:18:07 -04:00
2ce219b5af Clarify why we add -q only for ssh 2015-09-28 16:00:23 +05:30
9b39af8e9a Python 3: the StringIO module is gone
Fixes 17 failing tests on Python 3.4, restoring the 8 failures we had
last Friday.
2015-09-28 09:28:53 +03:00
353b549eb0 Fix HTTPError message not being reachable 2015-09-27 18:01:19 +00:00
4cd810a674 Only append -q option for ssh if we're using ssh 2015-09-26 21:27:38 -04:00
46984a067c Don't wrap vars from include_vars with UnsafeProxy 2015-09-26 15:16:46 -04:00
4c7843f268 Merge pull request #12532 from fboender/devel
Output proper JSON from vbox dynamic inventory contrib script
2015-09-26 14:20:45 -04:00
abfeb104df Merge pull request #12529 from soarpenguin/bug-fix
fix no self pointer out of class.
2015-09-26 14:18:58 -04:00
342bc97322 Port chroot conection plugin to the latest v2 connection API.
Also get pipelining working for people who look to chroot as an example
for their own connection plugins

Note: In the latest v2 API, action handles become but chroot doesn't
reliably handle become.  Maybe we need to add a has_become attribute
that the action can display an appropriate error.
2015-09-26 10:00:28 -07:00
056a020357 Do not fail if /proc/uptime is not present
This can happen in chroot environments that don't have all of /proc
available
2015-09-26 10:00:28 -07:00
ae66d01a33 Document how a command is executed on the remote machine
Helps connection plugin implementors understand how to structure
exec_command()
2015-09-26 10:00:28 -07:00
c6c3ce6616 Output proper JSON from vbox dynamic inventory contrib script 2015-09-26 18:25:58 +02:00
6dd38c2a10 Fix parent attribute lookup to be default
Fixes #12526
2015-09-26 11:28:29 -04:00
a1c38a3fda Adding delegate_to to Blocks 2015-09-26 11:28:01 -04:00
bb6141ec41 renamed managed_syslog to no_target_syslog 2015-09-26 08:22:32 -04:00
a591582b24 Merge pull request #12530 from amenonsen/fixups
Update outdated comment
2015-09-26 08:16:14 -04:00
8251ab2e37 Update outdated comment
Since #12165 was merged, hostnames are properly validated.
2015-09-26 17:32:13 +05:30
6ff4d40d74 Update outdated comment
We now use "sudo -n" instead of "sudo -k && sudo …"
2015-09-26 17:28:22 +05:30
1ea66e234f fix logic judgment error. 2015-09-26 15:15:53 +08:00
2caa52a981 fix no self pointer out of class. 2015-09-26 14:09:56 +08:00
37a918438b task logging revamp
* allow global no_log setting, no need to set at play or task level, but can be overriden by them
 * allow turning off syslog only on task execution from target host (manage_syslog), overlaps with no_log functionality
 * created log function for task modules to use, now we can remove all syslog references, will use systemd journal if present
 * added debug flag to modules, so they can make it call new log function conditionally
 * added debug logging in module's run_command
2015-09-25 23:57:28 -04:00
b757798f3e Merge pull request #12483 from jeffwidman/patch-2
Clarified that .yml, .yaml, and .json are allowable file extensions for inventory vars files
2015-09-25 20:45:53 -04:00
60e1a1f8eb Fix bug in nested lookup where pop is called indiscriminately 2015-09-25 17:16:56 -04:00
191ae0831d fixed syntax error 2015-09-25 17:15:26 -04:00
48412c13b2 fixed copy n paste typo on future code 2015-09-25 17:08:03 -04:00
bb1101498d Clean up typo from cdc6c52 2015-09-25 16:58:27 -04:00
cdc6c5208e Clean string data run through the template engine
Also strip UnsafeProxy off of low level srings and objects to ensure
they don't cause issues later down the road

Fixes #12513
2015-09-25 16:49:31 -04:00
ae9b34b1d9 Fix for equality checking in Host to make sure things are like types 2015-09-25 16:49:31 -04:00
fa9ea32a86 Fix test of whether a result has a failed host 2015-09-25 12:09:27 -07:00
1c49e3b842 draft shared service code for modules, part of spliting service module 2015-09-25 11:26:21 -04:00
41756be4d3 Update core module ref 2015-09-25 07:49:32 -07:00
dcdcd9e9c5 Move is_executable to the toplevel of basic.py so we can utilize it from other code 2015-09-25 07:48:57 -07:00
aedec951be Merge pull request #12521 from mgedmin/patch-1
Typo in shell command in example
2015-09-25 07:54:12 -04:00
b57d549e16 Typo in shell command in example 2015-09-25 10:27:35 +03:00
ccddda1ebc Merge pull request #12502 from mgedmin/py3k
Python 3: make test_variable_manager_precedence pass
2015-09-25 03:05:02 -04:00
eb8d7dcd14 Make sure formatted strings don't bomb on tuples
Fixes #12501
2015-09-25 03:01:42 -04:00
31d5f88a1d Use the task loop to calculate multiple delegated hosts
Due to the way we're now calculating delegate_to, if that value is based
on a loop variable ('item') we need to calculate all of the possible
delegated_to variables for that loop.

Fixes #12499
2015-09-25 01:41:09 -04:00
a1428d6bed Remove tmp as a parameter to the connection plugins
There doesn't appear to be anything that actually uses tmp_path in the
connection plugins so we don't need to pass that in to exec_command.
That change also means that we don't need to pass tmp_path around in
many places in the action plugins any more.  there may be more cleanup
that can be done there as well (the action plugin's public run() method
takes tmp as a keyword arg but that may not be necessary).

As a sideeffect of this patch, some potential problems with chmod and
the patch, assemble, copy, and template modules has been fixed (those
modules called _remote_chmod() with the wrong order for their
parameters.  Removing the tmp parameter fixed them.)
2015-09-24 13:33:57 -07:00
95b371dd60 Use AnsibleFileNotFound instead of AnsibleParsingError when YAML files are not found
And update portions of code to expect the proper error.

Fixes #12512
2015-09-24 16:27:25 -04:00
0250beb68a Remove compress option from paramiko connection for now
It's not available on older versions of paramiko such as shipped in RHEL6
2015-09-24 13:18:00 -07:00
12df9f2e31 Make hostvars more dynamic again to improve performance with large inventories
Fixes #12477
2015-09-24 13:53:44 -04:00
82b33c381f We don't need even a token timeout here; just poll once
The process is already gone, so there's not going to be any new data
showing up on its stderr; we only want to make sure that we haven't
missed something that was already written. So polling once is enough.
2015-09-24 12:10:16 -04:00
6e82df451a Clarify select() handling for ssh connections
This change is motivated by an ssh oddity: when ControlPersist is
enabled, the first (i.e. master) connection goes into the background; we
see EOF on its stdout and the process exits, but we never see EOF on its
stderr. So if we ran a command like this:

    ANSIBLE_SSH_PIPELINING=1 ansible -T 30 -vvv somehost -u someuser -m command -a whoami

We would first do select([stdout,stderr], timeout) and read the command
module output, then select([stdout,stderr], timeout) again and read EOF
on stdout, then select([stderr], timeout) AGAIN (though the process has
exited), and select() would wait for the full timeout before returning
rfd=[], and then we would exit. The use of a very short timeout in the
code masked the underlying problem (that we don't see EOF on stderr).

It's always preferable to call select() with a long timeout so that the
process doesn't use any CPU until one of the events it's interested in
happens (and then select will return independent of elapsed time).

(A long timeout value means "if nothing happens, sleep for up to <x>";
omitting the timeout value means "if nothing happens, sleep forever";
specifying a zero timeout means "don't sleep at all", i.e. poll for
events and return immediately.)

This commit uses a long timeout, but explicitly detects the condition
where we've seen EOF on stdout and the process has exited, but we have
not seen EOF on stderr. If and only if that happens, it reruns select()
with a short timeout (in practice it could just exit at that point, but
I chose to be extra cautious). As a result, we end up calling select()
far less often, and use less CPU while waiting, but don't sleep for a
long time waiting for something that will never happen.

Note that we don't omit the timeout to select() altogether because if
we're waiting for an escalation prompt, we DO want to give up with an
error after some time. We also don't set exceptfds, because we're not
actually acting on any notifications of exceptional conditions.
2015-09-24 12:10:16 -04:00
03127dcfae remove the stdin return value from connection plugin exec_command() methods
The value was useless -- unused by the callers and always hardcoded to
the empty string.
2015-09-24 08:57:19 -07:00
9d47eabfa4 Merge pull request #12506 from hyperized/devel
Add Weekday (0-6) as a number and add weeknumber (00-52)
2015-09-24 11:44:39 -04:00
24b9e2e6d1 Update extras submodule ref 2015-09-24 07:18:23 -07:00
4c20964475 Add Weekday (0-6) as a number and add weeknumber (00-52) 2015-09-24 15:05:44 +02:00
56f2a25bff Python 3: there's no 'unicode' 2015-09-24 12:53:48 +03:00
6d4618f46f Python 3: there's no dict.iteritems() 2015-09-24 12:50:00 +03:00
0624797375 Bugfix: if you define a custom __eq__, you must define a __hash__ too
Also, on Python 3 the stock object.__hash__ raises an error ("unhashable
type"), and we have code that uses Host instances as dict keys.
2015-09-24 12:46:06 +03:00
a2bc6b4b26 Bugfix: if you define __eq__, you should define __ne__ too 2015-09-24 12:43:33 +03:00
5d29a2eabd Python 3: shlex.split() wants unicode
On Python 2, shlex.split() raises if you pass it a unicode object with
non-ASCII characters in it.  The Ansible codebase copes by explicitly
converting the string using to_bytes() before passing it to
shlex.split().

On Python 3, shlex.split() raises ('bytes' object has no attribute 'read')
if you pass a bytes object.  Oops.

This commit introduces a new wrapper function, shlex_split, that
transparently performs the to_bytes/to_unicode conversions only on
Python 2.

Currently I've only converted one call site (the one that was causing a
unit test to fail on Python 3).  If this approach is deemed suitable,
I'll convert them all.
2015-09-24 12:36:05 +03:00
5d3d9cfe0d Convert to byte strings to avoid UnicodeErrors
Fixes #12488
2015-09-23 15:24:17 -07:00
de18bcb95f correct typo on error reporting
fixes #12495
2015-09-23 10:11:52 -04:00
6c3813ed37 added win_firewall_rule module 2015-09-23 09:41:59 -04:00
65f5bed33e Merge pull request #12493 from amenonsen/ssh-fds
Fix typo in checking select results
2015-09-23 13:24:59 -04:00
40f608a377 A bit more debugging output
We used to display input chunks earlier anyway, so this isn't making
things more verbose.
2015-09-23 22:35:14 +05:30
9700d9c04f Fix typo in checking select results
It's possible for more than one fd to be set, so 'elif' is obviously not
the right thing to use.
2015-09-23 22:32:15 +05:30
1164e83477 Remove unnecessary calls to save inventory restrictions since 81bf88b 2015-09-23 12:18:09 -04:00
89a78ba16e Update submodule refs 2015-09-23 08:40:59 -07:00
9e734df0ec Conditionally poll longer if we're still waiting for an auth prompt 2015-09-23 11:20:11 -04:00
5f0f5363b6 Merge pull request #12487 from mgedmin/py3k
Fix one more failing test on Python 3
2015-09-23 08:18:17 -07:00
2898e000a0 Don't use the connection timeout for the select poll timeout 2015-09-23 11:13:12 -04:00
713809b62d Merge branch 'amenonsen-ssh-indata' into devel 2015-09-23 10:48:53 -04:00
587054db2a Send initial data before calling select whenever possible
Without this, we could execute «ssh -q ...» and call select(), which
would timeout after the default 10s, and only then send initial data.
(This is a relic of the earlier change where we always ran ssh with
-vvv, so the situation where it would sit quietly never happened in
practice; but this would have been the right thing to do even then.)
2015-09-23 20:09:50 +05:30
c9a004227e Improve error catching from malformed playbook data
Fixes #12478
2015-09-23 08:56:36 -04:00
e8e1d9f6fb Apply --limit to inventory in adhoc commands
Fixes #12473
2015-09-23 08:28:38 -04:00
95e655eb67 Python 3: there's no basestring
Fixes one failing test.

The long series of module_utils/basic.py fixes were all because
module_utils/basic is imported in ansible/inventory/script.py.
2015-09-23 10:04:26 +03:00
2c4982b58d Python 3: there's no itertools.imap
Because the builtin map() acts like an iterator already.
2015-09-23 10:04:26 +03:00
6708d56a21 Python 3: avoid long integer literals
Even Python 2.4 automatically promotes int to long.
2015-09-23 10:04:25 +03:00
f5d4935197 Python 3: treat python as a function in module_utils/basic.py
NB: we can't use 'from __future__ import print_function', but luckily
print(one_thing) works fine on both Python 2 and Python 3 without that.
2015-09-23 10:04:25 +03:00
e71a986e16 Python 3: avoid octal constants in module_utils/basic.py 2015-09-23 10:04:25 +03:00
d2bec7f81f Python 3: avoid "except ..., e:" in module_utils/basic.py
Make the code compatible with Pythons 2.4 through 3.5 by using
sys.exc_info()[1] instead.

This is necessary but not sufficient for Python 3 compatibility.
2015-09-23 10:04:25 +03:00
65630d2ce1 Fixing one more bug related to staticmethods in LookupBase 2015-09-23 02:33:32 -04:00
cbbb270761 Cleanup bug from moving base lookup methods to staticmethods 2015-09-23 02:26:19 -04:00
ac98fe9e89 Implement ssh connection handling as a state machine
The event loop (even after it was brought into one place in _run in the
previous commit) was hard to follow. The states and transitions weren't
clear or documented, and the privilege escalation code was non-blocking
while the rest was blocking.

Now we have a state machine with four states: awaiting_prompt,
awaiting_escalation, ready_to_send (initial data), and awaiting_exit.
The actions in each state and the transitions between then are clearly
documented.

The check_incorrect_password() method no longer checks for empty strings
(since they will always match), and check_become_success() uses equality
rather than a substring match to avoid thinking an echoed command is an
indication of successful escalation. Also adds a check_missing_password
connection method to detect the error from sudo -n/doas -n.
2015-09-23 01:55:00 -04:00
840a32bc08 Reorganise ssh.py to cleanly separate responsibilities
The main exec_command/put_file/fetch_file methods now _build_command and
call _run to handle input from/output to the ssh process. The purpose is
to bring connection handling together in one place so that the locking
doesn't have to be split across functions.

Note that this doesn't change the privilege escalation and connection IO
code at all—just puts it all into one function.

Most of the changes are just moving code from one place to another (e.g.
from _connect to _build_command, from _exec_command and _communicate to
_run), but there are some other notable changes:

1. We test for the existence of sshpass the first time we need to use
   password authentication, and remember the result.
2. We set _persistent in _build_command if we're using ControlPersist,
   for later use in close(). (The detection could be smarter.)
3. Some apparently inadvertent inconsistencies between put_file and
   fetch_file (e.g. argument quoting, sftp -b use) have been removed.

Also reorders functions into a logical sequence, removes unused imports
and functions, etc.

Aside: the high-level EXEC/PUT/FETCH description should really be logged
from ConnectionBase, while individual subclasses log transport-specific
details.
2015-09-23 01:55:00 -04:00
95c6fe88e4 Fix handling of conditional vars_files which contain variables
Fixes #12484
2015-09-23 01:26:24 -04:00
3f135e3fac Clarified that .yml, .yaml, and .json are allowable file extensions for inventory variables files. 2015-09-22 17:56:04 -07:00
c83f51b7f2 Some LookupBase cleanups:
* Make LookupBase an abc with required methods (run()) marked as an
  abstractmethod
* Mark methods that don't use self as @staticmethod
* Document how to implement the run method of a lookup plugin.
2015-09-22 16:19:36 -07:00
1e860d020e Merge pull request #12479 from jeffwidman/patch-1
Add mention of roles_path parameter to `ansible-galaxy install` command
2015-09-22 18:09:56 -04:00
983ee0898d Add mention of roles_path parameter to ansible-galaxy install command 2015-09-22 15:03:40 -07:00
049952fa50 Update submodule refs. 2015-09-22 14:01:53 -07:00
a421fa5bb9 added new route53_health_check module 2015-09-22 16:38:43 -04:00
1e7fd2196d Fixing synchronize + delegate_to user bug
Fixes #12464
2015-09-22 16:06:52 -04:00
3ffc2783c4 Don't bomb out on handlers with undefined variables in their names 2015-09-22 12:42:02 -04:00
4b0d52d2cb Merge pull request #12420 from ansible/win_prefix_modules
Fix for user defined modules not overriding modules from core.
2015-09-22 09:16:38 -07:00
1076155d8d When failing because of vars_files templating, try and bubble up the file/line info 2015-09-22 12:13:55 -04:00
18e2ee16ef Fix for user defined modules not overriding modules from core.
This fix takes into account that powershell modules are somewhat
different than regular modules and have to be kept separate.
2015-09-22 09:07:37 -07:00
f61fb9787d Update submodule refs 2015-09-22 08:59:10 -07:00
9514ac860d cloudstack: more integration tests 2015-09-22 16:17:21 +02:00
b43939dfd6 cloudstack: make tags handling idempotence
Credits to @jeffersongirao, who provided the patch.
2015-09-22 16:12:35 +02:00
c30e464388 Additional tweaks to callback output for delegate_to 2015-09-22 09:25:38 -04:00
513619867a Show delegated-to host in callback message
Fixes #12465
2015-09-22 08:45:04 -04:00
efd122c2f0 cloudstack: add returns_to_int return handling into utils
It is not uncommon that the API returns string for int values e.g. ports in listFirewallRules or listPortForwardings,
2015-09-22 14:44:08 +02:00
c9a3801a25 cloudstack: common argument_spec and requried_together to utils 2015-09-22 14:36:43 +02:00
f563b22446 Merge pull request #12461 from mgedmin/py3k
Python 3: there's no basestring
2015-09-22 03:11:43 -04:00
d2949f5449 Merge pull request #12463 from mgedmin/fix-ansible-doc
Fix option descriptions in ansible-doc output
2015-09-22 03:10:59 -04:00
0fb4a6a67b Tweak to the way new host variables are created for delegated hosts 2015-09-22 03:03:21 -04:00
339790adc4 Fix option descriptions in ansible-doc output
Fixes #12462.
2015-09-22 10:00:33 +03:00
18adfc6d1a Set some default vars on hosts created for delegate_to connections 2015-09-22 02:35:01 -04:00
a22f7b883d Restrict role param vars to tasks within that role
Fixes #12460
2015-09-22 02:14:18 -04:00
fc0dcc3947 Python 3: there's no basestring
Fixes one failing test.

Now technically a filename can be a bytestring, even on Python 3.  I
hope this is unlikely for Ansible.
2015-09-22 08:42:33 +03:00
ecf7d8c9ee Fix relative path bug in copy action
Without rebreaking #12055

Fixes #ansible-modules-core/2098
2015-09-22 01:31:03 -04:00
53794b692c Merge pull request #12457 from ansible/warn-if-core-modules-not-present
Detect if core modules aren't installed and warn if that is the  case
2015-09-21 21:15:54 -04:00
627f9d73ba Detect if core modules aren't installed and warn if that is the case
Fixes #11206
2015-09-21 12:31:51 -07:00
d27b73e7b5 fixed case in which boto3 is present but module is not using it yet 2015-09-21 15:16:07 -04:00
cc646c0a82 Merge pull request #12452 from lambeau/devel
Fix typo
2015-09-21 12:00:25 -04:00
cb7060c9fe Allow undefined var errors to bubble up when templating vars_files in certain conditions
Follow up to 8769f03c, which allows the undefined var error to be raised
if we're getting vars with a full context (play/host/task) and the host
has already gathered facts. In this way, vars_files containing variables
that fail to be templated are not silently ignored.
2015-09-21 11:57:37 -04:00
356cae9e5d Fix typo 2015-09-21 09:59:28 -05:00
f96255f7fd fixed typo 2015-09-21 10:10:21 -04:00
86566e691a Merge pull request #12447 from mgedmin/py3k
Python 3: there is no 'basestring'
2015-09-21 09:39:17 -04:00
8769f03c16 Also catch AnsibleUndefinedVariable errors when templating vars_files names
Fixes #12449
2015-09-21 09:35:06 -04:00
d851df3b31 Merge pull request #12448 from ansible/close-module-path
Close module file once we're done reading from it
2015-09-21 08:46:32 -04:00
2dc61bc73f Installation update for people using Fishshell 2015-09-21 11:31:44 +02:00
2a614c1c0f Close module file once we're done reading from it 2015-09-21 01:46:29 -07:00
9cdb6ebae3 Python 3: there is no 'basestring'
This fixes a failing unit test.

In actual use (which is still quite far), I'm not sure if bytes ->
unicode conversion should be done here (in which case the code will fail
with an AttributeError: 'bytes' object has no attribute 'readlines'), or
inside self._connection.exec_command() (in which case my change is
correct).
2015-09-21 08:48:59 +03:00
3f5ea43fb8 Merge pull request #12446 from mcsalgado/dict_get
Use dict.get()
2015-09-20 23:50:39 -04:00
20bbd66e85 Use dict.get() 2015-09-20 22:54:02 -03:00
65bf14cbb0 Merge pull request #12431 from hslee16/devel
Stops using _groups_list to check for host when using 'add_host'
2015-09-20 18:17:02 -04:00
f717f14fe9 Update docs (playbooks_loops.rst, playbooks_filters.rst) 2015-09-20 22:48:07 +09:00
b11a44e5b4 Merge pull request #12097 from mgedmin/patch-1
Fix typo, remove redundant paragraph
2015-09-20 05:45:06 -07:00
88e1aa94fa Add play context vars to list of variables before post validation
Fixes #12437
2015-09-19 21:51:24 -04:00
05f6e76407 Template handler names before checking to see if they need to run
Fixes #12427
2015-09-18 18:54:48 -04:00
72769d1899 Merge pull request #12432 from mgedmin/py3k
Python 3: there's no xrange
2015-09-18 15:33:08 -04:00
37f2cbc429 Merge pull request #12436 from amenonsen/ranges
Support «hosts: foo[1:]» and add tests for split/apply_subscript
2015-09-18 15:32:15 -04:00
1f5584aa5b Refactoring delegate_to code
Now, instead of relying on hostvars on the executor side, we compile
the vars for the delegated to host in a special internal variable and
have the PlayContext object look for things there when applying task/
var overrides, which is much cleaner and takes advantage of the code
already dealing with all of the magic variable variations.

Fixes #12127
Fixes #12079
2015-09-18 15:25:10 -04:00
fa69e8ebb8 Fixing some bugs in _compute_delegate() in TaskExecutor
* Clearing interpreter settings from variables, so those set for the
  original host aren't incorrectly applied to the delegated to host
* Fixed incorrect string for remote user in delegated hosts hostvars
* Properly looking for multiple possiblities in the delegated-to hosts
  hostvars (ansible_ssh_host vs. ansible_host)
2015-09-18 15:25:10 -04:00
5dd61ad3fe Merge pull request #12409 from mgedmin/patch-2
Fix example formatting in the documentation
2015-09-18 14:21:58 -04:00
c9ebdb98cd Merge pull request #12440 from privateip/vca
added new module object to vca
2015-09-18 14:21:34 -04:00
e45b71d6cd added new module object to vca 2015-09-18 13:45:37 -04:00
2fcdb37e7b Support «hosts: groupname[1:]» notation (~= 'the rest of the group') 2015-09-18 22:28:34 +05:30
21142f5723 Add some tests for split/apply_subscript 2015-09-18 22:15:28 +05:30
aca83b15e5 Merge pull request #12425 from privateip/devel
initial add of vca common module
2015-09-18 11:24:54 -04:00
11707576a3 fix for AIX network facts
fixes #12434
2015-09-18 10:43:53 -04:00
8288e27051 Update lookups doc with shelvefile example 2015-09-18 14:51:03 +02:00
d7b61db6dc made boto3 non mandatory 2015-09-18 08:05:33 -04:00
fdb1c14004 Update the submodule pointers 2015-09-18 04:49:30 -07:00
a3064d175e added cs_user to changelog 2015-09-18 07:46:43 -04:00
27f779a7cc Small clean up and refactor of the rsync target ipv6 observing formatter for synchronize action. 2015-09-18 11:46:33 +02:00
baf9320369 Python 3: there's no xrange
Use six.moves.range instead (aliased to xrange on Python 2, aliased to
range on Python 3).

Also I couldn't resist replacing the elaborate chr/ord/randrange dance
with the simpler random.choice(string.ascii_lowercase) that was already
used elsewhere in the Ansible codebase.
2015-09-18 08:52:26 +03:00
cf289191e5 return None if group does not exist in inventory groups 2015-09-17 15:58:10 -07:00
6f3f4dff7a Change synchronize module plugin to be backwards compatible with RSync 2.6.9 with regard to handling IPv6 addresses. 2015-09-17 23:19:11 +02:00
cc6627cdd6 Remove custom json encoder cleaner and strip proxy var stuff out before encoding
Fixes #12349
2015-09-17 16:04:47 -04:00
a431121f9f Tweak to hacking path fix to go back to subshell use 2015-09-17 15:26:45 -04:00
52bf06661d Merge pull request #12426 from evanccnyc/devel
Allow env-setup to use spaces in full path
2015-09-17 15:21:30 -04:00
EC
bcdb4e78ae Allow env-setup to use spaces in full path 2015-09-17 15:11:25 -04:00
c95d4ca05f Properly assign search path to environment.loader in template lookup
Same fix as was applied in f162990c to the action plugin

Fixes #12355
2015-09-17 14:47:20 -04:00
bde5ed9672 Catch worker errors that may be subclassed on others that lead to incorrect exits 2015-09-17 14:46:53 -04:00
8f43d222c0 initial add of vca common module 2015-09-17 14:41:53 -04:00
053c41e79d Fix typo in ansible module_utils import from galaxy code 2015-09-17 14:25:48 -04:00
7b778d8a4b Merge pull request #12424 from amenonsen/ipv6-ranges
Tested.  Thanks for spotting and then fixing this -- Allow hexadecimal ranges in IPv6 addresses, not only 0-9
2015-09-17 14:21:03 -04:00
2d420a9bb7 Allow hexadecimal ranges in IPv6 addresses, not only 0-9 2015-09-17 23:32:58 +05:30
b386f0c64d Merge pull request #12423 from amenonsen/split-fixup
Remove deprecation warning; now handled in _split_patterns
2015-09-17 14:02:22 -04:00
7ae03f8342 Merge branch 'amenonsen-addresses' into devel 2015-09-17 14:00:04 -04:00
a1fffff92c Merge branch 'addresses' of https://github.com/amenonsen/ansible into amenonsen-addresses 2015-09-17 13:43:05 -04:00
62ca6b5e35 Remove deprecation warning; now handled in _split_patterns 2015-09-17 23:09:56 +05:30
575a8b8c77 Merge Host.ipv[46]_address into .address
The earlier distinction was never used; .ipv6_address was always a copy
of .ipv4_address, and the latter was always used to set the remote_addr
field in the PlayContext.

Also uses the canonical ansible_host/ansible_port names when setting the
address and port from variables.
2015-09-17 23:03:48 +05:30
cc4601258d Merge branch 'amenonsen-hostpatterns' into devel 2015-09-17 13:32:10 -04:00
951128d7a6 Merge branch 'hostpatterns' of https://github.com/amenonsen/ansible into amenonsen-hostpatterns 2015-09-17 13:31:51 -04:00
713f5ab79d Merge pull request #1 from mcsalgado/hostpatterns
More tests, better handling of list arguments to _split_pattern
2015-09-17 22:48:12 +05:30
14fefebaad Modify _split_pattern to use map when working with list input 2015-09-17 13:52:54 -03:00
01ae60d524 Add more tests for _split_pattern for when the input is a list 2015-09-17 13:50:40 -03:00
46baed864f Submodule update after correcting doc bug 2015-09-17 11:30:38 -04:00
0beb37a121 Submodule update 2015-09-17 11:26:54 -04:00
6fabcafbf1 Adding new module os_user_group to CHANGELOG 2015-09-17 11:23:53 -04:00
d875699ac2 Merge branch 'apollo13-sudo_on_if_needed' into devel 2015-09-17 11:03:54 -04:00
ba82e57445 Merge branch 'sudo_on_if_needed' of https://github.com/apollo13/ansible into apollo13-sudo_on_if_needed 2015-09-17 11:03:27 -04:00
8532ddd5ed typo in formatting the warning message 2015-09-17 08:01:43 -07:00
4ae5512fb0 Restore python3 compat fix and fix AnsibleError undefined before use 2015-09-17 07:45:21 -07:00
c881b1acae Merge pull request #12407 from mgedmin/py3k
Python 3: basestring in play_context.py
2015-09-17 10:40:57 -04:00
8acbc00853 Fixing groups variable structure to match v1
Fixes #12418
2015-09-17 10:24:03 -04:00
349eec7855 Fix missing colon (typo) in IPv6 pattern 2015-09-17 19:34:33 +05:30
b47bc343ea Document , instead of : in intro_patterns, update changelog 2015-09-17 19:34:19 +05:30
abd006657b Add test/units/inventory with a few _split_pattern tests
There were no inventory-specific unit tests earlier, so we add a new
directory for them with some initial low-level tests of _split_pattern
with various valid and deprecated pattern strings.
2015-09-17 19:32:14 +05:30
2405861a9e Use ',' instead of ':' or ';' to separate host patterns
The earlier-recommended "pat1:pat2:pat3[x:y]" notation doesn't work well
with IPv6 addresses, so we recommend ',' as a separator instead. We know
that commas can't occur within a pattern, so we can just split on it.

We still have to accept the "foo:bar" notation because it's so commonly
used, but we issue a deprecation warning for it.

Fixes #12296
Closes #12404
Closes #12329
2015-09-17 19:31:16 +05:30
d9f873495e Ported over #7158 to support SELinux context switches. 2015-09-17 15:03:46 +02:00
8548690ca3 Added a test to ensure that sudo is only used if remote and become user difer. 2015-09-17 14:25:52 +02:00
24388421c2 Merge pull request #12417 from OddEssay/retry_files_documentation
Documentation for retry_files_enabled and retry_files_save_path
2015-09-17 08:14:02 -04:00
ee840f3029 fixed function signature 2015-09-17 07:47:51 -04:00
87fc5640d4 Comments to explain retry_files_enabled and retry_files_save_path 2015-09-17 12:05:46 +01:00
f14c617084 Documentation for retry_files_enabled and retry_files_save_path 2015-09-17 11:59:32 +01:00
decd9e8710 Only use become if the target user difers from the current remote user. 2015-09-17 12:24:16 +02:00
5d3d53e890 Fix example formatting 2015-09-17 11:05:37 +03:00
8243954dcd Python 3: basestring in play_context.py 2015-09-17 08:08:55 +03:00
3db8070aa3 Fix urlopen usage to use open_url instead
Add a travis test for urlopen usage
2015-09-16 20:40:17 -07:00
e97d448838 Cleanup one more missed inventory bug 2015-09-16 16:53:08 -04:00
5db9e38377 Merge pull request #12345 from mgedmin/py3k
Python 3: two more instances of 'basestring'
2015-09-16 16:49:46 -04:00
43b15ab9a4 Merge pull request #12385 from cchurch/winrm_put_empty_file
Enable winrm put_file to upload an empty file.
2015-09-16 16:46:01 -04:00
93af0b327f Merge pull request #12384 from cchurch/powershell_strict_mode
Add PowerShell exception handling and turn on strict mode.
2015-09-16 16:45:40 -04:00
0685262d06 Merge pull request #12397 from lambeau/devel
Fix spelling
2015-09-16 16:44:09 -04:00
0325f92b6a Merge pull request #12054 from cchurch/winrm_options
Support additional options for WinRM connections via inventory variables
2015-09-16 16:39:18 -04:00
c5409ab493 Remove ansible_winrm_ host/port/user/pass options, update exception handling around establishing a winrm connection. 2015-09-16 16:38:19 -04:00
056c6b77d0 Support additional options for WinRM connections via inventory variables. 2015-09-16 16:38:18 -04:00
11c27078c0 Cleaning up inventory bugs from earlier group change 2015-09-16 16:36:27 -04:00
8b56bc1c01 Merge pull request #12051 from cchurch/winrm_pass_cmd_as_is
Pass windows command as-is without splitting/rejoining parameters.
2015-09-16 16:31:23 -04:00
1d15e8f37a Pass windows command as-is without splitting/rejoining parameters.
* Fixes extra spaces added between parameters from https://github.com/ansible/ansible-modules-core/issues/1929
* Correctly decode PowerShell command encoded as UTF-16-LE so that it displays correctly in debug messages, fixes the other issue from https://github.com/ansible/ansible-modules-core/issues/1929
* Add test to verify that script parameters are passed as-is, so $true is interpreted as a boolean, fixes https://github.com/ansible/ansible/issues/10947
2015-09-16 16:30:10 -04:00
87db5119ea Merge pull request #12049 from cchurch/win_group_tests
Add integration tests for win_group module.
2015-09-16 16:27:44 -04:00
b44e02143a Merge pull request #12050 from cchurch/test_win_msi_creates
Add tests for creates parameter to win_msi module.
2015-09-16 16:22:47 -04:00
da9fc9cffb Merge pull request #12399 from jkugler/patch-3
Fixing a small typo
2015-09-16 16:09:52 -04:00
b44bc608e7 Merge pull request #12400 from mcsalgado/dict_default_argument
Fix mutable default argument
2015-09-16 16:09:27 -04:00
54f1560d3e Fix mutable default argument 2015-09-16 16:49:45 -03:00
3004e9bec8 Fixing a small typo
Just adding a missing letter.
2015-09-16 11:00:19 -08:00
33e79203ce Merge branch 'quinot-topic/crash_empty_inventory' into devel 2015-09-16 13:15:40 -04:00
24ffa5f230 Tweak sample blocks of blocks a bit more 2015-09-16 13:15:12 -04:00
c8f2483d6d Cleaning up default group creation in inventory parsers 2015-09-16 12:54:54 -04:00
30552cf7e9 Fix problems with undefined references to self.display and remove method that's no longer called 2015-09-16 09:27:28 -07:00
ffc67f0a37 Fix spelling 2015-09-16 10:48:23 -05:00
3f8e12d1f7 Merge pull request #12359 from cchurch/fetch_no_fail_on_missing
Fix fetch to not fail for missing file when fail_if_missing=False
2015-09-16 11:05:39 -04:00
4429e7611b Merge pull request #12382 from AxelDelmas/env_async
Added env_string in async_cmd
2015-09-16 11:04:40 -04:00
719e4020e0 Merge pull request #12387 from jkugler/patch-1
Small change so the YAML renders as code.
2015-09-16 10:38:23 -04:00
f6aa88fb77 Merge pull request #12388 from jkugler/patch-2
Wrong column named
2015-09-16 10:37:56 -04:00
e899b8e70d Merge branch 'topic/crash_empty_inventory' of https://github.com/quinot/ansible into quinot-topic/crash_empty_inventory 2015-09-16 10:08:43 -04:00
216d63a1ea Tweak sample blocks of blocks a bit more 2015-09-16 09:56:41 -04:00
b2848bd25f Merge pull request #12389 from amenonsen/minus-t
Set PlayContext.timeout from the value specified by -T on the command-line
2015-09-16 09:49:39 -04:00
d91ff0db74 Fixing parent block serialization for blocks
Fixes #12395
2015-09-16 09:29:16 -04:00
c005f75469 Always create 'all' group
Create 'all' even if host_list is empty, as this group needs to exist
when creating the implicit 'localhost' host.

Fixes #12391
2015-09-16 12:24:06 +02:00
85bb508f26 Set PlayContext.timeout from the value specified by -T on the command-line
Fixes #12372
2015-09-16 08:57:25 +05:30
d31f61e35c Wrong column named
Correcting the docs to match the example, which I assume to be correct.
2015-09-15 15:49:38 -08:00
1dc7cce910 Small change so the YAML renders as code.
The line above the last YAML code block in this document did not have the requisite :: characters, so the YAML did not render correctly in the docs.
2015-09-15 15:37:20 -08:00
2a50957ad8 Fix galaxy install dep failure
Also fixes issue where force does not force reinstall of deps

Fixes #10425
2015-09-15 17:31:47 -04:00
1a39e32a13 Update core modules ref 2015-09-15 14:26:09 -07:00
6ab4cff7db Enable winrm put_file to upload an empty file. 2015-09-15 17:21:27 -04:00
5c65ee7f0c Add PowerShell exception handling and turn on strict mode.
* Add exception handling when running PowerShell modules to provide exception message and stack trace.
* Enable strict mode for all PowerShell modules and internal commands.
* Update common PowerShell code to fix strict mode errors.
* Fix an issue with Set-Attr where it would not replace an existing property if already set.
* Add tests for exception handling using modified win_ping modules.
2015-09-15 16:32:35 -04:00
a1948dd1c1 Merge branch 'bcoca-normalize_plugin_paths' into devel 2015-09-15 14:48:11 -04:00
a7e1113b26 Removing FIXME comment which is no longer required 2015-09-15 14:47:49 -04:00
d818a72375 Merge branch 'normalize_plugin_paths' of https://github.com/bcoca/ansible into bcoca-normalize_plugin_paths 2015-09-15 14:41:09 -04:00
4802641de7 Added env_string in async_cmd 2015-09-15 20:11:14 +02:00
60c139e482 Fix logic for changed/failed_when + retry/until loops
Fixes #11809
2015-09-15 13:37:35 -04:00
8e664ad226 Fix delegate_to localhost vs. 127.0.0.1 (and ::1) 2015-09-15 13:08:54 -04:00
38573c55bf Tweak failure condition for field attributes expected to be strings 2015-09-15 13:08:40 -04:00
15070e2af8 Merge pull request #11790 from brianlloyd/win_lineinfile
Integration tests for windows implementation of lineinfile
2015-09-15 13:00:36 -04:00
cfdaec0c22 Make sure string attributes are strings from YAML to avoid bad type conversions
Fixes #12367
2015-09-15 12:17:55 -04:00
0aeaacb947 fixed zpellings 2015-09-15 12:06:40 -04:00
b6d6c2e4db corrected all missing paths changes 2015-09-15 11:57:54 -04:00
15915bb3ca NSoT Inventory: python2.7 -> python shebang 2015-09-15 08:53:38 -07:00
4241df41aa fixed typoe (thanks @resmo) 2015-09-15 11:45:55 -04:00
4aea1f6568 normalized plugin paths and names and configs 2015-09-15 11:44:09 -04:00
7f52d909c4 rewrote 1.x section of precedence to prevent promissing specificity to those reading docs for earlier versions 2015-09-15 11:40:53 -04:00
6e34e84417 documenting var precedence
made new sections for vars, started explaining scope, gave example on command line override of connection vars
added some formatting changes and clarifications
2015-09-15 11:40:53 -04:00
7c669f5a33 Merge pull request #12375 from jhawkesworth/configuring_kerberos_doc
Documentation PR. Add kerberos configuration instructions to windows intro page
2015-09-15 10:23:53 -04:00
746052323b Merge pull request #12377 from tgerla/typo-fix
typo fix
2015-09-15 10:15:22 -04:00
e5a981e713 typo fix 2015-09-15 10:00:01 -04:00
02372e9761 Merge pull request #12371 from apollo13/patch-1
Remove duplicate SU_PROMPT_LOCALIZATIONS
2015-09-15 09:54:07 -04:00
5c7bca9e17 Merge pull request #12369 from bborysenko/docsite/playbooks_variables
docs - minor fixes to playbooks_variables
2015-09-15 09:53:23 -04:00
43ea5f0853 added note about registered variables 2015-09-15 09:49:22 -04:00
f080a48f22 Merge pull request #12365 from gptech/patch-1
Replace 'degug' with 'debug'
2015-09-15 09:40:45 -04:00
9334046189 Remove duplicate SU_PROMPT_LOCALIZATIONS 2015-09-15 10:40:25 +02:00
=
e5cad0fd9a Add kerberos configuration instructions to windows intro 2015-09-15 08:57:08 +01:00
6b396cdab7 fix code block quoting and boldface for modules name 2015-09-15 10:56:41 +03:00
c05970df2c Added NSoT Inventory script to pull from Device resources 2015-09-15 00:53:34 -07:00
904b8ca27b Update win_msi tests to specify msi url and paths via variables. 2015-09-15 01:15:33 -04:00
0300294f6e Add tests for creates parameter to win_msi module. 2015-09-15 01:15:33 -04:00
1c6be7b9ba Replace 'degug' with 'debug'
Tiny typo fix.
2015-09-14 23:21:03 -04:00
97b99e4517 Merge pull request #12361 from Ch00k/os_docs_typo
Fix a tiny typo
2015-09-14 16:23:51 -04:00
af213241ab Fix typo 2015-09-14 21:11:40 +02:00
e7807c4f2d Merge pull request #12339 from emonty/feature/openstack-no-log
Add no-log parameter to common openstack args
2015-09-14 15:03:09 -04:00
e342e1df29 Merge pull request #12360 from Yannig/devel_fix_ini_doc
Fix ansible v2 documentation for ini lookup plugin
2015-09-14 15:02:10 -04:00
54eb08eb0d Fix ansible v2 documentation for ini lookup plugin (property => properties). 2015-09-14 20:50:09 +02:00
4f30db8ca5 Check if path is /dev/null when checking if a file is in fact a file 2015-09-14 14:41:22 -04:00
260b9f648c Fix fetch action plugin to not fail if file is missing and fail_if_missing=False (the default). Add tests to test_fetch role to verify it works as expected. 2015-09-14 14:21:52 -04:00
36b5858f51 Fix unit tests for change related to local_action 2015-09-14 14:07:17 -04:00
feee4613cd Merge pull request #12357 from apollo13/become_fix
Fixed #12356 -- Restored ansible 1.9.x become behavior.
2015-09-14 12:27:45 -04:00
49ca0eb797 Track local_action internally to prevent it from being overridden
Fixes #12053
2015-09-14 12:11:58 -04:00
8182eb3787 Fixed #12356 -- Restored ansible 1.9.x become behavior. 2015-09-14 17:53:14 +02:00
d8b671ca76 Merge pull request #12348 from bborysenko/docsite/playbooks_intro
docsite - playbooks_intro - minor tweaks
2015-09-14 09:25:13 -04:00
0f5133b657 Merge pull request #12336 from halberom/doc_fix_filters
docsite - playbooks_filters - minor tweaks
2015-09-14 08:53:29 -04:00
4064063794 use boldface for modules name 2015-09-14 10:01:07 +03:00
f5cfb5577e fix code block quoting 2015-09-14 09:55:39 +03:00
9877a5c415 Python 3: two more instances of 'basestring'
Fixes two failing tests on Python 3.4.
2015-09-14 08:27:39 +03:00
3bdd6793ca Add no-log parameter to common openstack args
These bad boys can contain secret data, so should be marked no-log.
2015-09-13 19:48:37 +02:00
e5211a9b18 playbooks_filters - minor fixes 2015-09-13 12:29:53 +01:00
f0efe1ecb0 Merge pull request #12334 from geerlingguy/changelog-fixes
Clean up Ansible 2.0 release notes in CHANGELOG.md.
2015-09-12 22:40:29 -04:00
aa762bb432 Don't split args out unless we're parsing module args using the new style
Fixes #12331
2015-09-12 17:50:05 -04:00
1cb4e0be1c Fix bug in implicit block squashing where block is not reassigned
Fixes #12333
2015-09-12 11:27:30 -04:00
7deb8bbd1c Reworking how includes within handlers are run
Fixes #12238
2015-09-12 08:46:29 -04:00
c9860000da Uncommenting sample line in include.yml to help debug issues 2015-09-12 08:46:29 -04:00
0857e29e77 Clean up Ansible 2.0 release notes in CHANGELOG.md. 2015-09-11 21:08:01 -05:00
03758151e4 Merge pull request #12330 from cchurch/revert_find_plugin_changes
Revert "Fix order of loading of modules."
2015-09-11 20:05:37 -04:00
9d4d7bd74d fixed porting bugs in profile_tasks to v2 2015-09-11 16:48:09 -04:00
ba7734b78b Merge pull request #12165 from amenonsen/address-parsing
Hi @amenonsen - thanks for fixing up the hunting down the unicode bug and expanding test_addresses.  The code looks good, merging!-- Be systematic about parsing and validating hostnames and addresses
2015-09-11 15:25:50 -05:00
4156bcedf5 Fix typo in 049a48f 2015-09-11 15:54:24 -04:00
ed3a9795d4 Revert "Fix order of loading of modules."
This reverts commit 4b895f04e3.
2015-09-11 14:16:30 -04:00
1243686b90 Submodule update 2015-09-11 13:11:15 -04:00
6cf99cf614 Merge pull request #12328 from amenonsen/noneguard
Test state.tasks_child_state before dereferencing
2015-09-11 12:37:23 -04:00
049a48f3d3 Test state.tasks_child_state before dereferencing
I hit a traceback in the FAILED_TASKS case, but it seemed prudent to add
guards in the other similar branches.
2015-09-11 21:59:08 +05:30
df89f03627 Fixing precedence order for new nonpersistent vars (set_fact/register)
These used to go in vars_cache, so merging them in after that as they
are "live" variables and the user would most likely want to see these
above anything else.
2015-09-11 12:24:44 -04:00
88a20e7a20 Fix broken integration test with unicode hostnames
1. The test did "name: '{{hostnames}}.{{item}}'" inside a with_sequence
   loop, which didn't do what was intended: it expanded hostnames into
   an array, appended ".1", and set name to the resulting string. This
   can be converted to a simple with_items loop.

2. Some of the entries in hostnames contained punctuation characters,
   which I see no reason to support in inventory hostnames anyway.

3. Once the add_host failures are fixed, the playbook later fails when
   the unicode hostnames are interpolated into debug output in ssh.py
   due to an encoding error. This is only one of the many places that
   may fail when using unicode inventory hostnames; we work around it
   by providing an ansible_ssh_host setting.
2015-09-11 21:47:19 +05:30
7479ab47e0 Be stricter about parsing hostname labels
Labels must start with an alphanumeric character, may contain
alphanumeric characters or hyphens, but must not end with a hyphen.
We enforce those rules, but allow underscores wherever hyphens are
accepted, and allow alphanumeric ranges anywhere.

We relax the definition of "alphanumeric" to include Unicode characters
even though such inventory hostnames cannot be used in practice unless
an ansible_ssh_host is set for each of them.

We still don't enforce length restrictions—the fact that we have to
accept ranges makes it more complex, and it doesn't seem especially
worthwhile.
2015-09-11 21:47:19 +05:30
065bb52109 Be systematic about parsing and validating hostnames and addresses
This adds a parse_address(pattern) utility function that returns
(host,port), and uses it wherever where we accept IPv4 and IPv6
addresses and hostnames (or host patterns): the inventory parser
the the add_host action plugin.

It also introduces a more extensive set of unit tests that supersedes
the old add_host unit tests (which didn't actually test add_host, but
only the parsing function).
2015-09-11 21:47:18 +05:30
49803509b4 Make sure include paths are templated before dwim in case they're absolute
Fixes #12327
2015-09-11 11:57:43 -04:00
4cdd9b2a82 Merge pull request #12318 from mgedmin/py3k
Python 3: make ansible.template.safe_eval() work
2015-09-11 10:44:37 -04:00
52f587cac3 Merge pull request #12325 from quinot/topic/wrong_interp_test
Test for Python must be against basename of interpreter
2015-09-11 09:47:49 -04:00
c2115c3715 Re-adding part of 926f127 which was actually fixing #12277 2015-09-11 09:45:27 -04:00
083aef65ad Revert "set_fact should put facts in the fact_cache, not vars_cache"
This reverts commit 926f127245.
2015-09-11 09:45:27 -04:00
0bc9223826 Test for Python must be against basename of interpreter
Followup on issue #12076
2015-09-11 13:29:34 +02:00
441a8af671 Merge pull request #12267 from h-hirokawa/add_replacer_jsonargs
Add the new module replacer <<INCLUDE_ANSIBLE_MODULE_JSON_ARGS>>.
2015-09-11 02:44:50 -04:00
f91b28ef23 Fix safe_eval() of set literals
There was code to support set literals (on Python 2.7 and newer), but it
was buggy: SAFE_NODES.union() doesn't modify SAFE_NODES in place,
instead it returns a new set object that is then silently discarded.

I added a unit test and fixed the code.  I also changed the version
check to use sys.version_tuple instead of a string comparison, for
consistency with the subsequent Python 3.4 version check that I added in
the previous commit.
2015-09-11 09:41:05 +03:00
2b73002044 Python 3: make ansible.template.safe_eval() work
Two things changed in Python 3.4:

- 'basestring' is no longer defined, so use six.string_types

- True/False are now special AST node types (NamedConstant) rather than
  just names

(Good thing we had tests, or I wouldn't have noticed the 2nd thing!)

I found only one place where safe_eval() is called inside the ansible
codebase: in lib/template/__init__.py.  The call to safe_eval(result,
...) is protected by result.startswith('...'), which means result cannot
possibly be a byte string on Python 3 (or startswith() would raise, so
six.string_types (which excludes byte strings on Python 3) is fine here.
2015-09-11 09:37:44 +03:00
0c5bbe3c32 Use the original (un-templated) args for include params
Fixes #12314
2015-09-11 00:53:27 -04:00
5809a2e81d Merge pull request #12299 from resmo/feature/test_cs_user
cloudstack: new integration test role test_cs_user
2015-09-10 20:09:59 -04:00
292e2da4e1 Fix some bugs related to facts/nonpersistent-facts cache split
Fixes #12313
2015-09-10 17:36:39 -04:00
1e2dc212bd added openvswitch_db 2015-09-10 17:27:12 -04:00
444987cde6 Fix unit test for plugins after basedir/push_basedir removal 2015-09-10 17:01:52 -04:00
91c9df2154 added verbosity to ansible-doc to make it easier to trace down issues 2015-09-10 16:50:14 -04:00
b35529b09f Submodule pointer update 2015-09-10 15:44:30 -04:00
95a58d1178 Properly serialize UnsafeProxy objects
Required as part of fix for #12123
2015-09-10 14:01:02 -04:00
a410bf26d3 Wrap registered variables in UnsafeProxy
Fixes #12123
2015-09-10 14:01:02 -04:00
46bf3d1bc1 Remove plugin._basedirs as we now use different data structures to achieve that functionality. 2015-09-10 10:41:31 -07:00
e6c9efec63 Merge pull request #12310 from amenonsen/hostport
Rename ansible_ssh_{host,port,user} in docs to ansible_*
2015-09-10 10:15:15 -04:00
f56a6e0951 Rename ansible_ssh_{host,port,user} in docs to ansible_*
The _ssh variants will continue to work, but the shorter, more generic
names are preferred now.
2015-09-10 19:41:47 +05:30
6dac8512a1 Merge pull request #12307 from jtyr/doc_fixes
Doc fixes
2015-09-10 09:17:22 -04:00
14dc16ca54 Adding missing colon to fix the block formating 2015-09-10 15:14:23 +02:00
1fed03a6bd Merge pull request #12308 from jtyr/comment_filter_v2
Resurrection of the comment filter
2015-09-10 08:53:51 -04:00
174f805fb3 Resurrection of the comment filter 2015-09-10 14:37:42 +02:00
90e005d234 Merge pull request #12302 from mgedmin/py3k
Python 3: use the right PyYAML SafeRepresenter for unicode
2015-09-09 23:41:09 -07:00
b95e3d18a7 Python 3: use the right PyYAML SafeRepresenter for unicode
PyYAML has a SafeRepresenter in lib/... that defines

    def represent_unicode(self, data):
        return self.represent_scalar(u'tag:yaml.org,2002:str', data)

and a different SafeRepresenter in lib3/... that defines

    def represent_str(self, data):
        return self.represent_scalar('tag:yaml.org,2002:str', data)

so the right thing to do on Python 3 is to use represent_str.

(AnsibleUnicode is a subclass of six.text_type, i.e. 'str' on Python 3.)
2015-09-10 08:57:53 +03:00
6de13c3062 Merge pull request #11818 from Java1Guy/module_utils_ec2_for_ecs
change ec2 util to create only requested objects
2015-09-10 11:06:19 +05:30
ee7905c7e1 Compare include params against deprecated param names too
Fixes #12282
2015-09-09 22:15:50 -04:00
950e067d2f Merge pull request #12295 from napkindrawing/patch-3
Typo in comment: "bsaename" → "basename"
2015-09-09 21:41:13 -04:00
f576e0f1af Merge pull request #12300 from robusto/devel
Vault missing DataLoader for pwd file #12293
2015-09-09 18:52:31 -04:00
22639a2a22 Fix mistake in fact setting to nonpersistent cache in VariableManager
Fixes #12301
2015-09-09 18:28:39 -04:00
aa3b290efd Fix indent on line in playbook executor 2015-09-09 18:10:38 -04:00
4b895f04e3 Fix order of loading of modules.
Allows ANSIBLE_LIBRARY to overload core modules even if the module in
ANSIBLE_LIBRARY doesn't have a .py extension.
2015-09-09 15:00:26 -07:00
e81947c3b4 Fix vars_prompt short form support (and mark deprecated) 2015-09-09 17:52:44 -04:00
f6382a160d cloudstack: new integration test role test_cs_user 2015-09-09 22:36:19 +02:00
6062519986 Vault missing DataLoader for pwd file #12293 2015-09-09 15:33:52 -05:00
be7bd392cb Fix unreachable host detection and have plays continue after unreachable failures
Fixes #12284
2015-09-09 15:27:26 -04:00
25c97fff69 Merge pull request #12294 from ansible/fix-password-lookup
Fix problem with "=" in the initial file path.
2015-09-09 11:48:30 -07:00
0dbebfddaa Revert "remove closing connections after every task, this goes against conneciton caching and was not expected behaviuor nor inhertited from v1"
needed for winrm, disabled closing connections in ssh to avoid issues with that persistance, need to normalize all this in future

This reverts commit 23a22397bf.
2015-09-09 14:21:56 -04:00
3f0e14c2a0 disabled ssh closing connections 2015-09-09 14:21:46 -04:00
e2c49b4ef4 Fix problem with "=" in the initial file path. 2015-09-09 11:14:31 -07:00
56d7f3889d Add new level of vars to deal with set_fact/register precedence rules 2015-09-09 12:21:07 -04:00
172bbac97a Typo in comment: "bsaename" → "basename" 2015-09-09 11:55:40 -04:00
926f127245 set_fact should put facts in the fact_cache, not vars_cache
Also fixes a template path lookup issue when using an include

Fixes #12277
2015-09-09 11:10:18 -04:00
e2e9319f06 Merge pull request #12287 from mgedmin/py3k
Python 3: use six.string_types instead of basestring
2015-09-09 01:35:46 -07:00
fa2edfa1ef * Make sure we don't sometimes get byte strings instead of unicode strings
* Turn strings into byte strings before passing to shlex and turn them
  back into unicode strings after they are retyurned from there

  Fixes #12257
2015-09-09 01:24:11 -07:00
e67459df86 Fix docstring of parse_value() to be informative 2015-09-09 01:24:11 -07:00
ba0cf42ce9 Python 3: use six.string_types instead of basestring
Reduces the number of failing tests from 35 to 17.
2015-09-09 09:25:23 +03:00
3a50393cf7 Merge pull request #12269 from mgedmin/py3k
Python 3: fix TypeError: unorderable types in test
2015-09-08 18:11:31 -07:00
1f4c65ab9a Merge pull request #12283 from kennethgillen/patch-1
s/rpmbuild/rpm-build
2015-09-08 14:27:11 -04:00
00d2a80542 s/rpmbuild/rpm-build
When I followed these instructions, the generated path was 'rpm-build', not 'rpmbuild'. My rpm-build version is rpm-build-4.11.1-25.el7.x86_64 if that's relevant. Maybe this is 'just me', but wanted to feed back in case it's the same for everyone.
2015-09-08 17:59:53 +01:00
1d7b493db3 Fix inclusion of the dynamic inventory scripts 2015-09-08 09:51:58 -07:00
c1039de70c Compatibility with six-1.3.0 2015-09-08 09:46:12 -07:00
30399edada Use UnsafeProxy for lookup results too
Also fixes a couple of bugs that popped up when using the proxy class
2015-09-08 12:19:39 -04:00
f0411217e6 Merge pull request #12281 from wenottingham/patch-8
Update intro_windows.rst
2015-09-08 11:15:00 -04:00
e2e15992b7 Update intro_windows.rst
Fix typo that broke RST -> html parsing.
2015-09-08 11:06:54 -04:00
246e602fce added note on ssh and sftp to managed node intro 2015-09-08 09:39:28 -04:00
91a5d06c21 added note on os x file limits 2015-09-08 09:18:14 -04:00
f1c72a55a5 Merge pull request #12261 from toshywoshy/12169
added Manjaro as an Archlinux family
2015-09-08 08:24:01 -04:00
a424f3f7a5 Merge pull request #12278 from praveenkumar/doc_fix
Update doc to use 'become' instead of 'sudo'
2015-09-08 08:17:10 -04:00
2fb98152ad Update doc to use 'become' instead of 'sudo' 2015-09-08 15:42:56 +05:30
bd405169fb Fix #12258: don't wrap None in UnsafeProxy. 2015-09-08 04:02:04 -04:00
ac6f61ec7f Properly handle group/host_var files with dots in them
Fixes #12245
2015-09-08 03:20:09 -04:00
1eb5b42705 Don't double proxy unsafe variables
Potential fix for #12260
2015-09-08 02:50:07 -04:00
dc945b8040 Merge pull request #12265 from ansible/fix-amazon-linux-rpm-build
Potential fix for amazon linux's rpm doing something strange with the python_sitelib macro #12166
2015-09-07 23:13:39 -07:00
c22f4ee697 Add a comment explaining why async = 1 in the test 2015-09-07 19:46:05 +03:00
8a7a37b535 Merge pull request #12268 from jaingaurav/ipv6
Fix rsync connections to IPv6 addresses
2015-09-07 03:04:01 -04:00
1a1c9203e2 Python 3: fix TypeError: unorderable types in test
The full error was

======================================================================
ERROR: test_task_executor_execute (units.executor.test_task_executor.TestTaskExecutor)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/mg/src/ansible/test/units/executor/test_task_executor.py", line 252, in test_task_executor_execute
    mock_action.run.return_value = dict(ansible_facts=dict())
  File "/home/mg/src/ansible/lib/ansible/executor/task_executor.py", line 317, in _execute
    if self._task.async > 0:
TypeError: unorderable types: MagicMock() > int()

----------------------------------------------------------------------

Experiments show that Python 2 MagicMock() > 0 is true, so I'm setting
the async property on mock_task to 1.  (If I set it to 0, the test fails
anyway.)
2015-09-07 09:49:28 +03:00
6c107258fa Fix rsync connections to IPv6 addresses
Similar to https://github.com/ansible/ansible/pull/11816 we can unconditionally
wrap the host address in square brackets. This is required by rsync for IPv6
addresses.
2015-09-06 22:20:45 -07:00
cd478a76fc Add the new module replacer <<INCLUDE_ANSIBLE_MODULE_JSON_ARGS>>.
Fixes #12266
2015-09-07 12:01:26 +09:00
fab0e49f31 Potential fix for amazon linux's rpm doing something strange with the python_sitelib macro #12166 2015-09-06 09:08:34 -07:00
718812d945 update submodule refs for documentation formatting 2015-09-05 08:56:15 -07:00
26e109aa13 Update module refs 2015-09-05 08:27:48 -07:00
4702d2be09 added Manjaro as an Archlinux family 2015-09-05 12:49:20 +02:00
70677b030b Version bump for 2.0.0-0.2.alpha2 2015-09-04 16:50:37 -04:00
ff9f5d7dc8 Starting to add additional unit tests for VariableManager
Required some rewiring in inventory code to make sure we're using
the DataLoader class for some data file operations, which makes mocking
them much easier.

Also identified two corner cases not currently handled by the code, related
to inventory variable sources and which one "wins". Also noticed we weren't
properly merging variables from multiple group/host_var file locations
(inventory directory vs. playbook directory locations) so fixed as well.
2015-09-04 16:41:38 -04:00
87f75a50ad Use proxy class to mark variables unsafe for templating
Fixes #12191
2015-09-04 16:38:06 -04:00
2d251cba45 Merge pull request #12256 from ansible/password-lookup-fix
Use parse_kv to correctly parse parameters from password lookup
2015-09-04 12:27:18 -07:00
c68e04c185 Use parse_kv to correctly parse parameters from password lookup
Fixes https://github.com/ansible/ansible-modules-core/issues/1968
2015-09-04 12:18:46 -07:00
c72cda0684 added 2 more modules to changelog 2015-09-04 12:59:19 -04:00
6e5f3db9de updated submodule refs 2015-09-04 12:17:34 -04:00
4705409c9e Merge pull request #12250 from bcoca/become_clean
Become clean
2015-09-04 10:49:45 -04:00
c17fbf2f12 simplify become testing and handling, we had drifted and were doulbe checking prompt, become and become_pass
fixed tests to conform to new signature and now tests both with and w/o password
now we are more explicit about self.prompt
2015-09-04 10:36:16 -04:00
eb0e7e198b remove closing connections after every task, this goes against conneciton caching and was not expected behaviuor nor inhertited from v1 2015-09-04 10:36:15 -04:00
23a22397bf remove closing connections after every task, this goes against conneciton caching and was not expected behaviuor nor inhertited from v1 2015-09-04 10:11:25 -04:00
a6de4b86a8 Merge pull request #12244 from mgedmin/py3k
Python 3: use six.text_type instead of unicode
2015-09-04 00:16:01 -07:00
0eb0b56722 Replace type() checks with isinstance()
Fixes the bug I introduced in my previous commit (six.string_types is
(basestring,) on Python 2).  Thanks @abadger for noticing!
2015-09-04 09:47:17 +03:00
37be9539ff Python 3: use six.text_type instead of unicode
Replace 'unicode' with six.text_type, everywhere but in module_utils.
2015-09-04 08:40:10 +03:00
1840906f74 Merge pull request #12236 from amenonsen/ssh-cpdir
Go back to using ~/.ansible/cp as the ControlPath
2015-09-03 21:12:45 -04:00
e218bf8da9 Do not escape backslashes when processing a template file.
Fixes #12198
Fixes #12241
2015-09-03 17:45:17 -07:00
21ee4b02da Add more details to the changelog -- may move this to a porting guide
later
2015-09-03 15:24:16 -07:00
7aa6cd3f63 Go back to using ~/.ansible/cp as the ControlPath
This was commented out earlier because of the lack of interprocess
locking and prepare_writeable_dir in v2.

The locking was not needed: it could only protect against other siblings
of this process (since they were all locking a temporary file that was
opened in the parent), and those would be running as the same user and
with the same umask. Also, os.makedirs() tolerates intermediate paths
being created by other processes. For any other kind of error, both
locking and non-locking code paths would fail in the same way.

So all we really need to do is make sure we have write permissions.

(We also move the cp_dir handling code to where we actually set the
ControlPath ourselves; if the user has set it via ssh_*args already,
we don't need to bother.)
2015-09-04 00:35:13 +05:30
b2cb3153f1 Fix unit tests for PlayIterator changes regarding fact gathering 2015-09-03 14:25:43 -04:00
4ac2bafc4b Set hosts fact gathering flag based on fact cache entries
Fixes #12213
2015-09-03 14:11:19 -04:00
7ece767767 Merge pull request #12234 from ansible/travis-var-precedence
Enable the var precedence test in travis
2015-09-03 09:41:44 -07:00
2a32384a2c Merge pull request #12227 from arbabnazar/patch-1
Update developing_modules.rst
2015-09-03 11:42:14 -04:00
6650ba7654 Squashed commit of the following:
commit 9921bb9d20
Author: Abhijit Menon-Sen <ams@2ndQuadrant.com>
Date:   Mon Aug 10 20:19:44 2015 +0530

    Document --ssh-extra-args command-line option

commit 8b25595e7b
Author: Abhijit Menon-Sen <ams@2ndQuadrant.com>
Date:   Thu Aug 13 13:24:57 2015 +0530

    Don't disable GSSAPI/Pubkey authentication when using --ask-pass

    This commit is based on a bug report and PR by kolbyjack (#6846) which
    was subsequently closed and rebased as #11690. The original problem was:

        «The password on the delegated host is different from the one I
        provided on the command line, so it had to use the pubkey, and the
        main host doesn't have a pubkey on it yet, so it had to use the
        password.»

    (This commit is revised and included here because #11690 would conflict
    with the changes in #11908 otherwise.)

    Closes #11690

commit 119d032389
Author: Abhijit Menon-Sen <ams@2ndQuadrant.com>
Date:   Thu Aug 13 11:16:42 2015 +0530

    Be more explicit about why SSH arguments are added

    This adds vvvvv log messages that spell out in detail where each SSH
    command-line argument is obtained from.

    Unfortunately, we can't be sure if, say, self._play_context.remote_user
    is obtained from ANSIBLE_REMOTE_USER in the environment, remote_user in
    ansible.cfg, -u on the command line, or an ansible_ssh_user setting in
    the inventory or on a task or play. In some cases, e.g. timeout, we
    can't even be sure if it was set by the user or just a default.

    Nevertheless, on the theory that at five v's you can use all the hints
    available, I've mentioned the possible sources in the log messages.

    Note that this caveat applies only to the arguments that ssh.py adds by
    itself. In the case of ssh_args and ssh_extra_args, we know where they
    are from, and say so, though we can't say WHERE in the inventory they
    may be set (e.g. in host_vars or group_vars etc.).

commit b605c285ba
Author: Abhijit Menon-Sen <ams@2ndQuadrant.com>
Date:   Tue Aug 11 15:19:43 2015 +0530

    Add a FAQ entry about ansible_ssh_extra_args

commit 49f8edd035
Author: Abhijit Menon-Sen <ams@2ndQuadrant.com>
Date:   Mon Aug 10 20:48:50 2015 +0530

    Allow ansible_ssh_args to be set as an inventory variable

    Before this change, ssh_args could be set only in the [ssh_connection]
    section of ansible.cfg, and was applied to all hosts. Now it's possible
    to set ansible_ssh_args as an inventory variable (directly, or through
    group_vars or host_vars) to selectively override the global setting.

    Note that the default ControlPath settings are applied only if ssh_args
    is not set, and this is true of ansible_ssh_args as well. So if you want
    to override ssh_args but continue to set ControlPath, you'll need to
    repeat the appropriate options when setting ansible_ssh_args.

    (If you only need to add options to the default ssh_args, you may be
    able to use the ansible_ssh_extra_args inventory variable instead.)

commit 37c1a5b679
Author: Abhijit Menon-Sen <ams@2ndQuadrant.com>
Date:   Mon Aug 10 19:42:30 2015 +0530

    Allow overriding ansible_ssh_extra_args on the command-line

    This patch makes it possible to do:

        ansible somehost -m setup \
            --ssh-extra-args '-o ProxyCommand="ssh -W %h:%p -q user@bouncer.example.com"'

    This overrides the inventory setting, if any, of ansible_ssh_extra_args.

    Based on a patch originally by @Richard2ndQuadrant.

commit b023ace8a8
Author: Abhijit Menon-Sen <ams@2ndQuadrant.com>
Date:   Mon Aug 10 19:06:19 2015 +0530

    Add an ansible_ssh_extra_args inventory variable

    This can be used to configure a per-host or per-group ProxyCommand to
    connect to hosts through a jumphost, e.g.:

        inventory:
            [gatewayed]
            foo ansible_ssh_host=192.0.2.1

        group_vars/gatewayed.yml:
            ansible_ssh_extra_args: '-o ProxyCommand="ssh -W %h:%p -q bounceuser@gateway.example.com"'

    Note that this variable is used in addition to any ssh_args configured
    in the [ssh_connection] section of ansible.cfg (so you don't need to
    repeat the ControlPath settings in ansible_ssh_extra_args).
2015-09-03 11:26:56 -04:00
4921f52036 Merge pull request #12232 from praveenkumar/doc_fix
Fix typo to avoid traceback during testing
2015-09-03 07:05:46 -07:00
8774ff5f57 Make sure PlayContext is copied when iterating in a with_ loop 2015-09-03 08:11:30 -04:00
c16961db60 Fix two PlayIterator bugs
* When iterating over a child state, a failure should be propagated
  up so parent blocks don't continue iterating
* Make sure a child state exists before trying to search it

Fixes #12210
2015-09-03 07:48:42 -04:00
6e1f7cd503 Fix typo to avoid traceback during testing 2015-09-03 16:35:17 +05:30
7f0cd14e0f Merge pull request #12230 from mgedmin/py3k
Python 3: avoid iteritems() in a template
2015-09-03 00:14:55 -07:00
38a96d7e8f Python 3: avoid iteritems() in a template
I don't think six.iteritems is available here, but I also don't expect
there to be enough platforms to ever make the speed difference between
.items() and .iteritems() noticeable.
2015-09-03 10:11:32 +03:00
364313c01f Simplify and speed up _split_role_params() by moving an invariant outside of a loop. 2015-09-03 00:06:34 -07:00
1ae28f606b Refactor to replace filter and lambda with a generator expression 2015-09-03 00:06:34 -07:00
dac562a132 Add note about the trailing newlines change 2015-09-03 00:06:34 -07:00
9e023fedf2 Merge pull request #12228 from mgedmin/py3k
Simplify FactCache.copy()
2015-09-02 23:55:31 -07:00
a32bf1ec18 Simplify FactCache.copy()
Also fix the bug (missing from six import iteritems) I introduced in
823677b490.
2015-09-03 09:44:44 +03:00
ce97874523 Merge pull request #12226 from mgedmin/py3k
Replace .iteritems() with six.iteritems()
2015-09-02 23:40:58 -07:00
d2e547c31f Update developing_modules.rst 2015-09-03 11:27:56 +05:00
823677b490 Replace .iteritems() with six.iteritems()
Replace .iteritems() with six.iteritems() everywhere except in
module_utils (because there's no 'six' on the remote host).  And except
in lib/ansible/galaxy/data/metadata_template.j2, because I'm not sure
six is available there.
2015-09-03 09:23:27 +03:00
9e1bc434c7 Further cleanup from locking changes 2015-09-03 01:07:29 -04:00
b93f27e260 Move the lockfile back to tqm to make sure it stays unique 2015-09-03 00:45:42 -04:00
ba658ff3a9 Merge branch 'amenonsen-connection-locking' into devel 2015-09-03 00:20:33 -04:00
b9afbf0ee4 Reorganizing the way the connection lockfile is created 2015-09-03 00:18:52 -04:00
7034bbef30 Merge branch 'connection-locking' of https://github.com/amenonsen/ansible into amenonsen-connection-locking 2015-09-02 23:54:52 -04:00
3e5b90c6fb Merge pull request #12195 from amenonsen/ssh-lesswork
Make lock_host_keys a real noop, instead of half-a-noop
2015-09-02 23:53:53 -04:00
9378c8e2da Make the paramiko plugin use locking 2015-09-03 08:43:21 +05:30
5887e96b27 Introduce a connection locking infrastructure
The lock file is (a temporary file) opened in the parent process, whose
open fd is inherited by the workers after fork, and passed down through
the PlayContext. Connection grows lock/unlock methods which can be used
by individual connection plugins.
2015-09-03 08:43:21 +05:30
12d8f9132e Make lock_host_keys a real noop, instead of half-a-noop
Right now, we don't do any locking, but we still scan known_hosts files
twice per connection. That's completely unnecessary, and the proposed
solutions to the locking problem wouldn't need known_hosts scanning
anyway, so this code can go away.
2015-09-03 05:52:57 +05:30
88d3751c28 Merge pull request #12217 from thyming/hacking-remove-pyc
Delete all compiled python files when running hacking/env-setup
2015-09-02 17:13:04 -04:00
cba4642d8d Use find ... -delete instead of non-portable globbing 2015-09-02 17:05:16 -04:00
099d1797f2 added new path config setting handling 2015-09-02 16:14:40 -04:00
a006e85947 removed printing module args as it violates no_log settings 2015-09-02 16:14:40 -04:00
1b64702b9a Fix templar unittests for change in preserve_trailing_newline parameter's default value 2015-09-02 11:58:01 -07:00
1998eddf8d Keep newlines by default now.
In v1, a trailing newline was kept if the parameter was passed as key=value.  If
the parameter was passed as yaml dict the trailing newline was
discarded.  Since key-value and yaml dict were unified in v2 we have to
make a choice as to which behaviour we want.  Decided that keeping trailing
newlines by default made the most sense.

Fixes #12200
Fixes #12199
2015-09-02 11:55:45 -07:00
647e48f776 Delete all compiled python files when running hacking/env-setup 2015-09-02 14:49:02 -04:00
45aac6a739 Adding unit tests for safe_eval 2015-09-02 14:12:06 -04:00
d0d40dff9e Enable the var precedence test in travis 2015-09-02 11:04:13 -07:00
41da8de094 Speedup for counting newlines 2015-09-02 10:59:51 -07:00
843138e7d9 Merge pull request #12202 from mgedmin/py3k
Use rich comparisons for Attribute and FieldAttribute
2015-09-02 13:57:04 -04:00
5434ed973b Make sure locals in safe_eval is a plain dict when running eval
Fixes #12206
2015-09-02 13:54:58 -04:00
9ecfc30f9a * Mark all strings as unicode -- shouldn't matter for this dataset but
ansible is passing unicode arond internally so we should test the same
  data.
* Add a zero length test for _count_newlines and fix the zero newlines
  test to have no newlines.
2015-09-02 09:43:42 -07:00
417bf1c805 Unittest the _count_trailing_newlines function 2015-09-02 08:59:31 -07:00
7ed746ad45 Fix preserve_trailing_newlines (broken by 7f5080f64a )
Fix for one half of hte bug reported in #12198
2015-09-02 08:47:20 -07:00
a7231c2203 actually implemented flags correctly for all priv escalation methods 2015-09-02 11:31:39 -04:00
14f061d5ea fixed become tests 2015-09-02 10:30:00 -04:00
dfb94f0def added ec2_vpc_route_table to changelog 2015-09-02 09:58:39 -04:00
b9642585bd added missing become_exe from config 2015-09-02 09:52:26 -04:00
e156d9b677 fixed and generalized privilege escalation exe settings 2015-09-02 09:29:34 -04:00
33a374edde Use rich comparisons for Attribute and FieldAttribute
Because __cmp__ is not supported on Python 3.
2015-09-02 12:33:42 +03:00
ca908f2e12 Fix indentation to be a multiple of 4 2015-09-02 12:22:18 +03:00
e8d7fafc52 Merge pull request #12194 from amenonsen/dupe-fix
Remove duplicated function definition (fallout from earlier repeated merge)
2015-09-01 22:30:48 -04:00
147b04b682 Remove duplicated function definition (fallout from earlier repeated merge) 2015-09-02 07:47:48 +05:30
f162990cb3 Properly assign the searchpath for templates to the environment loader
dbd755e0 previously assigned the value to self._templar.environment.searchpath,
which is incorrect - it needs to be assigned to the environment.loader.searchpath
value instead.

Fixes #11931
2015-09-01 17:33:14 -04:00
2761df232e Small tweak to 7551b75 to correct the ordering of tests 2015-09-01 14:48:59 -04:00
7551b75e61 Add ispath type for constants and make sure all local paths are ispath=True
Fixes #12180
2015-09-01 14:47:45 -04:00
aeff960d02 Cleanup combine_vars
* Dedupe combine_vars() code (removed from VariableManager)
* Fix merge_hash algorithm to preserve the type
* unittest combine_vars and merge_hash
2015-09-01 11:23:12 -07:00
7fe495d619 Merge pull request #12187 from caphrim007/add-utf-8-encoding-to-f5-module-utils
Adds utf-8 encoding to f5 module_utils
2015-09-01 14:15:42 -04:00
d00c445d2c Merge pull request #12188 from amenonsen/easy-debug
Show module name and args with -vvv
2015-09-01 14:15:15 -04:00
d6d523bcae Show module name and args with -vvv
This information was earlier shown only with ANSIBLE_DEBUG, but it's
extremely useful in a user context, especially with module invocations
with deeply nested args like the ec2_vpc/ec2 modules.

Closes #11680
2015-09-01 23:44:13 +05:30
3e1a774ba5 Don't use iteritems() in templar to avoid (hostvars) dict size change errors 2015-09-01 14:11:23 -04:00
974b69d236 looped includes need unique references to prevent information bleeding
Fixes #12155
2015-09-01 12:32:35 -04:00
c17c5cac0b Merge pull request #12152 from amenonsen/changelog-tweak
Changelog tweak: Mention --output - for ansible-vault encrypt/decrypt
2015-09-01 12:08:58 -04:00
ae865b9480 Merge pull request #12150 from opoplawski/cobbler
Fix setting dns_name in cobbler inventory
2015-09-01 12:06:57 -04:00
a341a8a093 Make sure tasks from a role see their defaults above all others
Fixes #12081
2015-09-01 11:27:35 -04:00
c2d5901e2d added nagios_ndo lookup, updated minor updates texts 2015-09-01 11:21:44 -04:00
f46b91e8ab Merge pull request #6918 from gentledevil/devel
Add Nagios NDO inventory plugin
2015-09-01 11:18:01 -04:00
d56165b7f9 Add Nagios NDO inventory plugin 2015-09-01 17:10:37 +02:00
6f41a72158 Adds utf-8 encoding to f5 module_utils
The contributor's name on line 10 (originally line 7) includes a character
that the default Python encoding (ASCII) raises an error on when interpreting
the file.

Specifying the utf-8 encoding, as is done in other modules, resolves
the error.

The error being raised is

SyntaxError: Non-ASCII character '\xc3' in file /.../lib/ansible/module_utils/f5.py
on line 7, but no encoding declared; see http://www.python.org/peps/pep-0263.html
for details
2015-09-01 08:10:23 -07:00
8cac397841 Note that backslash escaping has changed in some places 2015-09-01 08:04:23 -07:00
a7da25d48b Submodule update 2015-09-01 11:03:19 -04:00
3d282cd1b0 Also always post_validate Handler class as well
Fixes #12154
2015-09-01 11:02:42 -04:00
12edbfeb0b Merge pull request #12177 from mgedmin/py3k
Make combine_vars() compatible with Python 3
2015-09-01 08:00:08 -07:00
66c3461f3c now include galaxy/data/ stuff for use with ansible-galaxy 2015-09-01 10:58:58 -04:00
66e2eb2231 removed as it does not fool setup.py to include data and it must be specified in setup.py 2015-09-01 10:58:58 -04:00
54dbfba8f8 Make combine_vars() compatible with Python 3
Fixes

  TypeError: unsupported operand type(s) for +: 'dict_items' and 'dict_items'

on Python 3.
2015-09-01 09:39:59 +03:00
5adcd7054b Allow setup to run when using --start-at-task
Fixes #12147
2015-08-31 22:10:34 -04:00
4be1187fe6 much needed update to port makefile 2015-08-31 20:34:20 -04:00
7458331539 package and service now check that module exists before trying to execute it 2015-08-31 20:34:20 -04:00
bca4e23b27 Merge pull request #12175 from nitzmahone/winrm_setup_fix
moved WinRM setup script test after config
2015-08-31 19:56:56 -04:00
74694b2b0d moved WinRM setup script test after config 2015-08-31 16:38:23 -07:00
9d193d8fb4 Merge pull request #12173 from ansible/pr/10204
Rebase of 10204 - Add host key for ssh url only.
2015-08-31 13:50:40 -07:00
fca27c29f4 Properly fail if slurp fails during fetch 2015-08-31 16:45:03 -04:00
58c3539196 Add host key for ssh url only.
Rewrite function `get_fqdn`.  It returns fqdn for all kinds of urls now.

`add_git_host_key` determines whether a url is ssh and whether its host
key should be added.
2015-08-31 13:42:32 -07:00
66a2f2923e Look for proper values in slurp result during fetch with become enabled 2015-08-31 16:36:07 -04:00
7f5080f64a Fix backslash escaping inside of jinja2 expressions
Fixes #11891
2015-08-31 13:17:26 -07:00
2b82b632cd Merge pull request #12164 from qwazerty/fix_python3
Change hacking scripts to python3 syntax
2015-08-31 12:51:34 -07:00
5ae300a084 Update module refs 2015-08-31 08:05:45 -07:00
b8c9391d0c Change to python3 syntax 2015-08-31 02:35:14 +02:00
6b73cac35a corrected skipped_hosts constant usage, thanks @benjixx 2015-08-30 20:21:15 -04:00
5a65dce6fb fix issues with csh redirection 2015-08-30 17:49:16 -04:00
b525eedb8e less misleading message for when someone looks up vars for a host not in inventory 2015-08-30 12:41:21 -04:00
2bca97fa80 Explain the host range parsing changes in more detail 2015-08-30 13:14:02 +05:30
2cda6d0e30 Mention --output - for ansible-vault encrypt/decrypt 2015-08-29 08:22:20 +05:30
6154ed1dda Merge pull request #12146 from thekarlbrown/patch-1
Fixed Spelling Error on Line 67
2015-08-28 20:10:47 -04:00
3b17efe5bc Fix setting dns_name in cobbler inventory 2015-08-28 15:00:04 -06:00
f0257683b0 Fixed missing constants import in default callback
Fixes #12145
2015-08-28 16:54:56 -04:00
5e318de31a Merge pull request #12135 from amenonsen/changelog-update
Mention |combine and the vault improvements in the CHANGELOG
2015-08-28 13:47:17 -07:00
ccaf47bd97 Fix unit tests broken by 057712c1 2015-08-28 16:44:04 -04:00
057712c129 Also move action/connection plugins to shared plugin loader code
Fixes #12099
2015-08-28 16:32:09 -04:00
0859ba7726 Adjust field loading order for vars and tweak post_validate exclusion logic
FieldAttributes will now by default not be post_validated unless a flag
is set on them in the class, as a large number of fields are really there
simply to be inherited by Task/PlayContext and shouldn't be templated too
early.

The other (unrelated to the base issue) in #12084 is also fixed here, where
the roles field is loaded before vars/vars_files, meaning there are no vars
yet loaded in the play when the templating occurs.

Fixes #12084
2015-08-28 15:56:42 -04:00
9aae1d5810 Fixed Spelling Error on Line 67
Noticed while running Ansible from Tip.
Throws: NameError: global name 'tself' is not defined
2015-08-28 15:45:49 -04:00
ee7f7a82a8 Update developing_modules.rst
More specific about urllib2 restrictions
2015-08-28 15:19:54 -04:00
ec95ad1062 Update developing_modules.rst 2015-08-28 14:30:16 -04:00
9c150e5753 Update developing_modules.rst 2015-08-28 14:25:06 -04:00
b5a10b7960 Update README.md
Reflect new permissions for pushing to doc site
2015-08-28 14:19:14 -04:00
0880687f9d Merge branch 'amenonsen-hostrange' into devel 2015-08-28 14:00:49 -04:00
4c65306e73 Merge branch 'hostrange' of https://github.com/amenonsen/ansible into amenonsen-hostrange 2015-08-28 13:48:25 -04:00
120243d36d Fix python3.4 syntax 2015-08-28 10:30:27 -07:00
2043fcd5db Merge pull request #12083 from resmo/for-ansible
cloudstack: implement general api_region support, update docs
2015-08-28 13:14:50 -04:00
b6c6ed91fe implemented not showing skipped hosts config 2015-08-28 12:32:50 -04:00
514fa73fcd galaxy fixes 2015-08-28 12:32:50 -04:00
c6e62b6b4b one more module to changelog! 2015-08-28 12:32:50 -04:00
66ed397360 Fix redis fact_caching_timeout=0 bug
Fixes #12018
2015-08-28 11:47:06 -04:00
5a5b9f211b Validate variable names when loading 'vars:' blocks
TODO: add this to VariableManager to validate vars loaded from files too

Fixes #12022
2015-08-28 11:36:31 -04:00
266a069a73 Merge pull request #12107 from TravisPaul/devel
Update "smart" transport to handle Sun_SSH_1.5 on SmartOS
2015-08-28 10:43:48 -04:00
088c6909d6 Merge pull request #12143 from homme/patch-1
Link to `constants.py` in the source tree from the documenation.
2015-08-28 10:05:17 -04:00
c2e84a0a96 Merge pull request #12136 from mgedmin/py3k
Python 3: use print() as function under contrib/
2015-08-28 09:46:24 -04:00
776eb3e8cd Link to constants.py in the source tree.
`constants.py` is referenced in the *Environmental configuration* section of the documentation.  This change provides a link from the documentation to the source code.
2015-08-28 13:19:13 +01:00
cc95068dc9 Add Rudder inventory plugin 2015-08-28 10:25:18 +02:00
3f9879aedb Use print() as function under contrib/
This fixes the remaining Python 3 syntax errors, so re-enable compileall
for contrib/ again.
2015-08-28 09:18:13 +03:00
cc6e53175f Mention |combine and the vault improvements in the CHANGELOG 2015-08-28 11:03:40 +05:30
aa5f96d28d Merge pull request #12134 from smkr/devel
- Fixed line break causing part of the text to display as "Definition List"  which Sphinx renders in bold.
2015-08-27 23:54:58 -04:00
f4fbfa6450 - Fixed line break causing part of the text to display as "Definition List"
which Sphinx renders in bold.
2015-08-27 21:41:36 -06:00
48aa0dd1c7 now acknowledges ask_pass setting from ansible.cfg
fixes #12111
2015-08-27 18:22:36 -04:00
399d215f5a Merge pull request #12122 from maty0609/devel
Adding support for Archlinux and Slackware in fallback
2015-08-27 16:55:43 -04:00
9780658412 Merge pull request #12131 from ansible/py3-test
Enable py34 test in travis so we don't regress recent fixes
2015-08-27 13:24:56 -07:00
1eee5ec6ff Enable py34 test in travis so we don't regress recent fixes 2015-08-27 13:20:52 -07:00
6907166667 Merge pull request #12119 from mgedmin/py3k
Some steps towards Python 3 support
2015-08-27 12:18:16 -07:00
c846bab69b Fix assert statement syntax
`assert (condition, message)` gets parsed by Python as `assert
a_two_tuple`, and a 2-element tuple is never False.

Discovered by compileall on Python 3.4, which emits a SyntaxWarning for
this common mistake.
2015-08-27 22:15:57 +03:00
9e82ecaf91 Disable compileall test for contrib/ in tox -e py34
(This is supposed to be temporary, until the code under contrib/ gets
cleaned up from all the remaining print statements.)
2015-08-27 22:15:57 +03:00
709dbbc7db Use 0oNNN octal syntax in test/ 2015-08-27 22:15:57 +03:00
727cb8a917 Support print() function in test/ 2015-08-27 22:15:57 +03:00
9ae66a7f5c Use 'except ... as' syntax in contrib/ and test/ too 2015-08-27 22:15:57 +03:00
eb99aa8c68 Fix to_bytes(None) on Python 3
You cannot call bytes(obj) to get a simple representation of obj on
Python 3!  E.g. bytes(42) returns a byte string with 42 NUL characters
instead of b'42'.
2015-08-27 22:15:56 +03:00
df1b41d3d3 Avoid types.NoneType
types.NoneType was removed in Python 3.

None is a singleton in Python, so 'x is None' is equivalent to
'isinstance(x, NoneType)'.
2015-08-27 22:15:56 +03:00
da1e611b26 Support print as a function
I neglected the __future__ import because

  print(one_thing)

works the same way even when print is a statement.
2015-08-27 22:15:56 +03:00
39196ec91e Drop the L suffix on numerical constants
Python has had automatic int-to-long promotion for a long long time now.
Even Python 2.4 does that automatically.

Python 3 drops support for the L suffix altogether.
2015-08-27 22:15:04 +03:00
0eb538df03 Use 0oNNN octal syntax
This syntax is valid in Python 2.6+ and 3.x.
2015-08-27 22:15:04 +03:00
47b088504d Don't mix tabs and spaces
It's not allowed in Python 3 and merely a bad idea in Python 2.
2015-08-27 22:15:04 +03:00
0c6ce31f76 Use 'except ... as' syntax
This syntax works on Python 2.6 through 3.x.  lib/ansible/module_utils
(and lib/ansible/modules) need to support Python 2.4, so I didn't touch
those.
2015-08-27 22:15:04 +03:00
2ac931d6c9 ported module_docs to use display 2015-08-27 14:57:50 -04:00
2b28cdc0dd be more tolerant with non list descriptions 2015-08-27 14:57:50 -04:00
86b2982005 Merge pull request #12112 from amenonsen/vault-stdio
Implement cat-like filtering behaviour for encrypt/decrypt
2015-08-27 11:26:48 -07:00
db4a96a8d6 Merge pull request #12078 from amenonsen/hash_merge
Add hash_merge and hash_merge_recursive filters with documentation
2015-08-27 11:12:49 -07:00
b328bc023d Add a combine filter with documentation
This is based on some code from (closed) PR #7872, but reworked based on
suggestions by @abadger and the other core team members.

Closes #7872 by @darkk (hash_merge/hash_replace filters)
Closes #11153 by @telbizov (merged_dicts lookup plugin)
2015-08-27 23:29:12 +05:30
2df6513f8d Version bump for v2.0.0-0.1.alpha1 and submodule updates 2015-08-27 13:43:37 -04:00
3f099ca0a2 Better way to stop tox running on unwanted directories 2015-08-27 10:41:46 -07:00
ccb24d2919 Merge pull request #12098 from mgedmin/fix-tox-compileall
Don't compile .py files under .tox/
2015-08-27 10:34:03 -07:00
6c9dc78d8c Merge pull request #12126 from amenonsen/vault-aes-deprecate
Remove deprecated and unused VaultAES encryption code
2015-08-27 13:09:28 -04:00
1170a453c8 Merge pull request #12114 from ilya-epifanov/devel
fixed hostvars access in conjunction with --limit usage
2015-08-27 12:54:23 -04:00
4afe1cf422 Update ansible-vault manpage to describe new encrypt/decrypt behaviour 2015-08-27 22:04:18 +05:30
090cfc9e03 More helpful prompts from ansible-vault encrypt/decrypt
Now we issue a "Reading … from stdin" prompt if our input isatty(), as
gpg does. We also suppress the "x successful" confirmation message at
the end if we're part of a pipeline.

(The latter requires that we not close sys.stdout in VaultEditor, and
for symmetry we do the same for sys.stdin, though it doesn't matter in
that case.)
2015-08-27 22:04:18 +05:30
b6de6e69a6 Also support output to stdout with no arguments
This allows "cat plaintext|ansible-vault encrypt > ciphertext".
2015-08-27 22:04:18 +05:30
e7eebb6954 Implement cat-like filtering behaviour for encrypt/decrypt
This allows the following invocations:

    # Interactive use, like gpg
    ansible-vault encrypt --output x

    # Non-interactive, for scripting
    echo plaintext|ansible-vault encrypt --output x

    # Separate input and output files
    ansible-vault encrypt input.yml --output output.yml

    # Existing usage (in-place encryption) unchanged
    ansible-vault encrypt inout.yml

…and the analogous cases for ansible-vault decrypt as well.

In all cases, the input and output files can be '-' to read from stdin
or write to stdout. This permits sensitive data to be encrypted and
decrypted without ever hitting disk.
2015-08-27 22:04:18 +05:30
32b38d4e29 Fix add_option indentation for consistency before adding another option 2015-08-27 22:04:18 +05:30
8fc8bf9439 Simplify VaultEditor methods
We don't need to keep creating VaultLibs everywhere, and we don't need
to keep checking for errors because VaultLib does it already.
2015-08-27 22:04:18 +05:30
e99395f0c0 Don't create a VaultLib in each method; do it in __init__ instead 2015-08-27 22:04:18 +05:30
ef594f708c remove old dead code 2015-08-27 12:27:38 -04:00
4f3a98eff6 Update Vault tests to make sure AES decryption works
Note that this test was broken in devel because it was really just
duplicating the AES256 test because setting v.cipher_name to 'AES'
no longer selected AES after it was de-write-whitelisted.

Now that we've removed the VaultAES encryption code, we embed static
output from an earlier version and test that we can decrypt it.
2015-08-27 18:36:05 +05:30
159887a6c9 Remove deprecated and unused VaultAES encryption code
Now that VaultLib always decides to use AES256 to encrypt, we don't need
this broken code any more. We need to be able to decrypt this format for
a while longer, but encryption support can be safely dropped.
2015-08-27 16:54:39 +05:30
52e94468c9 Merge remote-tracking branch 'ansible/devel' into devel 2015-08-27 10:29:48 +01:00
6f24e6f994 Adding support for Archlinux and Slackware in fallback
In some cases Archlinux and Slackware is not detected by
platform.dist(). This should solve the issue.
2015-08-27 10:22:02 +01:00
5ba3452b7e merged vmware_: vmkernel_ip_config, dvswitch, host, vmkernel, and dvs_portgroup 2015-08-26 18:33:49 -05:00
b2bfe3502b make sure delimiter is basestring for cvsfile
fixes #12062
2015-08-26 18:38:39 -04:00
81bf88b6e0 fixed hostvars access in conjunction with --limit usage 2015-08-27 00:15:26 +03:00
0441a7a217 Finishing off porting of chroot connection plugin 2015-08-26 16:43:06 -04:00
017bd7b1cd Fix synchronize lookup of localhost info 2015-08-26 13:36:50 -07:00
50448d68e1 Implement max_fail_percentage and any_errors_fatal support
Fixes #11997
2015-08-26 12:03:47 -04:00
af41ba929c Add float and percent types for FieldAttributes
Also sets the max_fail_percentage value to the percent type.
2015-08-26 12:03:47 -04:00
9f95720ef7 Merge pull request #12109 from docschick/devel
ansible-lockdown added, minor editing
2015-08-26 12:01:58 -04:00
c752149fe7 ansible-lockdown added, minor editing
added info/link for ansible-lockdown to mailing list section, minor editing
(can't help myself it seems) to the paragraph about subscribing from a non-google account
2015-08-26 11:51:17 -04:00
b2ae6945c4 always load vars plugins
fixes #12104
2015-08-26 11:40:53 -04:00
604f825a8e Update "smart" transport to handle Sun_SSH_1.5 on SmartOS 2015-08-26 15:00:45 +00:00
111c0cc204 Merge pull request #12106 from amenonsen/vault-cleanups
Vault cleanups, pass #1
2015-08-26 07:30:13 -07:00
b84053019a Make the filename the first argument to rekey_file 2015-08-26 19:54:59 +05:30
c4b2540ecc Update tests for VaultEditor API changes 2015-08-26 19:52:20 +05:30
5df5a14edc Merge pull request #12101 from tquenolle/devel
Synchronize fix error
2015-08-26 07:03:13 -07:00
20fd9224bb Pass the filename to the individual VaultEditor methods, not __init__
Now we don't have to recreate VaultEditor objects for each file, and so
on. It also paves the way towards specifying separate input and output
files later.
2015-08-26 19:17:37 +05:30
82603bb2a0 avoids running abspath on None 2015-08-26 09:28:23 -04:00
a27c5741a1 Remove inaccurate outdated comment 2015-08-26 18:31:45 +05:30
f91ad3dabe Don't pass the cipher around so much
It's unused and unnecessary; VaultLib can decide for itself what cipher
to use when encrypting. There's no need (and no provision) for the user
to override the cipher via options, so there's no need for code to see
if that has been done either.
2015-08-26 18:31:45 +05:30
017566a2d9 Use AES256 if the cipher is not write-whitelisted 2015-08-26 18:09:21 +05:30
47bcdf5952 Remove incorrect copy-pasted comment 2015-08-26 18:09:21 +05:30
a391857013 added a few cloud modules to changelog 2015-08-26 07:50:24 -04:00
c948af3b1e Synchronize fix error
Fix the error:
 "RuntimeError: dictionary changed size during iteration"
2015-08-26 11:01:00 +02:00
601a1cc6d9 Multiple fixes for include statements and blocks in general
Fixes #11981
Fixes #11995
Fixes #12039
Fixes #12077
2015-08-26 02:23:22 -04:00
b44eae9ebc Don't compile .py files under .tox/
'tox -e py26' would fail for me because python -m compileall would crawl
under .tox/py27 and, unsurprisingly, get SyntaxErrors on files from the
Python 2.7 standard library using syntax features not supported by
Python 2.6.
2015-08-26 08:31:43 +03:00
6dca640cb2 Fix typo, remove redundant paragraph
The bit about git rebase vs git merge is repeated in the paragraph below.  The bit about test/integration is repeated in the paragraph above. 

(And the bit about aliasing git pull to git pull --rebase is unclear, since git's aliases cannot override builtin operations.)
2015-08-26 08:13:20 +03:00
9f9891df2c Add unicode characters to the data that we're testing that ansible-vault can decrypt 2015-08-25 15:14:43 -07:00
c81cff1977 Add docker connection plugin to changelog 2015-08-25 15:14:43 -07:00
154754ae50 pushed module_loader to task_queue_manager so all cli's can benefit from it
also normalized -M option across all cli
fixes #12016
2015-08-25 18:14:03 -04:00
d2c948dd6a Remove decrypted vault temp_file mistakenly left from patch making vault edit idempotent
This bug was introduced in commit f8bf2ba on July 27.  Hasn't gone out
in a release yet.
2015-08-25 14:51:32 -07:00
56ae3a032f Merge pull request #12075 from ansible/fix-vault-unicode
Unicode and other fixes for vault
2015-08-25 14:49:15 -07:00
a3fd4817ef Unicode and other fixes for vault 2015-08-25 12:43:09 -07:00
16e8a7dd67 Merge pull request #11767 from amenonsen/vault-new-password-file
add option to ansible-vault to read new password from file for rekey
2015-08-25 10:15:27 -07:00
156feec264 Merge pull request #11650 from objectified/feature-docker-connection
allow ansible to connect to docker containers (without using ssh)
2015-08-25 09:28:25 -07:00
8bf0dbb7a9 Use [x:y] host ranges instead of [x-y]
This commit deprecates the earlier groupname[x-y] syntax in favour of
the inclusive groupname[x:y] syntax. It also makes the subscripting
code simpler and adds explanatory comments.

One problem addressed by the cleanup is that _enumeration_info used to
be called twice, and its results discarded the first time because of the
convoluted control flow.
2015-08-25 21:17:24 +05:30
73f10de386 Document the behaviour of _match_one_pattern in some detail
The possibilities are complicated enough that I didn't want to make
changes without having a complete description of what it actually
accepts/matches. Note that this text documents current behaviour, not
necessarily the behaviour we want. Some of this is undocumented and may
not be intended.
2015-08-25 21:17:24 +05:30
fa6ffa1dbd Remove & and ! pattern prefixes as early as possible
Now everything under _match_one_pattern can ignore them. This also means
that we can use the cache to return the same results for 'foo' and '!foo'.
2015-08-25 21:17:24 +05:30
704c3815d3 Reorder functions into a logical sequence based on usage
There are no code changes; this is committed separately so as to make
the subsequent "real" diffs easier to read.
2015-08-25 21:17:24 +05:30
d9086ab46b Describe the groupname[x]/[x:y] syntax in more detail 2015-08-25 21:17:24 +05:30
3090a45891 add option to ansible-vault to read new password from file for rekey
The --new-vault-password-file option works the same as
--vault-password-file but applies only to rekeying (when
--vault-password-file sets the old password). Also update the manpage
to document these options more fully.
2015-08-25 21:14:49 +05:30
846f0b0510 changed no_log expected type to new value 2015-08-25 10:20:47 -04:00
ae91cdfc98 fixed environment inheritance 2015-08-25 10:15:32 -04:00
8aa732e0a4 allow for lists, sets and dicts to default to None, now return empty type in post processing
remove defaults from inhertiable fieldattributes to allow for proper detection and override
2015-08-25 10:14:28 -04:00
3e13dfd7e8 used stdoutlines list to avoid string mismatches
added block environment test
2015-08-25 10:06:24 -04:00
079a1c843d Merge pull request #12082 from mgedmin/be-faster
Speed up execution
2015-08-25 10:04:43 -04:00
44c94328c8 Speed up execution
`if method in dir(self):` is very inefficient:

- it must construct a list object listing all the object attributes & methods
- it must then perform a O(N) linear scan of that list

Replace it with the idiomatic `if hasattr(self, method):`, which is a
O(1) expected time hash lookup.

Should fix #11981.
2015-08-25 16:07:21 +03:00
3db4039ad1 cloudstack: implement general api_region support, update docs 2015-08-25 13:54:21 +02:00
b1785a0361 replace compare_versions() with distutils.version 2015-08-25 02:18:37 -04:00
c39fb43ad9 added Maintainer comment header 2015-08-25 02:06:01 -04:00
efa005c228 added names to assert tasks for easier debugging 2015-08-24 22:57:56 -04:00
d6a1cbeefb corrected varname that started with number and broke templating 2015-08-24 22:44:12 -04:00
104b8a9a7b avoid hostvars which is not a dict 2015-08-24 22:44:12 -04:00
857d74a274 made diff ignore whitespace 2015-08-24 22:44:12 -04:00
1f7b0fee0a Fixes #12076 2015-08-24 19:07:04 -07:00
17060f9849 remove +1 from size that was cutting off first char of copied files when a recursive dir
fixes #12055
2015-08-24 21:10:03 -04:00
6e107d2f22 Comments pointing the way towards substituting cryptography for pycrypto 2015-08-24 15:50:37 -07:00
560e1633dc added 3 vmware plugins 2015-08-24 17:24:21 -04:00
fc19304b00 added vmware_dns_config to changelog 2015-08-24 14:15:07 -04:00
16f3f8e244 now does not error out when notes are not included in module 2015-08-24 13:24:58 -04:00
d9cf9abc12 added vmware_cluster to changelog 2015-08-24 13:18:06 -04:00
d9723069c5 align exec_command() definition with local.py 2015-08-24 12:32:11 -04:00
3a5522a22c fake being connected for logging purposes 2015-08-24 12:32:11 -04:00
8f2a6a9fae use docker cp when docker >=1.8.0 2015-08-24 12:32:11 -04:00
2de773477f allow ansible to connect to docker containers 2015-08-24 12:32:11 -04:00
fbca8e17a2 added ec2_elb_facts to changelog 2015-08-24 11:47:32 -04:00
21e421ce53 Validate required list items are not None or empty strings
Fixes #12011
2015-08-24 11:44:28 -04:00
6da2587c36 Merge pull request #12058 from resmo/for-ansible
cloudstack: more integration tests and updates
2015-08-24 10:03:58 -04:00
d59caf501c added comment about vault multifile 2015-08-24 08:22:51 -04:00
c819d56ada added s3 bucket 2015-08-24 08:22:51 -04:00
8dfd3e4ffb Merge pull request #12061 from ansible/revert-12047-powershell_common_cleanup
Revert "Add PowerShell exception handling and turn on strict mode."
2015-08-23 21:09:28 -04:00
db65503778 Revert "Add PowerShell exception handling and turn on strict mode." 2015-08-23 21:09:16 -04:00
3aedc0bca9 Don't insist on ansible-vault taking only one filename parameter
Apart from ansible-vault create, every vault subcommand is happy to deal
with multiple filenames, so we can check that there's at least one, and
make create check separately that there aren't any extra.
2015-08-23 17:52:51 -04:00
f1b8323b62 fixed host/group var loading when inventory is a directory 2015-08-23 17:51:47 -04:00
af06a97f17 kept vars as alias to hostvars[inventory_hostname] and avoid subtrees into themselves 2015-08-23 17:51:47 -04:00
69d5e62083 cloudstack: test_cs_account: account_state was renamed, fixes tests 2015-08-23 22:50:23 +02:00
eb44f85dc8 cloudstack: test_cs_instance: make it more configurable 2015-08-23 22:49:45 +02:00
15a7f818e1 cloudstack: add more integration tests 2015-08-23 22:48:32 +02:00
3ccfebc9f7 Merge pull request #12047 from cchurch/powershell_common_cleanup
Add PowerShell exception handling and turn on strict mode.
2015-08-23 14:08:18 -04:00
12703c79b6 Merge pull request #11949 from bcoca/bsd_intro
draft bsd intro and bootstrapping
2015-08-23 13:35:35 -04:00
a4ffa09414 Merge pull request #11880 from bcoca/configurable_squash
made squashable with_ plugin list configurable
2015-08-23 13:32:15 -04:00
e11d56c06b Merge pull request #11747 from amenonsen/8682-rebase
Fix a parsing bug that prevents IPv6 addresses from being used with add_host
2015-08-23 10:24:03 -07:00
09e4eac2e5 Use rsplit(':',1) for clarity; no functional changes 2015-08-23 22:52:35 +05:30
1886307845 Fix a parsing bug that prevents IPv6 addresses from being used with add_host
Closes #8682
2015-08-23 22:50:47 +05:30
af9200c2de Add integration tests for win_group module. 2015-08-22 18:49:55 -04:00
4b2cdadc98 Add PowerShell exception handling and turn on strict mode.
* Add exception handling when running PowerShell modules to provide exception message and stack trace.
* Enable strict mode for all PowerShell modules and internal commands.
* Update common PowerShell code to fix strict mode errors.
* Fix an issue with Set-Attr where it would not replace an existing property if already set.
* Add tests for exception handling using modified win_ping modules.
2015-08-22 18:28:07 -04:00
47d9e7ca93 Merge pull request #11984 from Alphadelta14/devel
Support any Mapping for with_dict lookup.
2015-08-22 12:39:42 -04:00
0958edfc7c Submodule pointer update 2015-08-22 12:39:04 -04:00
e8157eab19 now output works for both search and info 2015-08-22 02:42:21 -04:00
a6c0661d21 made src more prominent 2015-08-22 02:33:17 -04:00
6ffd9c3025 draft galaxy cli search
TODO: paging results
2015-08-22 02:28:27 -04:00
e282309f6d Make sure the inventory restriction is not None 2015-08-21 16:08:21 -04:00
635fa0757b Several var fixes
* Fixes hostvar serialization issue (#12005)
* Fixes regression in include_vars from within a role (#9498), where
  we had the precedence order for vars_cache (include_vars, set_fact)
  incorrectly before role vars.
* Fixes another bug in which vars loaded from files in the format of
  a list instead of dictionary would cause a failure.

Fixes #9498
Fixes #12005
2015-08-21 12:02:23 -04:00
144da7e7d1 Merge pull request #11765 from ldx/vault_pbkdf2hmac
Use PBKDF2HMAC() from cryptography for vault keys.
2015-08-21 11:06:00 -04:00
f150fe2c23 moved mandatory back to filters as it does not always return a boolean, it does an exception on failure 2015-08-21 09:54:56 -04:00
01708cc824 added test for environment directive 2015-08-21 00:37:17 -04:00
2787b3acac ported consul_kv lookup from v1 2015-08-21 00:22:20 -04:00
74079db8d2 ported dig lookup from v1 2015-08-21 00:22:01 -04:00
9bb95b5235 Merge pull request #12031 from amenonsen/deadcode
Remove unused (copied) _before_comment method
2015-08-20 23:36:56 -04:00
f6b6ed530b added file tests 2015-08-20 22:04:21 -04:00
cd4a0c70b0 isnotanumber is not needed as jinja2 has builtin number test 2015-08-20 22:04:20 -04:00
fe06577ac2 fixed mandatory test 2015-08-20 22:04:20 -04:00
599ad9cb51 Remove unused (copied) _before_comment method
This was copied from inventory/ini.py, but the rewritten version doesn't
use it, and shows that it isn't needed.
2015-08-21 06:58:23 +05:30
b5a078a385 update submodule refs 2015-08-20 15:41:05 -07:00
ceb66c7fd9 Merge pull request #12009 from amenonsen/inventory-ini-rewrite
Rewrite inventory/ini.py
2015-08-20 09:51:19 -07:00
745ecd4845 Sanitize IPv6 hostname/port handling
Now we accept IPv6 addresses _with port numbers_ only in the standard
[xxx]:NN notation (though bare IPv6 addresses may be given, as before,
and non-IPv6 addresses may also be placed in square brackets), and any
other host identifiers (IPv4/hostname/host pattern) as before, with an
optional :NN suffix.
2015-08-20 22:06:44 +05:30
74aab6f726 Use a self._raise_error helper and avoid passing the lineno around
Based on a patch by @Richard2ndQuadrant.
2015-08-20 22:05:17 +05:30
9133cd409c Make _parse take an array of input lines as an argument
(There's no compelling reason to do this right now, but should be parser
need to be called multiple times in future, this makes it easier.)
2015-08-20 22:05:17 +05:30
98a1905796 Rename 'section' to 'groupname' to better reflect its purpose 2015-08-20 22:05:17 +05:30
1284c49bd7 Rewrite the INI InventoryParser
The new code parses INI-format inventory files in a single pass using a
well-documented state machine that reports precise errors and eliminates
the duplications and inconsistencies and outright errors in the earlier
three-phase parsing code (e.g. three ways to skip comments). It is also
much easier now to follow what decisions are being taken on the basis of
the parsed data. The comments point out various potential improvements,
particularly in the area of consistent IPv6 handling.

On the ornate marble tombstone of the old code, the following
inscription is one last baffling memento from a bygone age:

-    def _before_comment(self, msg):
-        ''' what's the part of a string before a comment? '''
-        msg = msg.replace("\#","**NOT_A_COMMENT**")
-        msg = msg.split("#")[0]
-        msg = msg.replace("**NOT_A_COMMENT**","#")
-        return msg
2015-08-20 22:05:17 +05:30
d0350b1905 Merge pull request #12024 from jhawkesworth/win_splitdrive_filter
Add win_splitdrive filter for windows users
2015-08-20 10:49:42 -04:00
04e26849a5 Merge pull request #12026 from wenottingham/patch-7
Update faq
2015-08-20 10:04:44 -04:00
3fd3f685ad Update faq
Guru is not a thing any more.
2015-08-20 10:00:24 -04:00
a46b500851 Add win_splitdrive filter for windows users 2015-08-20 13:54:54 +01:00
4f32a61504 Merge pull request #10957 from feanil/feanil/retain_nonetypes
Don't convert nulls to strings.
2015-08-19 19:43:27 -07:00
0eba819113 Merge pull request #11792 from deliciousfudge/devel
Update dependencies for pywinrm
2015-08-19 22:01:49 -04:00
e8b86f448d fix issue with improper connection override in delegation 2015-08-19 20:36:08 -04:00
2f7164e3de corrected typo 2015-08-19 19:28:50 -04:00
892e230514 Don't convert nulls to strings.
This change is similar to https://github.com/ansible/ansible/pull/10465

It extends the logic there to also support none types.  Right now if you have
a '!!null' in yaml, and that var gets passed around, it will get converted to
a string.

eg. defaults/main.yml
```
ENABLE_AWESOME_FEATURE: !!null # Yaml Null
OTHER_CONFIG:
  secret1: "so_secret"
  secret2: "even_more_secret"

CONFIG:
  hostname: "some_hostname"
  features:
    awesame_feature: "{{ ENABLE_AWESOME_FEATURE}}"
  secrets: "{{ OTHER_CONFIG }}"
```

If you output `CONFIG` to json or yaml, the feature flag would get represented in the output
as a string instead of as a null, but secrets would get represented as a dictionary.  This is
a mis-match in behaviour where some "types" are retained and others are not.  This change
should fix the issue.

I also updated the template test to test for this and made the changes to v2.

Added a changelog entry specifically for the change from empty string to null as the default.

Made the null representation configurable.

It still defaults to the python NoneType but can be overriden to be an emptystring by updating
the DEFAULT_NULL_REPRESENTATION config.
2015-08-19 18:35:07 -04:00
22a69e2498 fixes to delegation code 2015-08-19 15:49:37 -04:00
36cbd771a4 changed fixme to deprecated 2015-08-19 15:49:37 -04:00
6febca4383 added mention of settable vars to changelog 2015-08-19 15:49:37 -04:00
961bee00d5 centralized the definition of 'localhost' 2015-08-19 15:49:37 -04:00
29724f359b Merge pull request #12012 from resmo/for-ansible
cloudstack: fixes and consistency change
2015-08-19 15:45:49 -04:00
9d3577a74a cloudstack: fix tests unhashable type: 'dict' 2015-08-19 21:39:58 +02:00
8f3c181d90 cloudstack: tests: use resource_prefix 2015-08-19 21:37:54 +02:00
d16429b59c cloudstack: rename returns for consistency 2015-08-19 21:25:19 +02:00
fd361c7f5d Merge pull request #12002 from amenonsen/9437-rebase
Make get_group run in O(n*log(n)) instead of O(n^2) by using a cache (#9437 rebase)
2015-08-19 10:22:22 -04:00
2641f70e47 Reset self._groups_cache in refresh_inventory 2015-08-19 11:35:27 +05:30
73d6da757f Make get_group run in O(n*log(n)) instead of O(n^2) by using a cache 2015-08-19 11:35:27 +05:30
1b810e3101 Merge pull request #12000 from bcoca/local_action_connect
changed local_action to alias to connection=local vs delegate_to=locahost
2015-08-19 00:34:03 -04:00
69f380da3a changed mod_args test to match connection 2015-08-19 00:34:37 -04:00
b1e8493e7d Merge pull request #12001 from amenonsen/10034-rebase
double the speed of loading a 10k host inventory file (#10034 rebase)
2015-08-19 00:20:35 -04:00
b8865314ec improve ansible start up time for very large inventory
first off, we add an oddly slow basic test of 10k item inventory

Before:
```
Ran 229 tests in 13.214s

OK

real    0m13.403s
user    0m12.106s
sys 0m1.155s
```

After:
```
Ran 230 tests in 21.328s

OK

real    0m21.516s
user    0m20.099s
sys 0m1.275s
```

since that seems like a bit long for the test to add to runtime, lets profile

`python -m cProfile -s time ./bin/ansible all -i test/units/inventory_test_data/huge_range --list-hosts`

Before:
```
         1272607 function calls (1259689 primitive calls) in 8.497 seconds

   Ordered by: internal time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
    10000    4.393    0.000    4.396    0.000 __init__.py:395(_get_host)
    20000    2.695    0.000    2.697    0.000 __init__.py:341(__append_host_to_results)
    40369    0.113    0.000    0.113    0.000 {posix.lstat}
    50006    0.102    0.000    0.153    0.000 __init__.py:1490(combine_vars)
    40008    0.089    0.000    0.202    0.000 __init__.py:1546(_load_vars_from_path)
    20195    0.088    0.000    0.088    0.000 {posix.stat}
    10011    0.087    0.000    0.087    0.000 {posix.getcwd}
```

The top two lines are promising optimization targets

- populate Inventory's host cache more in _get_host, as we are looping
  over all the groups anyways.

- eliminate duplicate check of whether we've already included a host
  in the construction around __append_host_to_results we can infer
  presence of a host in the results list implies the presence of its
  name in the hostnames set, allowing us to only to the less expensive
  of the two checks

After:
```
         1252610 function calls (1239692 primitive calls) in 1.320 seconds

   Ordered by: internal time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
    40369    0.105    0.000    0.105    0.000 {posix.lstat}
    50006    0.094    0.000    0.141    0.000 __init__.py:1490(combine_vars)
    40008    0.081    0.000    0.184    0.000 __init__.py:1546(_load_vars_from_path)
    10011    0.080    0.000    0.080    0.000 {posix.getcwd}
    20195    0.074    0.000    0.074    0.000 {posix.stat}
    10002    0.069    0.000    0.261    0.000 __init__.py:1517(load_vars)
```
2015-08-19 09:45:02 +05:30
9f9f476b6e Update consul integration test with http checks 2015-08-19 00:38:36 +02:00
7a4a156d91 changed local_action to alias to connection=local vs delegate_to=localhost
fixes #11998, but still leaves issue of delegate_to: localhost not working
2015-08-18 18:31:29 -04:00
86100da3a0 Merge pull request #11446 from cchurch/windows_azure_from_tower
Updates to Windows Azure inventory from Tower.
2015-08-18 15:35:51 -04:00
5eeeb87d82 removed dupe typoed line 2015-08-18 12:33:07 -04:00
f2c6785897 Merge pull request #11989 from bcoca/osx_queue_fix
changed check to avoid OS X broken sem_getvalue()
2015-08-18 09:58:21 -04:00
26ed50ecdf fixed indent 2015-08-18 09:58:25 -04:00
2198f48f54 changed check to avoid OS X broken sem_getvalue()
fixes #11988
2015-08-18 03:46:20 -04:00
ab355218a0 fixed test to new parser options 2015-08-18 03:34:38 -04:00
e081a73aa1 make new inventory config take precedence over old hostfile config
fixes #11907
2015-08-18 03:29:14 -04:00
17b4b1f85c added ability to limit in ansilbe pull
refactored the options a bit, new inventory_opts made sense to always group
fixes #7917
2015-08-18 03:17:58 -04:00
1acb29ff9b sequence will now run once for start=end, added test to suite
fixes #11979
2015-08-18 02:33:23 -04:00
7eaacaf66e added some new features, rearranged the changelog sections 2015-08-17 21:50:02 -04:00
ee21ebaffc Merge pull request #11975 from mutemule/become_doas
Add become support for OpenBSD doas
2015-08-17 21:36:03 -04:00
1c5611100e Add become support for OpenBSD doas 2015-08-17 21:31:18 -04:00
77b60a1a67 Support any Mapping for with_dict lookup.
This resolves 3939348286 breaking `with_dict: hostvars`.
2015-08-17 20:11:24 -04:00
c419cacb04 check if host task is none before continuing
fixes #11982
2015-08-17 18:56:04 -04:00
e7b2308b66 Performance improvements
* Speed up serialization of hostvars by simply using the internal
  dictionary used for cached lookups
* Use blocking gets/puts on queues instead of spin locking
* Merge sequential implicitly created blocks
2015-08-17 13:46:57 -04:00
1d402ae390 set script as executable 2015-08-17 13:42:16 -04:00
4068598c15 Merge pull request #11977 from resmo/for-ansible
cloudstack: add more common returns
2015-08-17 12:32:44 -04:00
21269e5efb Merge pull request #11980 from tbielawa/devel
Fix variable name mis-match in website docs for ANSIBLE_LIBRARY.
2015-08-17 11:43:28 -04:00
5a84e61778 Fix variable name mis-match in website docs for ANSIBLE_LIBRARY. Clean up some dangling whitespace 2015-08-17 11:38:00 -04:00
2913d2b44d cloudstack: add more common returns 2015-08-17 08:21:37 +02:00
6058eaa92f removed unused poller 2015-08-16 20:12:06 -04:00
9b61cf5840 implemented async tasks in adhoc v2 2015-08-16 20:05:10 -04:00
43bf9c86d8 fixed typo 2015-08-16 13:15:23 -04:00
d38bb4152d fixed test to match new exception class used 2015-08-16 10:35:09 -04:00
ee2e31b37a now passes the test of skipping list when dict attribute is undefined, added deprecation warning as this seems like bad behaviour 2015-08-16 10:16:02 -04:00
87926cbb33 added egg to cleanup 2015-08-16 09:33:20 -04:00
950622cebd made sure they all look in files/vars/template dirs also when executed in play and not only from task 2015-08-16 02:37:21 -04:00
861fdfc5ba updated callbacks to properly test diff no matter if dict or list 2015-08-16 02:37:21 -04:00
79ea6d3a1e copy now passes a list of diffs 2015-08-16 02:37:21 -04:00
c3372936aa diff can now be a list 2015-08-16 02:37:21 -04:00
13c91ef9d4 actually use the read source contents for the diff 2015-08-16 02:37:21 -04:00
45cebd283f added remote_src to copy, now allows copying to be done on the target server 2015-08-16 02:37:21 -04:00
1b7369cc8d added diff to assemble for remote_src=false 2015-08-16 02:37:21 -04:00
f048aca5f6 runas placeholder 2015-08-16 02:37:21 -04:00
81ee2412a4 Merge pull request #11970 from charleswhchan/patch-1
Update intro_installation.rst
2015-08-16 00:56:24 -04:00
980f44ccba Update intro_inventory.rst
Change 'SSH' to upper case.
2015-08-15 20:16:05 -07:00
ec60db3907 Update intro_installation.rst
Improve documentation.
2015-08-15 19:28:23 -07:00
c7016481ff added new modules to changelog 2015-08-15 15:27:29 -04:00
2eb5333b50 fixed test to match new become output 2015-08-15 12:26:35 -04:00
49eb95e2d1 some fixes to become/sudo
* now it uses -n to get immediate error if no password is supplied and one is needed,
   this should fix the issue with sudo hanging waiting for input.
 * made -k configurable, this can break changing become_users in play if left out,
   but opens up the possiblity of OTP support.
2015-08-15 12:17:40 -04:00
4836641683 Use ansible_python_interpreter value for remote checksums
Fixes #11968
Fixes #11969
2015-08-15 12:00:55 -04:00
7a51836530 check for failure in fact gathering 2015-08-15 11:29:10 -04:00
1edae51e05 added generic service module, step #1 to separating services to their own modules
falls back to current service module and requries service mgr facts and new service modules
2015-08-15 11:00:26 -04:00
172e0c328c fixed adhoc fact gathering 2015-08-15 11:00:10 -04:00
0381923333 fixed call to setup module 2015-08-15 10:50:22 -04:00
92e2f54228 fixed issues with utf-8 encoding in docs, moved pager to use display class instad of bare prints 2015-08-14 22:00:48 -04:00
3b75f3d26a Merge pull request #11967 from jody-frankowski/fix-env-setup-rm2
Fix rm call in hacking/env-setup. Since it is sourced from a user shell,
2015-08-14 19:31:10 -04:00
bc1e1d2cdc Fix rm call in hacking/env-setup. Since it is sourced from a user shell,
rm can have an alias to 'rm -i', which will make sourcing hang when '-q'
is enabled.
2015-08-15 00:43:45 +02:00
245e0dd4b7 made returns from next task consistent to avoid typeerrors, also linear now checks for none
fixes #11965
2015-08-14 18:07:14 -04:00
9f5e4c0ef6 lookup plugin that does no flattening 2015-08-14 17:05:41 -04:00
4ab369ee76 added solaris_zone module to changelog 2015-08-14 17:05:41 -04:00
4fc905b1d5 Merge pull request #11958 from amenonsen/deprecation-tweak
Tweak deprecation warning, and apply it to --limit also
2015-08-14 02:13:45 -04:00
8f231ec469 Tweak deprecation warning, and apply it to --limit also 2015-08-14 10:55:13 +05:30
4714cbeec8 Override post validation of environment to allow bare variables
Also prints a deprecated warning if a bare variable is detected, so
that we can remove this in a future version.

Fixes #11912
2015-08-14 00:33:36 -04:00
4dba30ccd0 Cleanup missed merge conflict sections 2015-08-13 15:05:58 -04:00
d41db8edd6 Don't accept undocumented "p1;p2" patterns; note in changelog
The correct (and now only) way to say p1 OR p2 is "p1:p2".
2015-08-13 14:54:12 -04:00
1437b8e120 Introduce _split_pattern to parse an "x:y:z" pattern
This function takes a string like 'foo:bar[1:2]:baz[x:y]-quux' and
returns a list of patterns ['foo', 'bar[1:2]', 'baz[x:y]-quux'], i.e.
splits the string on colons that are not part of a range specification.
2015-08-13 14:54:12 -04:00
32034feec5 Add deprecation warning regarding host patterns 2015-08-13 14:51:08 -04:00
6bf6b9fdbb Rename some internal functions, clarify what they do
get_hosts → used externally, not changed
_get_hosts → _evaluate_patterns (takes a list, evaluates ! and &)
__get_hosts → _match_one_pattern (takes one pattern only, ignores !&)
2015-08-13 14:51:08 -04:00
eff33bac49 Don't accept undocumented "p1;p2" patterns; note in changelog
The correct (and now only) way to say p1 OR p2 is "p1:p2".
2015-08-13 14:51:08 -04:00
8aaa06dd50 Introduce _split_pattern to parse an "x:y:z" pattern
This function takes a string like 'foo:bar[1:2]:baz[x:y]-quux' and
returns a list of patterns ['foo', 'bar[1:2]', 'baz[x:y]-quux'], i.e.
splits the string on colons that are not part of a range specification.
2015-08-13 14:51:08 -04:00
baf637b9ae Remove dead code: Inventory.also_restrict_to/lift_also_restriction
This was used earlier to implement serial, but that's now done using
restrict_to_hosts() (whose docstring is also suitably adjusted here)
and there are no more callers.
2015-08-13 14:51:08 -04:00
76e9af8b45 Merge pull request #11956 from patrickeasters/fix-aws-doc-typo
Fix typo on AWS guide page
2015-08-13 13:36:11 -04:00
6c036c3633 Template parent include file paths
Fixes #11955
2015-08-13 13:01:45 -04:00
6ed66caaed Fix typo on AWS guide page
I assume this should read “Ansible modules” rather than “Ansible
ensiles”
2015-08-13 12:00:55 -04:00
b905f51341 fixed typo 2015-08-13 11:05:20 -04:00
53821ad4b7 added shelvefile lookup to changelog 2015-08-13 11:04:44 -04:00
8eeac136f1 Merge pull request #11954 from bob-smith/patch-1
Update README.md for legacy v1
2015-08-13 10:51:42 -04:00
86f8f130a5 Update README.md
Correct formatting of bullet points
2015-08-13 15:50:33 +01:00
8af0ff4a58 Merge pull request #11567 from lekum/shelvefile_lookup
Add shelvefile lookup plugin
2015-08-13 10:47:44 -04:00
fbc7224066 Merge pull request #11643 from bcoca/meta_inventory_and_fixes
Meta inventory and fixes
2015-08-13 10:36:57 -04:00
43cc27084d corrected on delete also 2015-08-13 09:58:30 -04:00
089687140d corrected role path 2015-08-13 09:57:36 -04:00
eb381bd522 Add one more search path to path_dwim_relative 2015-08-13 09:53:09 -04:00
033c77a13b now creates/removes files/ dir 2015-08-13 09:54:06 -04:00
c6733cc1a7 Merge pull request #9225 from qvicksilver/aix_unprivileged
AIX unprivileged facts collection
2015-08-12 23:48:44 -04:00
5027f66562 Merge pull request #11864 from jhawkesworth/win_path_filters
add win_basename and win_dirname filters
2015-08-12 23:46:15 -04:00
a498876bec Make sure playbook includes use unique var dictionaries before modification 2015-08-12 23:38:47 -04:00
5fec11f513 capture parsing exceptions and give nice error and location 2015-08-12 23:27:00 -04:00
621b18c6ef fixed source path discovery for unarchive in roles
fixes #11943
2015-08-12 22:50:30 -04:00
70d024ffce show errors when missing vars file or when there is syntax issue in the file
fixes #11945
2015-08-12 22:39:06 -04:00
f1b30fd4f6 draft bsd intro and bootstrapping 2015-08-12 22:18:29 -04:00
464a436f8f fixed testplay host, included lookup path tests in all, added stage for easier debugging 2015-08-12 19:26:52 -04:00
60803a1d3c added lookup paths testing 2015-08-12 19:26:52 -04:00
3d9875773b Merge pull request #11947 from resmo/for-ansible
cloudstack: refactor get_result()
2015-08-12 17:46:18 -04:00
2c34a5bdbd pass list correctly to lookup 2015-08-12 17:42:06 -04:00
dd67b1e4d6 Adjust relative include searches when roles are involved
Fixes #11895
2015-08-12 17:15:52 -04:00
4f3c863b42 cloudstack: refactor get_result()
* A commen dict of keys has been defined, which we look in results returned from the API.
* self.returns dict can be use in subclass to extend this dict.
* Optionally the key name can be replaced with a new key name, often used to make the return keys identical to the arguments passed.
* Use new style class
2015-08-12 23:14:17 +02:00
d9833f227f Make sure cached data from file loads isn't impacted by modifications
Fixes #11893
2015-08-12 14:30:43 -04:00
6bceee9a93 now lvs/vg facts are only attempted if binary found 2015-08-12 10:53:13 -04:00
c7dde72aa0 Default listify to converting bare variables again
Since we explicitly set convert_bare=False in the template lookup
code, but still want individual looks that call listify directly to
convert bare variables if needed.
2015-08-12 10:49:46 -04:00
ac66e4001c Fix for variable precedence with tasks/includes
Fixes #11881
2015-08-12 10:49:45 -04:00
2688edb32b Merge pull request #11940 from alxgu/fix_lvm_facts
bugfix: missing path for lvm facts
2015-08-12 10:49:14 -04:00
39f81a8fa5 removed unused imports 2015-08-12 10:35:49 -04:00
c27978fa93 minor fixes to pull 2015-08-12 10:35:49 -04:00
9f29e39dea give more matching options for ansible-pull 2015-08-12 10:35:49 -04:00
e46b1e8d2b adjusted tree to work more like v1, also now skips when dir not supplied 2015-08-12 10:35:49 -04:00
1ea1b9fb13 bugfix: missing path for lvm facts 2015-08-12 16:35:31 +02:00
d122229147 added info about refresh_inventory to changelog 2015-08-12 10:35:12 -04:00
49d88cef9c meta: refresh_inventory and several inventory fixes 2015-08-12 10:35:12 -04:00
8e30e3791e Merge pull request #11811 from amenonsen/fixme-range
FIXME in host range parsing
2015-08-12 09:06:39 -04:00
624065f2bb Merge pull request #11936 from ringerc/patch-1
Document any_errors_fatal and max_fail_percentage
2015-08-12 09:05:31 -04:00
ae9d264b86 Merge pull request #11762 from amenonsen/9795-rebase
Add LVM facts to setup module
2015-08-12 08:55:08 -04:00
829a88b906 Disable undefined error failures during conditional templating
This allows us to properly catch the 'is defined' and 'is undefined'
checks and return the correct boolean result.

Fixes #11892
2015-08-12 07:37:03 -04:00
68c71ecba8 Document any_errors_fatal and max_fail_percentage 2015-08-12 17:48:42 +08:00
e0b074000e Merge pull request #11764 from lpirl/devel_v2
fixes remote code execution for su/sudo with strict remote umasks
2015-08-11 22:30:44 -04:00
38eb53de1d Fix bug in vars using correct temp value for vars
Fixes #11877
2015-08-11 21:23:37 -04:00
4d853a5d3c implemented for v2, missing --tree option for adhoc 2015-08-11 19:18:10 -04:00
79a1bca010 avoid circular import 2015-08-11 17:20:48 -04:00
582edfead8 Merge pull request #11932 from jlmitch5/update_doc_ads
fix docsite ad placement on safari
2015-08-11 16:43:11 -04:00
a83b8220ef added import back 2015-08-11 16:42:51 -04:00
6e825e8c22 fixed listify for lookups, made sure convert_bare is only on with_ 2015-08-11 16:42:09 -04:00
adb9d7e461 Track role execution per-host, not overall in the role
Fixes #11863
Fixes #11878
2015-08-11 16:34:58 -04:00
ba31121c56 fix docsite ad placement on safari 2015-08-11 16:20:04 -04:00
fb5003dbfc Merge pull request #11928 from jlmitch5/update_doc_ads
update docsite ads
2015-08-11 15:05:13 -04:00
b5b73c1b5b update docsite ads 2015-08-11 13:29:18 -04:00
6338c3b28c Merge pull request #11925 from resmo/feature/get_result
cloudstack: add get_result() in utils to return common results
2015-08-11 12:10:09 -04:00
e62fbf5fba cloudstack: add get_result() in utils to return common results 2015-08-11 18:03:50 +02:00
08e791595b Merge pull request #11922 from aioue/patch-1
Update playbooks_tags.rst
2015-08-11 10:15:41 -04:00
8f25ef1fc9 Merge pull request #11923 from amenonsen/9433-rebase
#9433 rebase: Cache the results for the RackSpace dynamic inventory
2015-08-11 10:11:12 -04:00
8a61303c88 Move the cache file to ~/.ansible/tmp.
A future branch might make it configurable.
2015-08-11 18:47:32 +05:30
07a4076d12 Name cache file by relevant regions - they might change between calls.
Also, use old school string interpolation so that the plugin is compatible with
Python < 2.7.
2015-08-11 18:47:32 +05:30
cd1125aac2 Save the cache in a file specific to the RackSpace account in use. 2015-08-11 18:47:32 +05:30
804489f734 Cache the results for the RackSpace dynamic inventory. 2015-08-11 18:47:32 +05:30
19373e262c Update playbooks_tags.rst
This important point gets lost in the fixed width word wrap of the docs site. Separating it out to it's own line stops it being lost in the noise of the previous sentence.
2015-08-11 13:20:48 +01:00
f904acbd14 Fixing bug related to listify changes 2015-08-11 01:33:43 -04:00
169d316704 Fixing bugs in include + loops
Fixes #11872
2015-08-11 01:33:43 -04:00
7666bde666 updated hashi_vault to new listify, added to changelog 2015-08-10 21:10:00 -04:00
4399ddc7da Merge pull request #11674 from defionscode/hashi_vault_lookup
Hashicorp Vault lookup Plugin
2015-08-10 21:07:22 -04:00
175068fdae Hashicorp Vault lookup Plugin 2015-08-10 19:35:28 -04:00
7e7b546c34 reinstated listify 2015-08-10 17:38:20 -04:00
7eb56abe3d added cs_ip_address to changelog 2015-08-10 17:38:20 -04:00
4ccdb81bf5 Updates to Windows Azure inventory script from Tower. Includes changes from https://github.com/ansible/ansible/pull/8403. 2015-08-10 17:35:47 -04:00
d745ffbc1b Merge pull request #11447 from cchurch/openstack_inventory_from_tower
Openstack inventory updates from Tower.
2015-08-10 15:42:40 -04:00
da56312322 Openstack inventory updates from Tower. Includes changes from https://github.com/ansible/ansible/pull/10491 and https://github.com/ansible/ansible/pull/10776. 2015-08-10 15:35:30 -04:00
3e5dbd045f fixed ref to removed var 2015-08-10 14:02:42 -04:00
5c1d850fbb now fixed to actually work 2015-08-10 13:51:56 -04:00
ee365c881f fixed typo 2015-08-10 13:44:52 -04:00
6cdf69ba8f Merge pull request #11915 from carloscarnero/issue-11914
Adding documentation for ask_vault_pass usage in ansible.cfg
2015-08-10 13:28:04 -04:00
7bdaac7f63 Adding documentation for ask_vault_pass usage in ansible.cfg 2015-08-10 13:25:00 -04:00
c08305a31f set script command itself to be sudable and not use the chmod sudoable settings as it can
ignore sudo settings for script when become_user is not root
fixes #11902
2015-08-10 13:19:37 -04:00
3d481ab4ff added znode to changelog 2015-08-10 13:19:37 -04:00
d35b956900 listify lookup plugin terms when they're specified as "{{ lookup(terms) }}"
Before this, they were not listified there but they were listified when
specified like this:

with_lookup: terms
2015-08-10 09:07:37 -07:00
e32d887609 Merge pull request #11900 from jensenbox/patch-2
Tiny typo fix
2015-08-07 17:55:39 -04:00
b5f5404e63 Tiny typo fix 2015-08-07 14:46:21 -07:00
dbab703265 fine tuned password handling as we were getting false positives, probably caused by other changes up the stack that now call these functions in more cases. 2015-08-07 16:27:25 -04:00
6fcfebd21d made sure we need becoem before we format the command, added debug entry also 2015-08-07 16:27:25 -04:00
df768e0db4 fixed debug statement 2015-08-07 16:27:25 -04:00
177499476b fixed warning 2015-08-07 16:27:25 -04:00
1dd3ce459d added ini lookup to changelog 2015-08-07 16:27:25 -04:00
3ef49844db Update core submodule ref 2015-08-07 12:28:56 -07:00
8f106c9a58 Merge pull request #11078 from Yannig/devel
New lookup plugin : ini
2015-08-07 09:46:54 -04:00
07fcb50b9b Porting ini lookup plugin against ansible v2. 2015-08-07 09:40:24 +02:00
48840ad498 Merge branch 'dmccue-devel' into devel 2015-08-07 00:32:02 -04:00
e2a8a68c85 Cleaning up some debugging/commented code from #11709 2015-08-07 00:28:54 -04:00
54bab2c47e fixed issues with output format and order key 2015-08-07 00:28:54 -04:00
ba6b89a5b1 adjusted output behavior 2015-08-07 00:28:54 -04:00
0ab970da98 support for _meta retrieval 2015-08-07 00:28:54 -04:00
d698a767fc Cleaning up some debugging/commented code from #11709 2015-08-07 00:28:17 -04:00
2e1030763c Merge branch 'devel' of https://github.com/dmccue/ansible into dmccue-devel 2015-08-07 00:25:38 -04:00
a91428c65c Merge pull request #11887 from amenonsen/home
Add missing $
2015-08-07 00:24:51 -04:00
9635f1468a minor changelog updates 2015-08-07 00:20:34 -04:00
f1144752c4 Pull in docs fix from core modules 2015-08-06 21:11:49 -07:00
114070c226 Add missing $ 2015-08-07 09:41:29 +05:30
e7d0c9f820 Re-add vars to Base and standardize var processing
Fixes #11779
2015-08-07 00:06:30 -04:00
ebfd99e307 Merge pull request #8870 from photoninger/spacewalk_organizations
Add support for multiple organizations in spacewalk.
2015-08-07 00:00:23 -04:00
636f88fd31 Merge pull request #9438 from binarytemple/patch-1
export ANSIBLE_HOME so it can be used in scripts
2015-08-06 23:59:21 -04:00
dbe7a9fe2f Merge pull request #11857 from quinot/bug/playbook-init-comment
Minor comment fix
2015-08-06 23:39:08 -04:00
08109731f3 minor changelog updates 2015-08-06 23:31:18 -04:00
3c57018a10 Merge pull request #11778 from Ensighten/add_credstash_plugin
add credstash lookup plugin
2015-08-06 23:27:18 -04:00
d47d0b1d7f now continue/abort mode allows ignoring other input 2015-08-06 22:16:30 -04:00
a555a0652e allow for vars_prompt and pause prompt to be skipped in non interactive settings
ansible-pull users rejoice
2015-08-06 19:20:45 -04:00
ce52fdebe8 Pull in get_url checksum change 2015-08-06 15:45:23 -07:00
29cd72b7d8 even simpler condition tree for pause 2015-08-06 18:40:15 -04:00
dc80bc8929 now pause behaves like v1 pause 2015-08-06 18:09:59 -04:00
f7707d8850 brought user_input back to pause 2015-08-06 17:49:14 -04:00
00b1a2c865 Restore ValueError in md5 method and change finding the available hash algorithms so we only have to do it once 2015-08-06 14:40:28 -07:00
15a20e814b added tags back to ansible-pull 2015-08-06 17:37:05 -04:00
5f0359c119 keep banners at 79 2015-08-06 17:37:05 -04:00
25e67bb716 text wrap now adapts to terminal 2015-08-06 17:37:05 -04:00
80cb69214b Merge pull request #11840 from muffl0n/module_utils_hash_algorithms
Add get_available_hash_algorithms()
2015-08-06 14:29:31 -07:00
d44daf53cc Allow wrapped text in deprecated messages 2015-08-06 17:21:02 -04:00
5eb092b331 Handle top-level vars for include tasks to match v1 syntax
The "streamlined" syntax will be deprecated at some point in the future.

Fixes #11882
2015-08-06 17:21:02 -04:00
7062cb3bb7 removed soon to be deprecated role like include syntax 2015-08-06 16:54:13 -04:00
e16b24c01e Update submodule ref 2015-08-06 08:45:09 -07:00
e8452c864e Restore the relative path handling portion of #11865 2015-08-06 07:28:22 -07:00
26d5a17b59 Make sure inventory loads files with non-relative paths
This is a slightly different fix than we originally committed, but fixes
the problem in a less invasive way (and I believe it's generally better
that we don't deal with relative paths internally past this point)

Fixes #11789
2015-08-06 10:18:58 -04:00
b9433650d1 Revert "Path of group_vars and host_vars were getting the basedir added twice."
in view of simpler solution incomming from james
This reverts commit bae7a02be5.
2015-08-06 10:09:43 -04:00
a5e6845c8b Revert "Allow exceptions to pass through the program"
breaks handling constants.py errors gracefully

This reverts commit 59f96d713e.
2015-08-06 10:02:58 -04:00
d1a6cfe6f0 Merge pull request #11798 from daburmistrov/daburmistrov-docsite-any_errors_fatal
add documentation about any_errors_fatal
2015-08-06 09:54:24 -04:00
7d5026a330 removing confusing parts 2015-08-06 16:51:04 +03:00
9f156e5550 updated submodule refs 2015-08-06 09:42:35 -04:00
7bea04141b Merge pull request #11865 from ansible/fix-group_vars_path
Path of group_vars and host_vars were getting the basedir added twice.
2015-08-06 09:40:13 -04:00
08e6c1d82b avoid possible errors with new broadcast handling in linux 2015-08-06 09:00:52 -04:00
cb2cfaebda started porting chroot to v2 2015-08-06 08:55:22 -04:00
262c75c253 Merge pull request #10971 from mightydok/debbraoadcastfix
Add missed broadcast address to linux network facts.
2015-08-06 08:52:55 -04:00
90591782d6 Merge pull request #11869 from charleswhchan/devel
Update README.md
2015-08-06 07:22:13 -04:00
0034b11e4f Merge pull request #11868 from charleswhchan/patch-1
Update README.md
2015-08-06 07:21:32 -04:00
151010920d Merge pull request #11867 from willthames/dont_smother_exceptions
Allow exceptions to pass through the program
2015-08-06 07:17:02 -04:00
59f96d713e Allow exceptions to pass through the program
This is useful when using `ipython --pdb -- $(which ansible-playbook)
...` for debugging.

Also show traceback when `ANSIBLE_DEBUG` is on
2015-08-06 21:11:38 +10:00
87ef53c962 credstash lookup plugin: python 2.6-compatible string.format() 2015-08-05 23:40:43 -07:00
c4629b72e0 credstash lookup plugin: error out in run function when credstash not installed, not at module scope 2015-08-05 23:37:10 -07:00
3df35c293b Update README.md
Reformat commands to code format to make it stand out.
2015-08-05 21:15:49 -07:00
1f899e92d1 Update README.md
Fix missing download badge. Link to shields.io.
2015-08-05 21:08:16 -07:00
bae7a02be5 Path of group_vars and host_vars were getting the basedir added twice.
Fix inventory so this won't happen and fix DataLoader so that it will
test relative paths relative to self._basedir

Fixes #11789
2015-08-05 17:41:17 -07:00
e7b5cb8782 Fix synchronize source path with roles and local connection
Fixes #8261
2015-08-05 13:32:12 -07:00
dd7fa07038 Update submodule refs so synchronize plugin works 2015-08-05 13:19:28 -07:00
308bf80055 Cleanups to synchronize including:
* Better comments
* Reorganize code so related settings are close to each other
* Add ::1 to the "localhost" patterns we look for
* Make the dest_port parameter override the ansible_ssh_port setting
* Fix dest_port (wasn't being set)
* more complete detection of delegate_to
* Fix set_remote_user (wasn't being looked for in parameters)
* Instead of removing mode here, have the ansible module accept it
  (better documents the parameters doing it htat way)
2015-08-05 13:16:08 -07:00
37e38924de Allow field attributes to have priorities
So that roles are loaded ahead of all other play fields, meaning any
plugins contained within the roles are loaded first before tasks.

Fixes #11858
2015-08-05 13:54:00 -04:00
f69da544f7 add win_basename and win_dirname filters 2015-08-05 18:38:15 +01:00
fad44862a5 Implementing includes in the free strategy 2015-08-05 11:53:04 -04:00
2b9b3a08a1 make sure you only update pci data if there is a match 2015-08-05 09:44:37 -04:00
09d257e637 Porting ini lookup plugin against ansible v2. 2015-08-05 12:07:16 +02:00
5d3cb636ad Minor comment fix 2015-08-05 11:30:26 +02:00
47db352725 Merge remote-tracking branch 'ansible/devel' into devel 2015-08-05 11:20:41 +02:00
c0bd140959 Add documentation for the ini lookup plugin. 2015-08-05 11:09:40 +02:00
733d40a77c When value does not exist, return default value instead of stopping ansible with an exception. 2015-08-05 10:54:24 +02:00
faf4c3bb6c Merge pull request #11816 from amenonsen/ssh-ipv6
Fix ssh connections to IPv6 addresses
2015-08-05 00:10:34 -04:00
dbd755e0f4 Fix jinja2 template search pathing
Fixes #9933
2015-08-04 22:50:16 -04:00
934ce86d35 update credstash lookup plugin to use Python 2.4-compatible exception catching 2015-08-04 18:29:37 -07:00
479c4a4be9 enabled yaml highlighting globally, made specific emphasis for blocks in playbooks_blocks docs 2015-08-04 19:13:09 -04:00
83ca5fb919 added ec2_vpc_subnet to changelog 2015-08-04 19:10:55 -04:00
6faaf41069 Update conditional docs since @jimi-c got playbook includes working in 2.0 2015-08-04 13:14:05 -07:00
61e76fd707 Allow conditionals on PlaybookInclude statements
Fixes #11852
2015-08-04 15:24:28 -04:00
0b277b43a4 add documentation about any_errors_fatal 2015-08-04 22:09:33 +03:00
b6c3e5d797 Validate variable names given in set_fact
Fixes #11851
2015-08-04 13:30:47 -04:00
9891bcbcae Fix unit tests broken by previous commit 2015-08-04 12:40:13 -04:00
5266679964 Use templar all the way down
Fixes bugs related to creating Templar() objects on the fly, where
the shared loader objects (serialized to TaskExecutor) aren't used
so information loaded into plugin loaders after forking is lost.

Fixes #11815
2015-08-04 12:25:53 -04:00
8d6d711a5c move get_available_hash_algorithms() from get_url 2015-08-04 08:57:36 +02:00
c3ce140dd2 Exclude loop_args from post_validation for tasks
This field is templated specially during the TaskExecutor's loop
calculation, so there's no need to post validate it again.

Fixes #11481
2015-08-04 01:12:27 -04:00
aefca24616 Merge pull request #10857 from jeffb-stell/devel
Add test for https://github.com/ansible/ansible/issues/9851
2015-08-03 19:23:59 -04:00
015b922c1f fix quoting for become commands
fixes #11808
2015-08-03 18:49:23 -04:00
ca941ec632 style cleanup because -ECANNOTUNDERSTAND without it 2015-08-03 15:05:26 -07:00
f86245dcb0 Add a warning about python3 in the synchronize plugin 2015-08-03 15:05:26 -07:00
cedc8416df added slackpkg to changelog 2015-08-03 16:35:45 -04:00
d28ec0b49e added apk to changelog 2015-08-03 16:35:45 -04:00
6b244ed61e update unit tests for role templating changes 2015-08-03 16:33:47 -04:00
f0431eaea9 Make ansible_python_interpreter work with synchronize
Fixes #11836
2015-08-03 13:32:24 -07:00
8279557e8f Allow role names to be templated
Fixes #10858
2015-08-03 16:26:13 -04:00
ed603f7030 Fix free strategy only running first play in a multi-play playbook
Fixes #11839
2015-08-03 14:40:16 -04:00
c2435fab7e Inject the play context vars into the variables used for loop item templating 2015-08-03 12:12:45 -04:00
bcbcfc79be Fix relative paths for included files
Also modifies the Play class to not include become* fields in the
post-validation step.

Fixes #11353
2015-08-03 12:04:31 -04:00
2673eb0afb Add option to fail on undefined variables to listify
And use it in the call to get the loop items for a task.
2015-08-03 12:04:31 -04:00
a586c74967 Merge pull request #11838 from cchurch/stringify_powershell_unquote_value
Fix for PowerShell unquote method when passed None.
2015-08-02 22:57:27 -04:00
f6d1b5e233 Merge pull request #11835 from cchurch/raw_is_not_raw_enough
Raw is not raw enough
2015-08-02 22:56:45 -04:00
0c18f18d16 Merge pull request #11831 from marcosgm/devel
Bug #11830, keep working even if we use private_networking
2015-08-02 22:48:23 -04:00
7b9aee7077 Merge pull request #11832 from amenonsen/zeroforks
Disallow --forks 0
2015-08-02 22:39:21 -04:00
cafc35fd5b Fix for PowerShell unquote method when passed None. 2015-08-02 18:38:29 -04:00
7d9689c1c5 Slice ascii_letters directly instead of using 'for x in range()' 2015-08-02 23:47:18 +05:30
5f13d40a2b Mention x:y ranges in pattern documentation 2015-08-02 23:47:18 +05:30
bfe708a189 Make host range parsing errors issue better messages
Now we always say "host range must …specific thing…"
2015-08-02 23:47:18 +05:30
1413496292 Implement step for alphabetic ranges: [a:e:2] => a,c,e 2015-08-02 23:47:18 +05:30
72715c6add Fix ssh connections to IPv6 addresses
We can unconditionally wrap remote_addr in square brackets for scp and
sftp (both of which require them for IPv6 addresses), but not wrap them
at all for ssh (which doesn't accept them). This way, we don't have to
detect and treat IPv6 addresses specially. This works for hostnames,
IPv4 addresses, and IPv6 addresses.

The earlier code seemed to intend to wrap all IPv6 addresses in square
brackets, which would have broken ssh, but it actually made no attempt
to detect IPv6 addresses at all (so it broke only with IPv6 addresses
for scp and sftp).

Based on a review of PR #11677 by @JuiceBoxSingularity
2015-08-02 23:46:01 +05:30
6d514e18b7 Merge pull request #11834 from amenonsen/pauseprompt
Make 'pause: prompt=…' print the prompt
2015-08-02 13:01:39 -04:00
6969b5ac8b Make sure raw doesn't eat key=value arguments. 2015-08-02 11:57:32 -04:00
861da614cc Make 'pause: prompt=…' print the prompt
In stable-1.9, the prompt string is passed to raw_input(), which prints
it without an extra \n. Here we're just print()ing it, so the \n would
be doubled.
2015-08-02 20:08:28 +05:30
9936c5f9f6 Fixing the pause module for devel 2015-08-02 09:29:13 -04:00
8de70fa657 Disallow --forks 0
Without at least one worker process, things break:

Traceback (most recent call last):
  File "/home/ams/extern/ansible/ansible/lib/ansible/executor/process/result.py", line 103, in run
    result = self._read_worker_result()
  File "/home/ams/extern/ansible/ansible/lib/ansible/executor/process/result.py", line 69, in _read_worker_result
    (worker_prc, main_q, rslt_q) = self._workers[self._cur_worker]
IndexError: list index out of range
2015-08-02 14:10:45 +05:30
7bd1749f48 Bug #11830, keep working even if we use private_networking 2015-08-01 23:21:20 -04:00
cf35bdbdf9 Merge pull request #11827 from amenonsen/trivial-fixmes
Remove TODO: the play already overrides options
2015-08-01 07:40:15 -07:00
a9b020d6de Remove TODO: the play already overrides options 2015-08-01 20:09:02 +05:30
686b07603d Merge pull request #11828 from amenonsen/configmsg
Show a better message when ansible.cfg is not found
2015-08-01 07:34:54 -07:00
1f2adb5e14 Show a better message when ansible.cfg is not found
Earlier we would say «Using  as config file» if we didn't find one.
2015-08-01 19:44:20 +05:30
dd65b55cc4 Merge pull request #11825 from ansible/tox-py24
Split py24 testing into its own tox section
2015-07-31 23:54:47 -07:00
87cb7f8147 Push python2.4 check into travis 2015-07-31 23:45:10 -07:00
0137c10e0e Merge pull request #11826 from amenonsen/trivial-fixmes
Another small batch of trivial FIXME removals
2015-08-01 01:44:57 -04:00
2cb7cd8379 Remove outdated FIXME; _compute_delegate is called below 2015-08-01 09:35:32 +05:30
7b3cb2126c Remove outdated FIXME; ROLE_CACHE is already implemented below 2015-08-01 09:34:32 +05:30
53ae326603 Port some things in test-module to v2.
In particular, fix arg parsing

Fixes #11820
2015-07-31 20:40:07 -07:00
91a77b8603 Fix potential bug in parameter passing 2015-07-31 20:35:01 -07:00
13b8a57d3d Undo previous travis/tox fixes and fix underlying issue 2015-07-31 23:01:43 -04:00
7c332b63dc Updating tox script too 2015-07-31 22:55:59 -04:00
e7009a14b4 Removing python 2.4 from travis install 2015-07-31 22:52:54 -04:00
00daf43aed Merge pull request #11822 from ansible/synchronize-fix2
Fixes for synchronize with delegate_to
2015-07-31 22:43:46 -04:00
0d72be3953 become protection for local connections no longer needed 2015-07-31 18:26:30 -07:00
d1933accc3 Fixes for synchronize with delegate_to 2015-07-31 17:41:41 -07:00
2154212491 Merge pull request #11094 from cchurch/test_win_feature_has_servermanager
Only run win_feature tests when the host has the ServerManager module.
2015-07-31 17:52:45 -04:00
3939348286 Fix HostVars to support containment tests 2015-07-31 13:58:09 -07:00
8e164eb46b Merge branch 'cchurch-winrm_v2_fixes' into devel 2015-07-31 14:55:10 -04:00
74df17de29 Add an option for PowerShell modules to indicate support for check mode, skip running module if check mode is not supported. 2015-07-31 14:48:51 -04:00
8f549e11ab Merge branch 'winrm_v2_fixes' of https://github.com/cchurch/ansible into cchurch-winrm_v2_fixes 2015-07-31 14:40:45 -04:00
e87cf4a3cc Fixes for WinRM/PowerShell support in v2.
- Add support for inserting module args into PowerShell modules.  Fixes #11661.
- Support Windows paths containing spaces.  Applies changes from #10727 to v2.  Fixes #9999.  Should also fix ansible/ansible-modules-core#944 and ansible/ansible-modules-core#1007.
- Change how execution policy is set for running remote scripts.  Applies changes from #11092 to v2.  Also fixes ansible/ansible-modules-core#1776.
- Use codepage 65001 (UTF-8) for WinRM connection instead of default (CP437), convert command to UTF-8 and results from UTF-8.  Replaces changes from #10024.  Fixes #11198.
- Close WinRM connection when task completes.
- Use win_stat, win_file and win_copy modules instead of stat, file and copy when called from within other action plugins (only when using WinRM+PowerShell).
- Unquote Windows path arguments before passing to win_stat, win_file, win_copy and slurp modules (only when using WinRM/PowerShell).
- Check for win_ping module to determine if core modules are missing (only when using WinRM/PowerShell).
- Add stdout_lines to result from running low level commands (so stdout_lines is available when using raw/script).
- Update copy action plugin to use shell functions for joining paths and checking for trailing slash.
- Update fetch action plugin to unquote source path when using Windows paths.
- Add win_copy and win_template action plugins that inherit from copy and template.
- Support running .bat and .cmd scripts using default system encoding instead of UTF-8.
- Always send PowerShell commands as base64-encoded blobs to allow for running simple PowerShell commands via raw.
- Support running modules on Windows with interpreters other than PowerShell.
- Update integration tests to support above changes and test unicode fixes.
- Add test for win_user error from ansible/ansible-modules-core#1241 (fixed by ansible/ansible-modules-core#1774).
- Add test for additional win_stat output values (implemented by ansible/ansible-modules-core#1473).
- Add test for OS architecture and name from setup.ps1 (implemented by ansible/ansible-modules-core#1100).

All WinRM integration tests pass for me with these changes.
2015-07-31 14:38:31 -04:00
fa8043c0ba corrected typo 2015-07-31 13:49:48 -04:00
f16b745f17 now properly uses default port if defined 2015-07-31 12:01:58 -04:00
496186f5de makes ssh plugin resilient against invalid entries in hosts file
fixes #10238
2015-07-31 12:01:58 -04:00
437d4deffc change ec2 util to create only requested objects 2015-07-31 09:47:24 -06:00
e349004325 Update submodule ref to pull in apt_repo fixes 2015-07-31 08:22:48 -07:00
aa1e00e8e7 Forgot to use commit -a to submit all changes... 2015-07-31 14:23:54 +02:00
38ff797d57 Added support for ini-file.
Added _meta dictionary with hostvars in --list json output.
2015-07-31 14:18:59 +02:00
02294c52ce Typo 2015-07-31 13:25:42 +02:00
4614a574ea Allows network network interface facts collection as an unprivileged user and adds more facts 2015-07-31 10:39:02 +02:00
e181bcf62b Allows to fetch machine architecture as an unprivileged user 2015-07-31 10:35:10 +02:00
8629ac539e Extend python-kerberos dependency section
Add (untested) dependencies for Portage, pkg, OpenCSW, and Pacman
2015-07-31 18:22:52 +12:00
9aa4214417 fixed delegate_to ref in syncronize 2015-07-30 20:53:18 -04:00
8a00dff989 updated submodule refs 2015-07-30 18:37:41 -04:00
c2d8ca4bf7 fixed test to expected output 2015-07-30 18:36:54 -04:00
07e5e98cbf removed jinaj2 override restrictions 2015-07-30 16:53:39 -04:00
113f709eac brought up to date with default 2015-07-30 16:53:38 -04:00
51de207197 Merge pull request #11805 from amenonsen/trivial-fixmes
A series of trivial FIXMEs for devel
2015-07-30 16:40:17 -04:00
92327ba11f add credstash lookup plugin docs 2015-07-30 21:24:11 +01:00
193e857bc4 credstash lookup plugin: raise AnsibleError when credstash library not installed 2015-07-30 21:04:26 +01:00
b07f8e7a7e Add an option for PowerShell modules to indicate support for check mode, skip running module if check mode is not supported. 2015-07-30 15:54:32 -04:00
222f04e387 Submodule pointer update 2015-07-30 14:50:53 -04:00
2ed5d29951 Merge pull request #11040 from resmo/patch-1
doc: we need GPLv3 license headers
2015-07-30 14:40:35 -04:00
807079ec2f Remove outdated FIXME; HostVars is imported and used below 2015-07-31 00:09:49 +05:30
d05c4b82aa Merge pull request #11803 from amenonsen/prompt_encrypt
Uncomment encrypt handling for vars_prompt
2015-07-30 14:21:32 -04:00
845784b572 Remove outdated FIXMEs; all use combine_vars already 2015-07-30 23:47:41 +05:30
efcad3aa6d Re-allow vars on tasks, specifically for includes 2015-07-30 14:14:49 -04:00
0ad52a403f Merge pull request #11804 from amenonsen/fixme
Easy FIXMEs
2015-07-30 13:58:40 -04:00
1541e331c9 Also fix UTF-8 handling in vars_prompt 2015-07-30 23:27:39 +05:30
549c204051 Submodule pointer update 2015-07-30 13:48:09 -04:00
694d2103b1 Remove outdated FIXME code
This is already handled in PlayContext.set_options.
2015-07-30 23:12:06 +05:30
2a93559fc8 Merge branch 'winrm_v2_fixes' of https://github.com/cchurch/ansible into cchurch-winrm_v2_fixes 2015-07-30 13:26:48 -04:00
ff2d160fff Correct invalid reference to global display 2015-07-30 22:52:47 +05:30
10def3aa54 Uncomment encrypt handling for vars_prompt 2015-07-30 22:42:21 +05:30
b2dc66c7ea now check stderr also on become for ssh plugin for the cases where sudo or su do not want to prompt/echo on stdin
fixes #11796
2015-07-30 13:11:41 -04:00
17f659a143 added some debug to galaxy 2015-07-30 12:35:27 -04:00
29bc8f51d7 made tags display closer to v1 2015-07-30 12:35:27 -04:00
e2e0dc2719 added selinux_permissive 2015-07-30 12:35:27 -04:00
13198c199e Add support for multiple organizations in spacewalk. 2015-07-30 14:15:39 +02:00
bbee2a9c65 Add pywinrm dependencies for RPM 2015-07-30 18:21:26 +12:00
b37be236d9 Merge pull request #11475 from nibalizer/cfacter_support
Use cfacter instead of facter if possible
2015-07-29 22:46:21 -04:00
769b0d92ee Merge pull request #11795 from amenonsen/nonedir
Don't stat None
2015-07-29 22:36:21 -04:00
3d581e5306 Don't stat None
Fixes #11794, regression introduced by #11010
2015-07-30 08:02:27 +05:30
527ae360b0 Merge pull request #10652 from vodik/nspawn
Support querying systemd container information
2015-07-29 21:51:58 -04:00
74e351a8ea Update dependencies for pywinrm
Adding the python-dev and libkrb5-dev libraries avoids the error message "error: command 'x86_64-linux-gnu-gcc' failed with exit status 1" when running "pip install kerberos"
2015-07-30 13:45:59 +12:00
4b8e368039 Merge pull request #11010 from sillydong/devel
Add judgment to to fix path0 if ANSIBLE_CONFIG is set to a dir
2015-07-29 21:36:07 -04:00
0e77871426 fixed non ignore errors path to actually interrupt
fixed cases where missing/inaccessible file gave exception, now you get nice error
2015-07-29 20:13:17 -04:00
07b14b9731 integration tests for windows implementation of lineinfile 2015-07-29 19:50:06 -04:00
8153c34abf now returns false on bad role_data 2015-07-29 19:48:21 -04:00
e81ec32719 made galaxy more resilient with bad yaml files and comments/spaces in non yaml files
fixes #10641
2015-07-29 19:28:29 -04:00
63b54a3271 Merge pull request #11787 from jcpowermac/move_vmware_module_utils
Moving VMware Utilites module
2015-07-29 18:08:23 -04:00
2f5ced8856 Moving VMware Utilites module
Moved `vmware.py` from v1 to `lib/ansible/module_utils/vmware.py`.

No other changes has been made since these two PRs:
https://github.com/ansible/ansible/pull/10812
https://github.com/ansible/ansible/pull/10760
2015-07-29 17:16:15 -04:00
614463e899 Merge branch 'devel' of https://github.com/ansible/ansible into devel 2015-07-29 15:51:20 -04:00
ba56beda90 Fix include task using a potentially undefined variable 2015-07-29 15:49:29 -04:00
827f2ff0ac corrected var name 2015-07-29 15:46:13 -04:00
ced93d35ca adjusted list hosts across adhoc and playbook cli 2015-07-29 15:46:13 -04:00
45ec25de83 corrected var name 2015-07-29 15:43:52 -04:00
3a50c08c01 Merge branch 'pluggable_jinja_tests' of https://github.com/quixoten/ansible into quixoten-pluggable_jinja_tests 2015-07-29 15:16:27 -04:00
be3da221cd adjusted list hosts across adhoc and playbook cli 2015-07-29 14:57:00 -04:00
782c2f75df Make sure role deps inherit conditionals/tags specified via params
Fixes #7353
2015-07-29 14:49:08 -04:00
bedfe00de8 Merge pull request #11336 from saada/patch-1
Update Vault rekey() in vault.py to validate files passed before input
2015-07-29 12:52:14 -04:00
4f1d365a25 Merge pull request #11783 from ansible/synchronize-fix
Synchronize in wasn't running on localhost in the default case which …
2015-07-29 09:33:01 -07:00
088682f518 Synchronize in wasn't running on localhost in the default case which meant that rsync was run on the wrong host.
Fixes #11649
2015-07-29 09:10:24 -07:00
ddd46f6599 Update rekey() in vault.py to validate files passed exist before prompting for password 2015-07-29 09:03:15 -07:00
8798ce1973 Merge pull request #9365 from t0mk/ssh_config_fix
fix ssh_config inventory plugin to work with paramiko 1.7.2 till 1.15.2
2015-07-29 11:53:56 -04:00
29347ac457 switched from png to svg
fixes #9885
2015-07-29 11:25:42 -04:00
0784fa1765 removed import q 2015-07-29 11:00:04 -04:00
96bcf50a94 implemented requirements file in v2
fixes #11179
2015-07-29 10:59:33 -04:00
bb6a327c1b fix ssh_config inventory plugin to work with paramiko 1.7.2 till 1.15.2 2015-07-29 16:58:16 +03:00
71867f9480 Remove vars attribute from base
Fixes #11779
2015-07-29 09:45:30 -04:00
695e456cb0 add credstash lookup plugin 2015-07-29 11:18:13 +01:00
956fa80115 Add note about installing cryptography. 2015-07-29 11:43:10 +02:00
132c14eb57 indented hosts 2015-07-28 22:31:40 -04:00
c0c094c413 now all --list options are working! 2015-07-28 22:30:59 -04:00
884435a1aa minor cosmetic changes to list options 2015-07-28 22:14:41 -04:00
056602c424 rearranged --list- options, now they are consolidated when used toghether, less loops, more concise output
list-hosts works
list-tasks works, but needs better task naming (missing role info)
list-tags only shows play tags
2015-07-28 22:05:49 -04:00
b8336f222d Merge pull request #11560 from oscarhealth/devel
ability to specify any combination of EC2 instance states to return
2015-07-28 21:11:30 -04:00
d75b4cd190 Merge pull request #11006 from alexlo03/ec2_inventory_clear_errors
explain source of EC2 inventory error
2015-07-28 19:18:49 -04:00
7a019d930e Merge pull request #8469 from srvg/packageversion_more_gitinfo
packaging: add short hash and branch name in package version for unoffici...
2015-07-28 19:17:30 -04:00
cc85473c1e show role search path when not finding a role
fixes #9770
2015-07-28 19:07:47 -04:00
adc8a32c65 added vca_nat and vca_fw to changelog 2015-07-28 18:47:16 -04:00
d276b69b2a put proxmox inventory in correct dir and added to changelog 2015-07-28 18:38:23 -04:00
018ca6ddef Merge pull request #9273 from gauthierl/proxmox_inventory
add a proxmox inventory plugin
2015-07-28 18:36:22 -04:00
42cfacf83b Switch up the task/host overrides for PlayContext to use the compiled vars dict
Fixes #11436
2015-07-28 16:25:44 -04:00
2d2ec058c8 added xenserver_Facts to changelog 2015-07-28 16:13:31 -04:00
a8b2b5b0c9 avoids printing blank diffs
fixes #10147 fixes #9471
2015-07-28 15:47:52 -04:00
5cf2781528 A little more cleanup regarding _compute_environment_string 2015-07-28 15:34:10 -04:00
467432bef5 Fix incorrect module path for AnsibleError in action plugin base 2015-07-28 15:25:25 -04:00
f5c8055879 removed debug stuff 2015-07-28 15:25:17 -04:00
67ce15cd99 added ec2_vpc_route_table_facts to new module list 2015-07-28 14:59:27 -04:00
b91a211663 added note on module urllib2 consolidation 2015-07-28 14:48:24 -04:00
f4a997db49 added back but stderr, which was the original itnention 2015-07-28 14:36:06 -04:00
3b9282fb90 fixed dupe output in raw/command cases 2015-07-28 14:31:49 -04:00
a78fdde32c better handling for weird doc corner cases (abscense of options, bad text objects, etc)
also updated extras to get some docfixes on the module side
2015-07-28 14:30:46 -04:00
0d7d22d530 Add json and fetch_url notes to checklist 2015-07-28 11:15:44 -07:00
17103dd4cc update submodule refs 2015-07-28 13:08:05 -04:00
6cdee94c33 added missing skipped item function to base 2015-07-28 11:02:25 -04:00
6f93d228f6 made item output closer to v1 2015-07-28 10:59:39 -04:00
4f9d719b14 removed debug 2015-07-28 10:43:11 -04:00
d78c2fc212 now reports per task item 2015-07-28 10:41:40 -04:00
2d90cbf78b Properly fail results with rc != 0
Fixes #11769
2015-07-28 10:15:14 -04:00
787a0c4e04 fixed indent issues 2015-07-28 10:10:21 -04:00
58cccce384 Use PBKDF2HMAC() from cryptography for vault keys.
When stretching the key for vault files, use PBKDF2HMAC() from the
cryptography package instead of pycrypto. This will speed up the opening
of vault files by ~10x.

The problem is here in lib/ansible/utils/vault.py:

    hash_function = SHA256

    # make two keys and one iv
    pbkdf2_prf = lambda p, s: HMAC.new(p, s, hash_function).digest()

    derivedkey = PBKDF2(password, salt, dkLen=(2 * keylength) + ivlength,
                        count=10000, prf=pbkdf2_prf)

`PBKDF2()` calls a Python callback function (`pbkdf2_pr()`) 10000 times.
If one has several vault files, this will cause excessive start times
with `ansible` or `ansible-playbook` (we experience ~15 second startup
times).

Testing the original implementation in 1.9.2 with a vault file:

In [2]: %timeit v.decrypt(encrypted_data)
1 loops, best of 3: 265 ms per loop

Having a recent OpenSSL version and using the vault.py changes in this commit:

In [2]: %timeit v.decrypt(encrypted_data)
10 loops, best of 3: 23.2 ms per loop
2015-07-28 14:51:36 +02:00
77fc3ce759 removed unused import 2015-07-28 08:28:52 -04:00
aa5bd8c2b5 added pam_limits to changelog 2015-07-28 08:23:31 -04:00
d9aa14feea fixes remote code execution for su/sudo and strict remote umasks
* temporarily changes umask for creating temporary directories
    * otherwise parent directories may not get chmod'ed and end up
      unreadable
refs #9902
2015-07-28 19:24:23 +12:00
e505a1b7c4 Fix variable precedence integrationt test 2015-07-28 00:51:58 -04:00
c76a66694f fixed typo 2015-07-27 22:54:57 -04:00
d9c63fb273 added openvz to inventory 2015-07-27 22:52:12 -04:00
80ecab5317 Merge pull request #11761 from amenonsen/9843-rebase
Add pciid to LinuxNetwork interface fact
2015-07-27 22:20:04 -04:00
f344ec463f Add LVM facts to setup module
This commit adds LinuxHardware.get_device_facts() and calls that from
.populate().

LVM facts are only gathered if the setup module is running as root and
the lvm utilities are available (tested by searching for 'vgs').

If the conditions are met, facts are set for each volume group and
logical volume.

Example:

Test LVM Data:
$ sudo vgs
  VG   #PV #LV #SN Attr   VSize VFree
  test   1   2   0 wz--n- 5.00g 2.00g
$ sudo lvs
  LV      VG   Attr      LSize Pool Origin Data%  Move Log Copy%  Convert
  testlv  test -wi-a---- 1.00g
  testlv2 test -wi-a---- 2.00g

Facts Returned:
$ ansible localhost -i /tmp/inv -m setup -a 'filter=ansible_lvm'
localhost | success >> {
    "ansible_facts": {
        "ansible_lvm": {
            "lvs": {
                "testlv": {
                    "size_g": "1.00",
                    "vg": "test"
                },
                "testlv2": {
                    "size_g": "2.00",
                    "vg": "test"
                }
            },
            "vgs": {
                "test": {
                    "free_g": "2.00",
                    "num_lvs": "2",
                    "num_pvs": "1",
                    "size_g": "5.00"
                }
            }
        }
    },
    "changed": false
}

Test as non-root:
$ ansible localhost -i /tmp/inv-user -m setup -a 'filter=ansible_lvm'
localhost | success >> {
    "ansible_facts": {},
    "changed": false
}

Test without lvm utilities available
$ sudo mv /sbin/vgs{,.bk}
$ ansible localhost -i /tmp/inv -m setup -a 'filter=ansible_lvm'
localhost | success >> {
    "ansible_facts": {},
    "changed": false
}
2015-07-28 07:46:01 +05:30
5f8db9cd4b changed verbose_override to the new _ansible_verbose_override to keep in line with previous changes
output now defaults back to having indent=4
2015-07-27 22:15:44 -04:00
250620f2ab Add pciid to LinuxNetwork interface fact
This commit adds pciid to the LinuxNetwork fact object.

pciid is gathered if the symlink /sys/class/net/*/device exists.

Example [>>>> emphasis <<<<]:

$ readlink /sys/class/net/eth0/device
../../../0000:01:00.0

$ ansible localhost --ask-pass -i /tmp/hosts -m setup -a "filter=ansible_eth0"
SSH password:
localhost | success >> {
    "ansible_facts": {
        "ansible_eth0": {
            "active": false,
            "device": "eth0",
            "macaddress": "0c:d2:92:5d:6e:8e",
            "module": "alx",
            "mtu": 1500,
       >>>> "pciid": "0000:01:00.0", <<<<
            "promisc": true,
            "type": "ether"
        }
    },
    "changed": false
}
2015-07-28 07:30:03 +05:30
8746e692c1 changed check to allow for powerpc
fixes #11528
2015-07-27 21:44:17 -04:00
0c21196633 moved openvz inventory script to new home 2015-07-27 20:53:53 -04:00
164092a835 optimized module docs 2015-07-27 20:52:53 -04:00
65c649aa3e added virt_net to changelog 2015-07-27 20:52:53 -04:00
772841a0a2 added virt_pool module to changelog 2015-07-27 20:52:53 -04:00
330aee33c5 Merge pull request #8358 from jordonr/devel
Added OpenVZ Inventory python script
2015-07-27 20:50:58 -04:00
2575e1540a Merge pull request #11740 from amenonsen/8602-rebase
Encrypt the vault file after editing only if the contents changed
2015-07-27 20:45:03 -04:00
d2346fd2e2 Python2.4 compat fix 2015-07-27 15:34:51 -07:00
12e3a2a0c1 Merge pull request #11759 from resmo/fix/doc-changelog
changelog: fix typos
2015-07-27 18:02:55 -04:00
41319dc202 changelog: fix typos 2015-07-28 00:00:14 +02:00
d6cafff2f9 Additional changes to fix fileglob relative path lookups 2015-07-27 16:35:57 -04:00
9416fc6271 Merge pull request #8977 from billwanjohi/add_package_classifiers
add distutils package classifiers
2015-07-27 15:42:51 -04:00
010e58ebfa Merge pull request #9878 from ansible/handle-quoted-comma-dict-param
Handle quoting of values in dict parameters
2015-07-27 15:37:27 -04:00
b2739cec6d add distutils package classifiers
I was particularly interested in the programming language ones,
but the others might be useful to others browsing PyPI.

Now with GPLv3+, and Utilities topic.
2015-07-27 19:33:54 +00:00
6a68be4e28 Handle quoting of values in dict parameters 2015-07-27 12:31:05 -07:00
cb262449c7 Reworking internal result flags and making sure include_vars hides vault data
Fixes #10194
2015-07-27 14:04:31 -04:00
eebf437d87 Submodule pointer update 2015-07-27 12:51:58 -04:00
b2b19a1dc4 Merge pull request #11751 from amenonsen/playwithoutbook
A better error message for «ansible playbook.yml»
2015-07-27 12:42:56 -04:00
7d8afad28c Merge pull request #11750 from amenonsen/example-prompt
Fix incorrect example of vars_prompt
2015-07-27 10:44:51 -04:00
49a6601856 Further cleanup of internal use of ansible_ssh_host 2015-07-27 10:42:39 -04:00
ee835ff7ad Add a base-level get_basedir method for lookup plugins and fix relative lookups
Fixes #11746
2015-07-27 10:41:28 -04:00
7a76fcb159 merged 2015-07-27 11:57:58 +01:00
65d62090c2 A better error message for «ansible playbook.yml»
This is a very conservative change: we add the hint only if we're
definitely going to die already.
2015-07-27 12:43:21 +05:30
3a4dd523d3 Fix bug where we calculated the relative path of recurisive copies wrong
Fixes #11470
2015-07-27 02:29:38 -04:00
bb12121225 Fix incorrect example of vars_prompt 2015-07-27 11:08:39 +05:30
a1a8997e89 Merge pull request #11663 from whereismyjetpack/fix_ansible_ssh_host
only set ansible_ssh_host if not already set
2015-07-26 23:46:21 -04:00
a56ff7ae54 now it really is oneline 2015-07-26 23:14:07 -04:00
5d1d9f1505 fixed diff output to be as it was in 1.x, copy and template now use the same
functions to do difs.
2015-07-26 22:29:56 -04:00
c56a304ad9 Merge pull request #9195 from reedloden/add-dns-facts
Add several DNS-related facts by parsing /etc/resolv.conf
2015-07-26 14:59:55 -04:00
ccb7fb3b4c Submodule pointer update 2015-07-26 14:41:49 -04:00
034c766439 Fixing logic in template.py to not assume 'changed' is in the result 2015-07-26 13:57:25 -04:00
a78ed39f93 Merge pull request #11743 from renard/regex_escape-filter
Regex escape filter
2015-07-26 13:52:01 -04:00
db4b3544d7 Fix syntax error in action plugin template.py 2015-07-26 13:49:27 -04:00
eb1fb41576 Add several DNS-related facts by parsing /etc/resolv.conf
Facts include nameservers, domain, search path, sortlist, and options.
2015-07-26 10:46:59 -07:00
c0b7fcd304 Add documentation for regex_escape filter 2015-07-26 19:08:34 +02:00
36534668f0 Change name from re_escape to regex_escape to fit existing function names. 2015-07-26 19:03:56 +02:00
c1e4085251 Add regular expression escaping filter. 2015-07-26 19:03:27 +02:00
0b6fadaad7 started implementing diff
diff now works with template
also fixed check mode for template and copy
2015-07-26 12:22:22 -04:00
d11e07a0e5 Merge pull request #11738 from amenonsen/7485-rebase
Have ec2.py expand tilde and vars when looking up the EC2_INI_PATH env variable
2015-07-26 11:11:02 -04:00
f8bf2ba1bd Encrypt the vault file after editing only if the contents changed 2015-07-26 14:41:34 +05:30
7f45c9edf7 Have ec2.py expand tilde and vars when looking up the EC2_INI_PATH env variable 2015-07-26 12:57:56 +05:30
73aa5686cc Remove octal escapes from unicode escape handling
Fixes #11673
2015-07-25 16:30:11 -04:00
5be384bab0 Merge pull request #11733 from amenonsen/csvfile
v2 breakage: lookupfile should lookup the given file=xxx
2015-07-25 11:53:22 -04:00
6c1f4ddf7e Merge pull request #11736 from mscherer/fix_9971
Add more explicit documentation on ansible_nodename and ansible_hostname
2015-07-25 11:43:25 -04:00
c7c5b40aa8 Merge pull request #11735 from mscherer/fix_10273
Document and test 'is undefined' rather than 'is not defined'
2015-07-25 09:56:15 -04:00
b19eb0f4dc minor improvements to display 2015-07-25 09:15:33 -04:00
c2c20baf01 Add more explicit documentation on ansible_nodename and ansible_hostname
Fix #9971, based on text from Paul Czarkowski
2015-07-25 14:27:59 +02:00
0dc1cbd6b9 Merge pull request #9524 from ktosiek/patch-1
guide_rax.rst: fix add_host invocations
2015-07-25 08:27:29 -04:00
106e942faa Document and test 'is undefined' rather than 'is not defined'
According to https://github.com/ansible/ansible/issues/10273,
this syntax should work better for nested dicts.
2015-07-25 14:05:27 +02:00
8156ad3760 Delimiter param must be a string 2015-07-25 15:47:13 +05:30
8737061a8f lookupfile should lookup the given file=xxx
(Earlier it used to lookup the pre-split term.)
2015-07-25 15:38:26 +05:30
8509f22839 Merge pull request #11731 from danasmera/devel
Delete unused import glob
2015-07-25 02:47:58 -04:00
eca88d4253 Merge pull request #11732 from amenonsen/9212-rebase
Forbid copy: content="" with a directory destination
2015-07-25 02:47:19 -04:00
4ed664f4d0 Forbid copy: content="" with a directory destination
Fixes #9107, closes PR #9212
2015-07-25 11:21:14 +05:30
966193e233 Delete unused import glob 2015-07-24 23:57:38 -04:00
b9710b4a34 wrapped new system ssh key lookup in case file does not exist 2015-07-24 23:54:13 -04:00
491b5fea6a Merge pull request #11730 from amenonsen/7730-rebase
Have paramiko use /etc/ssh_known_hosts (#7730 rebase)
2015-07-24 23:47:26 -04:00
e4df8c3d36 Have paramiko use /etc/ssh_known_hosts
Fixes an issue with a confusing error: "paramiko: The authenticity of host '[host]' can't be established" when ssh on the command line doesn't complain

Closes PR #7730
2015-07-25 09:09:28 +05:30
0858d97c44 also captures typeerrors for when not getting a proper string in output 2015-07-24 18:43:40 -04:00
8ace659d4c Merge pull request #10524 from TwoD/arch
Added installation instructions for Arch Linux.
2015-07-24 18:33:21 -04:00
c5d2db9c88 Added note about Python 2 for Arch Linux and a link to the ArchWiki page. 2015-07-25 00:08:26 +02:00
8ee3b7384d Guard the PROTOCOL setting so that we work on older pythons 2015-07-24 15:07:02 -07:00
36382face9 Add a warning about mode being octal 2015-07-24 14:52:21 -07:00
eccfb7e0b5 Adding initial support for includes in handlers
Fixes #11694
2015-07-24 16:22:02 -04:00
7215470c6f implemented galaxy list in v2 2015-07-24 16:18:55 -04:00
9abd9a8f57 Make ansible-galaxy work with galaxy.ansible.com
Now works with role files that use Ansible Galaxy roles
Still work to do on making this work with internal roles
2015-07-24 16:04:10 -04:00
014f3e8f7a Merge pull request #11722 from amenonsen/tagdocs
Clarify that tagging an include/role tags every task within
2015-07-24 15:29:09 -04:00
587a327647 Merge pull request #11495 from xmj/devel
docsite/rst/intro_configuration.rst: reword Title.
2015-07-24 15:15:00 -04:00
92516f9d11 extend conditions for async error
fixes #11207
2015-07-24 15:11:35 -04:00
50d0d99ba6 Clarify that tagging an include/role tags every task within
Closes #11361
2015-07-25 00:21:06 +05:30
6e2aca2261 Merge pull request #11670 from jody-frankowski/update-intro-inventory-params
Fix intro_inventory documented params. Update for the new 'become' system
2015-07-24 14:40:43 -04:00
0ef4e0372b Fixes for WinRM/PowerShell support in v2.
- Add support for inserting module args into PowerShell modules.  Fixes #11661.
- Support Windows paths containing spaces.  Applies changes from #10727 to v2.  Fixes #9999.  Should also fix ansible/ansible-modules-core#944 and ansible/ansible-modules-core#1007.
- Change how execution policy is set for running remote scripts.  Applies changes from #11092 to v2.  Also fixes ansible/ansible-modules-core#1776.
- Use codepage 65001 (UTF-8) for WinRM connection instead of default (CP437), convert command to UTF-8 and results from UTF-8.  Replaces changes from #10024.  Fixes #11198.
- Close WinRM connection when task completes.
- Use win_stat, win_file and win_copy modules instead of stat, file and copy when called from within other action plugins (only when using WinRM+PowerShell).
- Unquote Windows path arguments before passing to win_stat, win_file, win_copy and slurp modules (only when using WinRM/PowerShell).
- Check for win_ping module to determine if core modules are missing (only when using WinRM/PowerShell).
- Add stdout_lines to result from running low level commands (so stdout_lines is available when using raw/script).
- Update copy action plugin to use shell functions for joining paths and checking for trailing slash.
- Update fetch action plugin to unquote source path when using Windows paths.
- Add win_copy and win_template action plugins that inherit from copy and template.
- Support running .bat and .cmd scripts using default system encoding instead of UTF-8.
- Always send PowerShell commands as base64-encoded blobs to allow for running simple PowerShell commands via raw.
- Support running modules on Windows with interpreters other than PowerShell.
- Update integration tests to support above changes and test unicode fixes.
- Add test for win_user error from ansible/ansible-modules-core#1241 (fixed by ansible/ansible-modules-core#1774).
- Add test for additional win_stat output values (implemented by ansible/ansible-modules-core#1473).
- Add test for OS architecture and name from setup.ps1 (implemented by ansible/ansible-modules-core#1100).

All WinRM integration tests pass for me with these changes.
2015-07-24 12:39:54 -04:00
cff77de917 added todo for future of feature 2015-07-24 12:00:38 -04:00
0089eb8102 reimplemented logging based on log_path var 2015-07-24 12:00:38 -04:00
ff49c5adac Make sure we're actually looping before looking at 'results' in TaskResult
Fixes #11696
2015-07-24 11:55:22 -04:00
0fcd53e887 Make sure the command is sudoable before checking for the become password
Fixes #11714
2015-07-24 11:37:26 -04:00
e49575ff56 added wrap_text to 'last resort' as it fails if there is an error in callbacks 2015-07-24 11:25:25 -04:00
8146a193eb Fix strategy base unit tests after 88e1ef8 2015-07-24 10:53:54 -04:00
e526743b4f Allowing args: "{{some_var}}" for task params again
This is unsafe and we debated re-adding it to the v2/2.0 codebase,
however it is a common-enough feature that we will simply mark it
as deprecated for now and remove it at some point in the future.

Fixes #11718
2015-07-24 10:33:12 -04:00
681eab1158 fix adhoc that broke with assuming step is always in options 2015-07-24 10:03:43 -04:00
88e1ef8c9b implemented --step in v2 2015-07-23 20:47:40 -04:00
f6a08ce1ba Adding a note about chaining filters after default(omit)
Fixes #10164
2015-07-23 16:58:12 -04:00
3bf1edfd96 Merge pull request #11591 from defionscode/boto3
Connection function for boto3
2015-07-23 15:54:28 -04:00
7bc789ba64 Properly template task names
Also fixes in the correct way the bug in which the role name was
incorrectly showing up twice in the task name.

Fixes #10347
2015-07-23 15:45:36 -04:00
698479a623 Add config file info to --version output
Fixes #10348
2015-07-23 15:32:39 -04:00
37ed756d66 Make sure role names are strings
Fixes #10497
2015-07-23 15:26:31 -04:00
469aa0c26a Don't wrap text on most errors 2015-07-23 15:26:30 -04:00
f8e4aff4c1 Cleanups:
* Don't reference __class__ when we can use the instance itself
* use isdisjoint() as it can stop once a match is found
* Remove a condtional that was taken care of in the conditonal just above
2015-07-23 12:13:45 -07:00
4e3f5e3be6 Merge pull request #11708 from bcoca/display_me
adding display to plugins and start moving debug to display
2015-07-23 14:32:18 -04:00
78df37db8a updated submodule refs 2015-07-23 13:44:47 -04:00
a6ba149c49 implemented simplified output for adhoc adn command modules as in v1 2015-07-23 13:42:20 -04:00
65ae9780fa Merge pull request #11079 from amegianeg/fix_broad_except_in_inventory
Avoid too broad except in Inventory
2015-07-23 13:36:02 -04:00
23a66c8344 fixed issues with output format and order key 2015-07-23 15:45:26 +01:00
a132e00cdc adjusted output behavior 2015-07-23 15:36:48 +01:00
35a5e011bb Merge pull request #11703 from snetting/update_man1
Update man1
2015-07-23 10:33:48 -04:00
e7733a7d3a Update submodule refs 2015-07-23 07:32:54 -07:00
851ed45bbf adding display to plugins and start moving debug to display 2015-07-23 10:26:12 -04:00
667cae15df support for _meta retrieval 2015-07-23 15:18:58 +01:00
5d51f3abda Merge pull request #11704 from sheldonh/env-setup-preserve-oldpwd
Preserve OLDPWD in hacking/env-setup
2015-07-23 07:40:35 -04:00
c800a1c68a Preserve OLDPWD 2015-07-23 11:24:30 +02:00
b06353791c Don't pass mode from synchronize action plugin to the ansible module
Fixes https://github.com/ansible/ansible-modules-core/issues/1783
2015-07-23 00:42:27 -07:00
15669d98ca correct ansible-playbook man1 2015-07-23 08:39:01 +01:00
b678b9828c simplified and normalized lookup search path behaviour 2015-07-22 22:32:37 -04:00
857f584ebf Merge pull request #11699 from ahamilton55/ah/delegate_variable
v2: Fixing delegate_to when using a variable
2015-07-22 22:15:54 -04:00
b9050ecf18 fixed file lookup pathing in dwim functinos, now does specific paths and priorities and is commented
fixes #11672 as cwd is now not part of thos paths:
if full path is supplied, used that
2015-07-22 20:58:24 -04:00
7254b22bf4 Fixing delegate_to when using a variable 2015-07-22 17:12:00 -07:00
d412bc72ef Fall back to paramiko if the smart detection fails to run ssh
Fixes #11695
2015-07-22 16:14:17 -04:00
dfcf6a2016 Skip hosts with no state while iterating tasks in the linear strategy
Fixes #11693
2015-07-22 15:55:11 -04:00
206ef27268 Add flag to template() so data is not converted to a datastructure
Fixes #11641
2015-07-22 15:05:51 -04:00
7a9916422a Fixing up error handling for fetch_file ops in connection plugins
* enable batch mode (configurable with a config option, on by default)
  for sftp transfers, so we can catch errors more easily
* general cleanup in the local connection plugin and fetch action plugin

Fixes #11612
2015-07-22 14:25:47 -04:00
993ce592b1 Update unit tests for flush_handlers fix 2015-07-22 11:30:05 -04:00
4b6525fb58 Fix handler flushing to match how v1 worked
Also adds meta tasks to the list of tasks excluded from tag filtering

Fixes #11574
2015-07-22 11:21:38 -04:00
d0dcf73716 Update module refs 2015-07-22 07:24:13 -07:00
135404738e Fix a couple start-at-task issues
* added pattern matching to match v1 functionality
* check the task name, not the task+role name for matches
* make sure the input is unicode

Fixes #11692
2015-07-22 07:45:03 -04:00
975172c1ef Make sure role name doesn't end up in task name more than once
Fixes #11691
2015-07-22 07:28:25 -04:00
4693531851 update ansible man1 2015-07-22 09:56:50 +01:00
b09f1f8e0b Account for filters in bare variable conversion
Fixes #11530
2015-07-22 00:08:55 -04:00
ae54792a35 Merge pull request #11688 from amenonsen/8935-rebase
8935 rebase: add «-o outputfile» and -n(oexec) options to hacking/test-module
2015-07-21 21:31:39 -04:00
d3fe9b3194 Merge pull request #11084 from echiu64/devel
More complex example of using test-module
2015-07-21 21:29:25 -04:00
8342cc6b61 Fix existing typo, remove trailing space added by PR commit 2015-07-22 06:53:59 +05:30
b05485d4b3 Add options to control output and execution of test-module
test-module is useful but sometimes you want to edit the
result before running it to e.g. set a debug point.

Added a noexecute option (i.e. just create the module script, don't
run it) and an output option to choose the filename of the result.
2015-07-22 06:50:37 +05:30
8729543cee Merge pull request #11687 from jeffwidman/patch-1
Remove mention of 'apache example'
2015-07-21 21:06:12 -04:00
52716c4dc7 Remove mention of 'apache example'
Removed explicit mention of 'apache'
2015-07-21 18:03:55 -07:00
f2fcc39513 Merge pull request #11686 from ZviRackover/patch-1
Fix: add missing import 'locale'
2015-07-21 18:12:53 -04:00
628925a77d Fix: add missing import 'locale' 2015-07-22 01:09:31 +03:00
048cd755d9 Merge pull request #11683 from dirn/patch-1
Fix formatting of Groups of Groups
2015-07-21 15:38:15 -04:00
4c733fe4b7 Fix issues with vars_prompt and vars_files
* Prompt had to be moved up, as it needed to be done before the first
  templating of the play occurs, otherwise vars_files won't be templated
  properly
* Fixed a bug related to an earlier fix of vars_files incorporating
  extra vars to do the templating of the file name

Fixes #11404
2015-07-21 14:52:57 -04:00
02589ffbba Fix formatting of Groups of Groups
The example in the Groups of Groups section was being rendered as a quote.
Switching to the `::` notation causes it to render as preformatted text instead.
This could have also been done with a `.. code:` block, but I chose to be
consistent with other sections in the document.
2015-07-21 14:44:49 -04:00
491a4f2a25 Update extras module pointer for docs fix 2015-07-21 11:21:58 -07:00
47a22af6c9 added profitbricks cloud module 2015-07-21 14:04:06 -04:00
adf1d4d9b9 Submodule pointer update 2015-07-21 14:03:27 -04:00
4713e58b57 modify intro inventory params docs to be shorter, ansible_su/do is moved out 2015-07-21 20:02:05 +02:00
66a8864ae9 Fix environment setting and inheritence
Fixes #11401
2015-07-21 13:57:30 -04:00
29a9b8ab7d dont check vagrant inventory script for 2.6 2015-07-21 13:44:45 -04:00
152c93fd54 Merge pull request #11678 from hostmaster/vagrant-inventory-refactor
Feature Pull Request: vagrant inventory, bugfixing and refactoring
2015-07-21 13:40:18 -04:00
91519d1696 Don't filter include tasks based on tags
Fixes #11320
2015-07-21 12:37:22 -04:00
46f74a0d69 Re-adding --start-at-task test to unicode integration test 2015-07-21 12:36:41 -04:00
e64989beb4 Moving ConnectionInformation -> PlayContext
Also making PlayContext a child class of the Playbook Base class,
which gives it access to all of the FieldAttribute code to ensure
field values are correctly typed after post_validation

Fixes #11381
2015-07-21 12:13:50 -04:00
919aaa5c42 Merge pull request #9853 from axos88/patch-1
Make issue rypes as an enumeration
2015-07-21 10:56:43 -04:00
8113409d34 Refactored.
Paramiko module is used to parse ssh_config.
Added multi-vm support
Added "_meta" element https://docs.ansible.com/ansible/developing_inventory.html#tuning-the-external-inventory-script
2015-07-21 17:55:25 +03:00
827b0443c8 now dataloader checkis that you get at least a valid string as a file name 2015-07-21 08:47:13 -04:00
f7c9b5382d Fix intro_inventory documented params. Update for the new 'become' system 2015-07-21 13:47:03 +02:00
7124504ccf Incorporate extra vars when templating vars_files
Fixes #11377
2015-07-21 02:10:26 -04:00
b8b206005c Generalize extra variable parsing and loading
Fixes #11352
2015-07-21 00:18:35 -04:00
d8b62f3b34 Merge pull request #9923 from bob-smith/docformatting
Correct URL to github so links work when testing locally
2015-07-20 23:15:40 -04:00
db459fd3b3 Merge pull request #9930 from bob-smith/patch-1
Fix some mistakes in CHANELOG.md
2015-07-20 23:13:57 -04:00
84cc5f9afb Merge pull request #9961 from volanja/replace_running_to_started
to replace `running` with `started`
2015-07-20 23:13:29 -04:00
7cf33df0df Merge pull request #10861 from dfarrell07/minor_docfix
Correct minor grammar error in Playbook intro docs
2015-07-20 22:31:50 -04:00
c40541964b Merge pull request #11637 from bcoca/moar_docs
Moar docs
2015-07-20 22:31:34 -04:00
740f15cb0d just remove version_added when to old, not the whole option! 2015-07-20 22:31:20 -04:00
11be1ff2d4 Merge branch 'pilou--test_notify_with_loops' into devel 2015-07-20 21:10:21 -04:00
b09eed3353 Merge branch 'test_notify_with_loops' of https://github.com/pilou-/ansible into pilou--test_notify_with_loops 2015-07-20 21:09:34 -04:00
5b5ba35111 Merge pull request #11631 from bearstech/gce
GCE tag prefix for creating ansible group.
2015-07-20 19:58:29 -04:00
fadd8f23f1 Fix broken strategy unit test from earlier change 2015-07-20 15:47:29 -04:00
3e79bfa2d6 only set ansible_ssh_host if not already set 2015-07-20 15:43:55 -04:00
3de6f264dd Fix bug where spaces in the $HOME directory broke things
Fixes #11332
2015-07-20 15:40:49 -04:00
91a4b866b0 Fix ssh pipelining 2015-07-20 15:40:49 -04:00
ddec06ccfe Detect the old python-json library
Fixes #11654
2015-07-20 12:35:26 -07:00
5347db2952 Also check the play basedir for the role
Fixes #11328
2015-07-20 14:47:38 -04:00
dca36c1d16 Reestablishing the use of tags/when for role duplication detection
Not figuring these in can cause problems with "diamond" pattern relationships,
even though this is still not quite optimal.
2015-07-20 14:37:20 -04:00
a0a6d12b05 Merge pull request #11603 from ansible/get_url-tls-compat
Have openssl autonegotiate tls protocol on python < 2.7.9
2015-07-20 09:43:59 -07:00
9b1babdaec fixed typo 2015-07-20 12:31:35 -04:00
cc6ba4b459 fixed spelling 2015-07-20 12:30:15 -04:00
f8ca978020 fixed extra hashmark 2015-07-20 12:29:18 -04:00
e9400e9ba5 added commented out callback options 2015-07-20 12:27:51 -04:00
6bff315ed8 Merge pull request #11656 from MiguelMoll/small-grammar-fix
Update intro_configuration.rst
2015-07-20 10:39:41 -04:00
03d7c8d7ca fixed new HPUX networking facts 2015-07-20 10:27:04 -04:00
80eb7a20ca Merge pull request #11469 from pilou-/local_variable
Fix pyflakes error: use 'msg' variable
2015-07-20 10:25:58 -04:00
076ea66815 Update intro_configuration.rst
Removed a small grammar redundancy.
2015-07-20 10:22:45 -04:00
91f2acb029 Merge pull request #10203 from pdelared/devel
Add HP-UX network facts
2015-07-20 10:16:31 -04:00
e70e520e60 added cic_publicip to changelog 2015-07-20 10:04:14 -04:00
39d9ee9f3d added cs_staticnat to changelog 2015-07-20 09:58:31 -04:00
bb1a907823 added version added for regex_replace
fixes #8994
2015-07-20 08:59:09 -04:00
aa23ea8462 tests: checks that handlers work with loops 2015-07-20 14:41:03 +02:00
8c392a94b7 Play.get_name: remove prefix, return name only 2015-07-20 12:41:39 +02:00
fda8fa77ab Fix pyflakes error: use 'msg' variable
Error was: local variable 'msg' is assigned to but never used
2015-07-20 12:41:39 +02:00
a09ce4bd87 added callback that skipts 'skipped' 2015-07-19 23:55:39 -04:00
171c95672e fixed gathering expression as it was triggering when gather_facts was no 2015-07-19 23:16:54 -04:00
cddd2b2392 fixed typo 2015-07-19 22:35:49 -04:00
f66ba92745 now vault prompts for password if no password file was given, as in 1.x 2015-07-19 22:24:20 -04:00
a8ba9cac3f fixed ansible pull bad options ref, removed print in favor of display 2015-07-19 18:28:03 -04:00
f8905013cd now executes fact search when needed 2015-07-19 18:00:27 -04:00
c0bcbf3b88 more changes from feedback 2015-07-19 17:33:26 -04:00
8b896c9754 Merge pull request #11648 from tamsky/docfix/issue-4943
Explain uniqueness requrement for handler task names.
2015-07-19 17:30:14 -04:00
0208a2cb30 updated as per feedback 2015-07-19 17:27:13 -04:00
2724adf18e Explain uniqueness requrement for handler task names. 2015-07-18 23:36:01 -07:00
2c98b271c8 Make paramiko password detection logic match ssh connection 2015-07-19 02:23:53 -04:00
3d77723e3d Cleaning up some stuff related to the connection info/become/executable change 2015-07-19 01:12:23 -04:00
1c185b68be Rearranging some become stuff in relation to action/connection plugins
Moving the make_sudo_cmd() calls back up to the action level so that connection
plugins don't have to know about it at all, and moving some of the become data
(prompt and success_key) into the ConnectionInformation object so they don't
need to be passed around needlessly.
2015-07-19 01:12:23 -04:00
7a9b5b6fe8 Remove unnecessary make_become_cmd from paramiko exec_command
Fixes #11611
2015-07-19 00:08:09 -04:00
c80d8f9f5b added s3_logging to changelog 2015-07-18 23:50:25 -04:00
9dc5607730 Merge pull request #11519 from bcoca/human_readable
new human_readable filter to transform bits and bytes into cake
2015-07-18 23:10:53 -04:00
115dce028d Merge pull request #11604 from bcoca/faf_deprecated_fixes
fixed first_available_found for template
2015-07-18 23:09:47 -04:00
493c2e48ac Merge pull request #11072 from bcoca/winmod_checklist
added windows module checklist
2015-07-18 23:09:03 -04:00
4f98fac494 Merge pull request #10914 from bcoca/non_posix_file_copy_fix
hack to prevent tempalte/copy errors on vagrant synced folders
2015-07-18 23:08:08 -04:00
9de086d16d removed merges from count 2015-07-18 22:49:50 -04:00
4455c14b90 Merge pull request #11644 from indrajitr/detect-homebrew
Add homebrew to package managers' list
2015-07-18 22:38:52 -04:00
4553a41ab5 Add homebrew to package managers' list 2015-07-18 19:46:26 -05:00
173f27531c moar docs
added docs for new v2 features
restructures modules bar and core/extras info into their own pages
changed templates to refer to the new pages
added some missing ansible.cfg options
more info on gathering setting
2015-07-17 22:53:11 -04:00
2bc9004618 Merge pull request #11634 from jlmitch5/update-docs-styling
Update docs styling
2015-07-17 21:59:29 -04:00
e49d8b9582 actually remove google remarketing code instead of commenting out 2015-07-17 18:53:57 -04:00
69fbd0472f update styling and add documentation nav bar 2015-07-17 18:11:20 -04:00
36c9eeced5 comment out docs remarketing code because it adds a weird black bar 2015-07-17 17:41:57 -04:00
1873e8ed08 GCE tag prefix for creating ansible group. 2015-07-17 22:28:30 +02:00
271a7f3281 Cleaning up some of the notify/facts logic added earlier to fix problems 2015-07-17 14:44:19 -04:00
1aa4155266 generalized warning handling, added it to adhoc also 2015-07-17 14:14:15 -04:00
d4ac73a1bc Adding back capability to display warnings contained in results
Fixes #11255
2015-07-17 13:44:22 -04:00
5abdd3b821 Handle notifications when coupled with a loop
Fixes #11606
2015-07-17 12:03:04 -04:00
319812542f Merge pull request #11628 from srvg/bug/11624
fix AnsibleError object name in subelements plugin
2015-07-17 11:54:57 -04:00
8d1549900c fix AnsibleError object name in subelements plugin
fixes #11624
2015-07-17 17:39:31 +02:00
bc5a7fce79 Merge pull request #11616 from halberom/ssh_port
fixes 11607, override ansible_ssh_port in group/host_vars
2015-07-17 11:21:17 -04:00
bb7f310e35 Merge pull request #11626 from halberom/fix_profile_tasks
profile_tasks.py requires CALLBACK_ constants or the v2 code doesn't pass the …
2015-07-17 10:44:30 -04:00
a6c8d30f3e callbacks require a version constant or the v2 code doesn't pass the display param and it gives an error 2015-07-17 15:33:48 +01:00
6ba706f753 minor doc reformatting
now version_added < 1.3 does not get shown, up from 1.0
option's version_added is also now filterd against this threshold
module version_added is more prominent
exaples now uses pure rst instead of intermingled with html formatting
aliases now shown in description for options
bad version fields now throw warnings instead of exceptions
ansible-doc errors now show traceback in very very verbose mode, for easier debugging
2015-07-17 10:07:22 -04:00
8df71febb7 added missing win_unzip to changelog 2015-07-17 10:07:22 -04:00
a91eee358c fixed title underline length 2015-07-17 10:07:22 -04:00
811b10d132 docs will not mention versions older than 1.5 2015-07-17 10:07:22 -04:00
1aeb66148b actually now does what it says as it was just sorting by name 2015-07-17 10:07:22 -04:00
da890f9328 Merge pull request #11622 from amenonsen/gathering
devel breaks «gathering=explicit» setting in ansible.cfg
2015-07-17 09:04:23 -04:00
7649603785 Merge pull request #11623 from halberom/test-module
hacking/test-module updated to use new loader
2015-07-17 09:02:16 -04:00
a09f6236a5 adapated to v2 2015-07-17 08:55:22 -04:00
10e5c2b46d fixed var scope 2015-07-17 08:54:28 -04:00
080ee1e96c Merge pull request #11625 from aioue/add-profile-tasks-plugin
Add plugin that profiles playbook tasks
2015-07-17 08:44:52 -04:00
097ed1f17b Add plugin that profiles playbook tasks
Resubmission of https://github.com/ansible/ansible/pull/11270 to
correct v2 file location.

[Description and console output
demonstration](https://github.com/aioue/ansible-plugin-profile/blob/mast
er/README.md#features).

Provides per-task timing, ongoing playbook elapsed time and ordered
list of top 20 longest running tasks at end.
2015-07-17 13:04:31 +01:00
2f51f3bbc5 updated to use new loader 2015-07-17 11:44:00 +01:00
28e2eae902 Make gathering=explicit work again
There was a confusion between the valid values for defaults.gathering
(explicit/implicit/smart) and a play's gather_facts setting (boolean),
which resulted in gathering=explicit being ignored.
2015-07-17 13:05:00 +05:30
d70c88bf8c added /os_nova_flavor to changelog 2015-07-16 19:08:13 -04:00
95bf78d0e7 Merge pull request #11618 from halberom/test-module
hacking/test-module, updated to new location and non-classness of module_common
2015-07-16 19:01:35 -04:00
3c7a502c50 updated to new location and non-classness of module_common 2015-07-16 23:56:18 +01:00
f146c7680f Merge pull request #10928 from gimoh/test-module-default-python
Use same interpreter for test-module and module it runs
2015-07-16 18:48:00 -04:00
d23ab261e1 fixes 11607, allows ansible_ssh_port to be overridden from group or host_vars 2015-07-16 23:00:17 +01:00
888bda93c1 added elasticsearch_plugin to changelog 2015-07-16 16:51:26 -04:00
978390693b changed to default 'auto' as it better describes the use= option 2015-07-16 16:45:04 -04:00
d2f93511df Merge pull request #11615 from j-carl/fix-vmware-user-dir
vmware.py: Fix to handle user directory correctly (e.g. ~/.ansible/tmp).
2015-07-16 16:09:15 -04:00
db4f6b8878 Fix to handle user directory correctly (e.g. ~/.ansible/tmp). 2015-07-16 19:56:21 +00:00
94fa741f96 Make sure files loaded by template action are decoded properly
Fixes #11247
2015-07-16 15:23:40 -04:00
5ba9fe4748 now supports maintainers and author field for display as MAINTAINERS 2015-07-16 15:18:33 -04:00
c603caca27 removed extra print now that items are getting passed to callback in result 2015-07-16 15:13:35 -04:00
86a83c16b8 Remove some dead code from the base load_data method
Was causing an odd error which threw off the error detection code
when the datastructure was a string corresponding to a variable.
2015-07-16 15:10:41 -04:00
d977dd507c Merge pull request #11609 from ofpiyush/devel
Fix #11369 A result is skipped when all it's children are skipped. Th…
2015-07-16 11:45:04 -04:00
052f3c2ece Fixing allow_duplicate and variable resolution bugs
Fixes #11205
2015-07-16 11:39:40 -04:00
f2bdd9af29 Fix #11369 A result is skipped when all it's children are skipped. This makes it fundamentally different from a result that was changed/failed/unreachable 2015-07-16 17:50:15 +05:30
5a5b7ff561 fixed first_available_found for template, refactored into common function
added deprecation warning
fixed display.deprecated to make version optional (code already assumed this)
turned warning + 'deprecated' in plugin loader into actual call to deprecated()
2015-07-15 19:47:59 -04:00
6ea772931f Connection function for boto3
Boto3 conn
2015-07-15 16:52:01 -04:00
3d3e1c82a2 Have openssl autonegotiate tls protocol on python < 2.7.9
This allows usage of tls-1.1 and tls-1.2 if the underlying openssl
library supports it.  Unfortunately it also allows sslv2 and sslv3 if
the server is only configured to support those.  In this day and age,
that's probably something that the server administrator should fix
anyhow.
2015-07-15 13:17:00 -07:00
ba7243c5f9 Don't set changed for include tasks
Fixes #11197
2015-07-15 15:11:46 -04:00
291f07242c Properly return Jinja2 Undefined class for bad hostvars lookups
Fixes #11176
2015-07-15 14:36:42 -04:00
9fe0f21f6a Allow omit to be used on Playbook-level fields
Fixes #11173
2015-07-15 13:53:59 -04:00
d6b058eaae Removing invocation from async test, as it's pointless 2015-07-15 12:03:02 -04:00
165fff8a1e Fixing module arg parsing splitting when action is a variable
Fixes #11122
2015-07-15 12:03:02 -04:00
780e428bd3 fixed typos 2015-07-15 11:55:26 -04:00
b76cb8f655 now that invocation is only async again, no need to sanitize 2015-07-15 10:40:37 -04:00
2d870b7112 Fix logic where invocation details are added to results 2015-07-15 10:20:55 -04:00
0b035a4e35 Unicode in result debug statements caused a traceback 2015-07-15 01:56:28 -04:00
ae6d9ebf28 added maintainers (from author field) to ansible-doc 2015-07-14 17:33:27 -04:00
fbec8bfb90 updated ref to add docfixes 2015-07-14 17:03:57 -04:00
0e1d771a33 updated submodule refs 2015-07-14 16:47:47 -04:00
323362e23a added stdout to test result 2015-07-14 15:59:18 -04:00
3e293f524a Merge pull request #11589 from ansible/get_url-sni-tls-fix
Add support for SNI and TLS-1.1 and TLS-1.2 to the fetch_url() helper
2015-07-14 12:49:37 -07:00
327b1676a8 Add support for SNI and TLS-1.1 and TLS-1.2 to the fetch_url() helper
Fixes #1716
Fixes #1695
2015-07-14 12:48:35 -07:00
8d887d8dd3 Adding back --start-at-task feature
Also implemented framework for --step, though it's not used yet
2015-07-14 15:02:20 -04:00
f6c64a8c00 fixed var file loading 2015-07-14 12:12:43 -04:00
5eb25a48ee added empty include test 2015-07-14 12:06:31 -04:00
22165dd046 fixed bad parsing tests 2015-07-14 12:06:31 -04:00
3b913943b2 Updating base strategy unit test regarding bad file loads based on earlier change 2015-07-14 11:09:22 -04:00
3c7faa8378 fixed missing self in self.action on rekey in vault
fixes #11584
2015-07-14 10:10:03 -04:00
42e355f9a3 fragments can now be a list 2015-07-14 10:07:59 -04:00
ea159ef9de fixed backup and validate fragments 2015-07-14 10:07:59 -04:00
4e94bb64d8 Fix group/host var loading relative to playbook basedir 2015-07-14 09:26:24 -04:00
7dd5600839 Allow empty include files again
Fixes #11582
2015-07-14 08:26:11 -04:00
44aef347cb enabled good parsing tests in parsing target
fixed test_good_parsing role
added raw duplicate parameters to test_good_parsing
2015-07-14 08:05:57 -04:00
8793308c39 made md5 into generic checksum function that uses sha now 2015-07-14 07:28:32 -04:00
6376dda5c7 clarified v1/ purpose and relationships with tags and branches 2015-07-14 07:12:40 -04:00
6971e92f39 Fixing up some output stuff 2015-07-14 00:23:17 -04:00
7092021d81 simplify variable names 2015-07-13 23:51:23 -04:00
17b94cf139 generalize error context reporting, add elasticache explanations 2015-07-13 23:46:33 -04:00
610223fbf4 explain source of EC2 inventory error
https://github.com/ansible/ansible/issues/10840
before
RDS: `ERROR: Inventory script (ec2.py) had an execution error: Forbidden`
EC2: `ERROR: Inventory script (ec2.py) had an execution error: Error connecting to AWS backend.
You are not authorized to perform this operation.`
after
RDS: `ERROR: Inventory script (ec2.py) had an execution error: ERROR: "Forbidden", while: getting RDS instances`
EC2: `ERROR: Inventory script (ec2.py) had an execution error: ERROR: "Error connecting to AWS backend.
You are not authorized to perform this operation.", while: getting EC2 instances`
2015-07-13 23:23:54 -04:00
9a586c3512 Properly catch AnsibleError and not all errors 2015-07-13 20:49:11 -04:00
2b723c6130 added missing re import 2015-07-13 20:42:09 -04:00
3102469b94 fixing become success string 2015-07-13 20:40:40 -04:00
73eca8239b added sts_assume_role 2015-07-13 19:30:38 -04:00
a09f44210e now callback errors are not silent but warnings 2015-07-13 19:23:27 -04:00
e0632cb9a4 Merge pull request #11577 from srvg/yaml_file_extensions
Use YAML_FILENAME_EXTENSIONS for vars files.
2015-07-13 18:29:26 -04:00
5daa540bc0 Merge pull request #11576 from srvg/combine_empty_vars_file
Do not combine group_vars with an empty file
2015-07-13 18:26:02 -04:00
d5fb11d89c Use YAML_FILENAME_EXTENSIONS for vars files.
The v2 codebase didn't use this previously introduced constant yet.

C.YAML_FILENAME_EXTENSIONS
2015-07-14 00:23:35 +02:00
9c8f0da327 Do not combine group_vars with an empty file
This addresses a specific case with multiple vars files
in a group_vars/${groupname}/ directory where one of those files
is empty, which returns None instead of an empty dict.
2015-07-14 00:14:13 +02:00
24b830bbc8 fixed executable for raw module 2015-07-13 16:23:14 -04:00
c4b6d91275 added skipped to oneline 2015-07-13 15:54:12 -04:00
373830b5df Fix removal of .git from modules directories
Also changed the setup.py maintainers email to our default support one.

Fixes #11051
2015-07-13 15:46:09 -04:00
8ad52c2e4f readded oneline output feature to adhoc
fixes #11573
2015-07-13 15:43:31 -04:00
3a768b3b9f removed unused methods, these now live in base class 2015-07-13 15:43:31 -04:00
c18fdd0c18 Re-implement "conditional imports" for vars_files 2015-07-13 15:18:23 -04:00
1255a0708a Merge pull request #11570 from objectified/docfix_plugins_links
fixed Github links to plugin sources
2015-07-13 11:21:59 -04:00
b6b74746d9 fixed Github links to plugin sources 2015-07-13 17:17:05 +02:00
d977da5b41 Fixing up fact_cache use in VariableManager 2015-07-13 11:06:03 -04:00
932d1e57f7 Removing stray debugging print 2015-07-13 10:56:09 -04:00
91c9bb96e3 Moving jsonfile cache plugin over and fixing #10883
Fixes #10883
2015-07-13 10:42:10 -04:00
d8abae71a4 now assemble skips during checkmode
TODO: actually make it check with checkmode
fixes http://github.com/ansible/ansible-modules-core/issues/661
2015-07-13 10:34:44 -04:00
587a6cb44c Remove v1 code 2015-07-13 15:48:23 +02:00
6e99023c84 Changed to support Ansible v2 2015-07-13 15:37:27 +02:00
962f681bde added readme to v1 2015-07-13 09:23:26 -04:00
8efc42d993 Add shelvefile lookup plugin 2015-07-13 10:31:35 +02:00
f40b66d841 Make sure the basedir is unicode
Fixes #10773
2015-07-12 16:40:00 -04:00
ba92965670 fix for when invocation data is missing 2015-07-12 16:10:52 -04:00
c5c1dc2f11 Removing tags/when from role param hash calculation 2015-07-11 21:49:35 -04:00
e0a5003b27 ability to specify any combination of EC2 instance states to return 2015-07-11 20:53:05 -04:00
4203b699a8 removed dict comprehension as 2.6 does not like 2015-07-11 15:15:46 -04:00
032690a843 fix read_vault_password_file ref 2015-07-11 15:05:32 -04:00
d993e7000c added cyan back to ignoring message 2015-07-11 15:01:50 -04:00
064a34689a now actually continues play on ignore errors 2015-07-11 14:53:23 -04:00
fe91f7b506 moved read_vault_file to CLI from utils and renamed to clearer read_vault_password_file 2015-07-11 14:24:45 -04:00
e4097ed279 simplified ansible errors, moved md5 hash import with notes to be more prominent 2015-07-11 14:24:00 -04:00
698b277601 changed github and galaxy to always be https
fixes #9925
2015-07-11 11:33:28 -04:00
1274ce565d added result sanitation to registered var and to callbacks
removed time display as it only is provided by command module
2015-07-11 01:05:29 -04:00
fdea00880b now default shows time taken when -vv or above 2015-07-11 00:02:40 -04:00
7a1bce1b5d added verbose option to show callback loaded info
also made mail module print nicer without all those 'u'
2015-07-10 23:48:12 -04:00
4b9a79d42b removed trailing newline
fix from #10973 by @retr0h
2015-07-10 22:12:46 -04:00
ce4f7fcb69 Merge pull request #11557 from jotes/patch-1
Misspell in mail.py callback.
2015-07-10 20:56:31 -04:00
705018a417 Misspell in mail.py callback.
Looks like little misspell.
2015-07-11 02:53:32 +02:00
e9a3a2912d Merge pull request #9281 from woltage/devel
Enables 'force basic auth' -feature globally
2015-07-10 18:20:52 -04:00
493d91cb55 Merge pull request #11531 from tamsky/tamsky-document-jsonfile
document `jsonfile` fact cache
2015-07-10 18:14:59 -04:00
b4de103bb2 Merge pull request #11555 from cchurch/test_win_get_url_updates
Update tests for win_get_url module to test force parameter
2015-07-10 17:07:20 -04:00
1aa2191fd5 Update tests for win_get_url module to test force parameter and invalid URLs/paths. 2015-07-10 15:54:18 -04:00
c6dde19a5e Merge pull request #11537 from chrismeyersfsu/azure-test
assert password or ssh key provided on new image creation
2015-07-10 13:57:15 -04:00
4608897c27 Submodule update 2015-07-10 13:55:44 -04:00
9c5a6d7b5a fixed all references to old plugins/inventory to point at contrib/inventory 2015-07-10 13:00:12 -04:00
8ef734a18c Merge pull request #11552 from cgar/spelling
minor spelling changes
2015-07-10 12:48:48 -04:00
657495d13f minor spelling changes 2015-07-10 12:42:59 -04:00
7c73e9c12e Mock 1.1.0 lost python2.6 compatibility 2015-07-10 09:11:03 -07:00
5430169b77 Cleaning up includes test to match 2.0 behavior
* Perhaps the only precedence change, in 2.0+ variables from set_fact
  will not override params to an include file, as params are expected
  to be more specific than host-based variables.
* Uncommented long-form include example.
2015-07-10 11:22:51 -04:00
d81ea397aa Merge pull request #11533 from bcoca/cb_and_contrib
Cb and contrib
2015-07-10 10:37:58 -04:00
ebeb0b0348 removed plugins dir that was removed 2015-07-10 10:30:52 -04:00
42357f7f2a moved contrib into manifest from setup.py 2015-07-10 10:30:33 -04:00
aaad33ccb6 fixed a couple of bugs 2015-07-10 10:30:33 -04:00
0bbf5927be added executabel bit to nova and rax inventory plugins 2015-07-10 10:30:33 -04:00
d0c6d2ff1c poreted log_plays, syslog_json and osx_say callbacks to v2
renamed plugins to contrib (they are not really plugins)
rewrote README.md to reflect new usage
added new dir to setup.py so it gets copied with installation, in views
of making using inventory scripts easier in teh future
2015-07-10 10:30:33 -04:00
50d54b1be7 ported hipchat callback to v2 (needs testing) 2015-07-10 10:30:33 -04:00
e92e15b5f6 moved unused functions to base object 2015-07-10 10:30:33 -04:00
b47d7babe5 removed warning i was using for debug 2015-07-10 10:30:33 -04:00
834b7a2857 ported context_demo to v2 callbacks 2015-07-10 10:30:33 -04:00
ba0e5323d6 removed connection info to _verbosity, just needed callbacks to call correct display.verbosity
added v2 methods and made them call v1 when possible by tranforming the data
2015-07-10 10:30:33 -04:00
a918a1bd16 now calls correct v2_on_any callback method 2015-07-10 10:30:33 -04:00
f9d817e636 now looks at correct verbosity and removes the need to set a copy of it in _verbosity 2015-07-10 10:30:33 -04:00
aaf59319e4 document jsonfile and provide example config 2015-07-09 23:33:31 -10:00
1163e38d39 Fix unit tests for new magic variable addition 'ansible_version' 2015-07-10 03:33:11 -04:00
cf2a66ef30 Add ansible_version magic variable
Fixes #11545
2015-07-10 03:22:37 -04:00
b0e6baf8c3 Fix bug where options may not have the force_handlers value from the cli 2015-07-10 03:19:48 -04:00
bbe8f48a46 Update role unit tests for changes made to require a play during loading 2015-07-10 02:50:33 -04:00
f8ddf2eb04 Move role cache into the play to avoid roles crossing play boundaries 2015-07-10 02:43:53 -04:00
b520d5bc60 Lots of fixes for integration test bugs 2015-07-10 01:53:59 -04:00
4e7542af37 Merge upstream changes 2015-07-10 08:44:20 +03:00
403f4881ee Enables 'basic auth force' -feature globally 2015-07-09 23:11:52 +03:00
32685f9648 assert password or ssh key provided on new image creation 2015-07-09 13:44:09 -04:00
a9712bb0fb Fixing some delegate_to bugs
* Moving connection creation until after the task is post_validated,
  to make sure all fields are properly templated (#11230)
* Fixing problems related to the connection method and remote address
  lookup on the delegated-to host

Fixes #11230
2015-07-09 08:25:08 -04:00
3ba67dd2d0 added ignore_hidden to assemble 2015-07-09 00:27:29 -04:00
b5f3e84014 now allows for empty vars sections, returns empty dict
fixes #11532
2015-07-08 22:45:01 -04:00
55366bdc6d ported mail callback plugin to work with v2 2015-07-08 16:33:51 -04:00
897e098b27 minor fixes to constants 2015-07-08 16:33:51 -04:00
dd058a1dc2 Fix required_if (needed to pass list to _count_terms) 2015-07-08 09:45:02 -07:00
27fcf1a4b5 Fix bug in registered variables related to delegate_to changes 2015-07-08 12:38:24 -04:00
f5baad4fb2 Removing unicode --start-at-task test for now as we haven't added that back into devel 2015-07-08 12:23:42 -04:00
64a1b1e043 Fix first_available_file: support for copy and template actions 2015-07-08 12:23:42 -04:00
ddac6fa9f3 Update exception handling to be python3 compat 2015-07-08 08:59:42 -07:00
df09691a38 Merge pull request #11527 from marconius/adds_tests_for_taggable
Added tests for `taggable` module
2015-07-08 10:51:10 -04:00
79394f5c8f Added tests for taggable module 2015-07-08 10:22:33 -04:00
44d302ee66 for ansibot compensation 2015-07-08 10:12:08 -04:00
8f0496d7ce Fix usage of set_host_var when registering a result var
Fixes #11521
2015-07-08 09:15:55 -04:00
2e5dfd57cc Clear flag indicating role had run before each play is run
Fixes #11514
2015-07-07 21:47:48 -04:00
48827a31bc added minimal testing for special template vars 2015-07-07 20:11:55 -04:00
ec145a61af added os_floating_ip module and deprecated quantum_open_ip in changelog 2015-07-07 20:11:55 -04:00
a02555ad91 Merge pull request #11483 from pilou-/jinja2_header_overrides
implement jinja2 header overrides
2015-07-07 18:02:00 -04:00
2962047b43 ported 1.9.2 changelog into devel 2015-07-07 17:55:35 -04:00
aa095df19c Merge pull request #11511 from galindro/syslog_json_improvement
syslog_json call plugin improvements
2015-07-07 17:49:28 -04:00
f67949e42c Readd logic for ansible_managed to template action plugin
Fixes #11317
2015-07-07 16:48:19 -04:00
bfbb88b4a9 Fix strategy plugin unit tests related to earlier changes 2015-07-07 16:26:24 -04:00
da307c8bfd Fix bug in logic introduced in 614c626 2015-07-07 16:09:36 -04:00
293dd38d05 Correctly handle assigning results to the delegated to host 2015-07-07 16:09:36 -04:00
688088547b new human_readable filter to transform bits and bytes into cake (not really) 2015-07-07 15:58:18 -04:00
49a148056c Ensure that we're dealing with byte str when we print or log messages 2015-07-07 12:05:59 -07:00
6d50a261c5 Allow full exception tracebacks to be displayed with increased verbosity 2015-07-07 14:31:15 -04:00
614c626ed0 Fix no hosts remaining logic in linear strategy 2015-07-07 14:20:07 -04:00
135fa41e3a Update submodules refs 2015-07-07 10:54:36 -07:00
898c7cc09f Merge pull request #11515 from msabramo/nicer_output_for_parser_errors
Don't wrap text for AnsibleParserError
2015-07-07 13:00:41 -04:00
08fcd82331 added os_security_group_rule to changelog 2015-07-07 12:39:11 -04:00
314bae2a9e Don't wrap text for AnsibleParserError
This allows not messing up the wonderful error reporting that is
carefully created. Instead of:

    $ ansible-playbook foo.yml
     [ERROR]: ERROR! 'foo' is not a valid attribute for a Task  The error appears
    to have been in '/Users/marca/dev/git-repos/ansible/foo.yml': line 4, column 7,
    but may be elsewhere in the file depending on the exact syntax problem.  The
    offending line appears to be:    tasks:     - name: do something       ^ here

we get:

    $ ansible-playbook foo.yml
    ERROR! 'foo' is not a valid attribute for a Task

    The error appears to have been in '/Users/marca/dev/git-repos/ansible/foo.yml': line 4, column 7, but may
    be elsewhere in the file depending on the exact syntax problem.

    The offending line appears to be:

      tasks:
        - name: do something
          ^ here

which is much nicer.
2015-07-07 09:31:00 -07:00
50efeb13ba made squashable with_ plugin list configurable
partially deals with #11383
2015-07-07 11:59:20 -04:00
d198b18c14 added win_regedit module to changelog 2015-07-07 10:41:58 -04:00
38904ead49 Merge pull request #11510 from jaceklaskowski/patch-1
Update index.rst
2015-07-07 09:20:08 -04:00
908b2b8caf Merge pull request #11513 from jaceklaskowski/patch-2
Update intro_inventory.rst
2015-07-07 09:02:08 -04:00
b7f7760f39 removed unused file 2015-07-07 08:52:46 -04:00
9bf39e7875 reversed cache check condition to actually work
fixes #11505
2015-07-07 08:51:39 -04:00
796c7accd1 Update intro_inventory.rst
Minor fix for consistency (and more engaging language :))
2015-07-07 14:03:46 +02:00
156dab31e2 * Fix NameError: global name 'handler' is not defined
* Update log message format
2015-07-07 07:49:06 -03:00
2a328ab61d Update index.rst 2015-07-07 11:28:20 +02:00
8224627036 Merge pull request #11487 from mikeputnam/ansible-ansible-issue-11397
Be more specific describing groups of groups,
2015-07-07 00:04:38 -04:00
a6aedbcc51 now correctly picks up old become password host vars 2015-07-06 23:24:00 -04:00
d74cf46778 added route53_zone and some v2 features to changelog 2015-07-06 19:53:42 -04:00
8bfbe44e5b introduced non changing ansible_managed 2015-07-06 19:25:32 -04:00
49e17b8ff6 Get rid of an unused import so that we don't have circular imports 2015-07-06 14:19:13 -07:00
5b0b1f8da6 unquote strings in the ansible config file 2015-07-06 14:12:10 -07:00
f44f9569e1 Test unquote works as expected and fix two bugs:
* escaped end quote
* a single quote character
2015-07-06 13:16:42 -07:00
0cd7942155 removed uneeded quotes 2015-07-06 15:42:23 -04:00
aa6486778f fixed become test to match new expected output 2015-07-06 15:34:38 -04:00
1d8ccfb99f Fixing includes where the included file is "{{item}}" 2015-07-06 14:30:56 -04:00
46b33152c8 Check for ansible_su*_pass as well as _password
Fixes #11500
2015-07-06 13:49:25 -04:00
378c8fd549 Update submodule refs 2015-07-06 10:44:27 -07:00
29f2b549c2 Merge pull request #11497 from hugovk/patch-1
Typos
2015-07-06 09:05:11 -04:00
60ec726b37 Typos 2015-07-06 10:21:40 +03:00
2c9d1257ba put type checking before looking against choices array to always get type comparrison correctly 2015-07-05 19:55:11 -04:00
f42b6237d9 now has display of last resort
moved all display/color/err to use display.error
now also capture generic exceptions if they happen (never should!)
2015-07-05 17:46:51 -04:00
6a75125f32 now traps exceptions on display instantiation 2015-07-05 17:24:15 -04:00
22a0aa016f pbrun not forced to use local daemon anymore 2015-07-05 15:51:12 -04:00
2a0cc38922 Merge pull request #11494 from jonhadfield/add_iso8601_basic_datetime
Add facts for datetime 8601 basic and basic short.
2015-07-05 14:55:20 -04:00
90a810e2a8 docsite/rst/intro_configuration.rst: reword Title.
Make Configuration the first word, so that it is in line with other documents
and that system administrators/devops people don't lose the tab when having
many browser tabs open.
2015-07-05 19:57:41 +03:00
05be30168d return empty string when config file is not used 2015-07-05 12:51:05 -04:00
82e00b1022 add facts for datetime 8601 basic and basic short. 2015-07-05 17:23:22 +01:00
51efd765be Merge pull request #11415 from msabramo/remove_unnecessary_imports
Remove unnecessary imports
2015-07-05 01:09:28 -04:00
9155af20e3 Make sure vars in debug tasks aren't templated too early
If the syntax var={{something}} is used, that can be templated too
early in the post_validation, leading the debug module to fail when it
tries to template the same value in turn.
2015-07-05 01:06:54 -04:00
38cc54b717 Make 'vars' a copy to prevent recursion issues 2015-07-04 23:34:07 -04:00
bddadc9565 Fix bug in relative path determination 2015-07-04 23:18:54 -04:00
38c5da9d2a Revert "Backing out vars magic variable due to failed tests"
This reverts commit 388e46a485.
2015-07-04 22:48:20 -04:00
388e46a485 Backing out vars magic variable due to failed tests 2015-07-04 22:44:45 -04:00
53cd96befe Updating unit tests to account for new magic variable 'vars' 2015-07-04 21:48:54 -04:00
76c5be3a31 Add 'vars' to magic variables 2015-07-04 21:28:28 -04:00
0676157897 Remove unnecessary imports 2015-07-04 17:41:36 -07:00
552715f072 added validate and backup doc fragments 2015-07-04 17:58:23 -04:00
02aa76d518 Remove docs remnant re: var use. 2015-07-04 13:48:34 -05:00
515de1e6eb Be more specific describing groups of groups,
Fixes #11397
2015-07-04 12:30:04 -05:00
3887173c2c Use cfacter instead of facter if possible
CFacter is the facter replacement written in C++. It is available from
the puppetlabs repo.
2015-07-04 09:13:20 -07:00
5f791329ce now verbose mode shows config file used 2015-07-04 10:23:49 -04:00
67671e328a Fix callback loading issue a slightly different way 2015-07-04 00:07:17 -04:00
a51c165157 Revert "load callbacks on init again as they did not seem to load with new call from executor"
This reverts commit cf4ed9a556.
2015-07-03 23:52:59 -04:00
2ddd83360a Revert "removed 2nd load_callbacks that was causeing dupe output"
This reverts commit de98dc2968.
2015-07-03 23:52:49 -04:00
866a28ea36 Merge pull request #11484 from j-carl/patch-1
Fix typo in developing_modules.rst
2015-07-03 23:12:17 -04:00
9de6471867 Merge pull request #11449 from msabramo/make_test-module_work_in_v2
Make test module work in v2
2015-07-03 22:58:13 -04:00
3831f59094 Update developing_modules.rst
Fix typo.
2015-07-03 17:10:00 -07:00
4d35d8bd31 properly booleanify copy field 2015-07-03 18:59:49 -04:00
720e184f88 implement jinja2 header overrides 2015-07-03 22:27:49 +02:00
de98dc2968 removed 2nd load_callbacks that was causeing dupe output 2015-07-03 14:28:10 -04:00
75c7a52828 Merge pull request #11477 from msabramo/landscape_inventory_plugin
Add Landscape inventory plugin
2015-07-03 14:14:56 -04:00
dead52cf27 Merge pull request #11478 from msabramo/serf_inventory_groups
Add groups to serf inventory plugin
2015-07-03 14:12:18 -04:00
bdccfa71a8 Merge pull request #11482 from verm666/issue-1627
facts: add aliases to ansible_all_ipv4_addresses on OpenBSD
2015-07-03 13:57:10 -04:00
5122455db8 ported missing sequence updates from 1.9 2015-07-03 13:54:51 -04:00
8c29bba2b1 Merge pull request #10492 from jtyr/comment_filter
Adding comment filter
2015-07-03 13:10:24 -04:00
cf4ed9a556 load callbacks on init again as they did not seem to load with new call from executor 2015-07-03 13:01:21 -04:00
63b6dca1f3 Add Landscape inventory plugin 2015-07-03 08:33:20 -07:00
48e15ea849 Add groups to serf inventory plugin 2015-07-03 00:51:36 -07:00
139138c604 Merge pull request #11370 from halberom/doc_magic_var
added role_path to magic var section
2015-07-02 18:17:07 -04:00
9e37402cb7 added ramfs to selinux ignored filesystems
as reported in #11442
2015-07-02 17:25:05 -04:00
3b0524e67d hacking/test-module: Style nit 2015-07-02 18:59:58 +00:00
5466ff8907 hacking/test-module: Deal with move of parse_kv 2015-07-02 18:58:57 +00:00
ea6ec3bf2c Make test-module work in v2
- `jsonify` moved from `ansible.utils` to `ansible.parsing.utils.jsonify`
- I don't see `ansible.utils.parse_json` anymore so I used `json.loads`.
2015-07-02 18:16:33 +00:00
31239f44cd Show failed result on a retry message
Fixes #10099
2015-07-02 10:33:41 -04:00
f8593cc76b Adding comment filter 2015-07-02 14:37:51 +01:00
d91947ee96 facts: add aliases to ansible_all_ipv4_addresses on OpenBSD 2015-07-02 15:36:56 +03:00
f52c498aa1 Merge pull request #11410 from bhanuvrat/patch-1
grammar update to vault docs
2015-07-02 04:55:23 -07:00
08ad05c83b Make sure callbacks are loaded in the tqm a bit earlier
Fixes #11463
2015-07-02 02:51:24 -04:00
1b74102ab3 Merge pull request #11435 from hfinucane/ipwrap-generator
Treat generators like lists and tuples
2015-07-01 18:34:44 -04:00
71f72b655e Merge pull request #11432 from sivel/splitext-filter
Add splitext filter
2015-07-01 13:17:56 -07:00
9341148f04 Throw an error if with_first_found finds no files by default
Fixes #9976
2015-07-01 16:09:34 -04:00
b11e69f3d0 Merge pull request #11452 from soarpenguin/devel
fix type error.
2015-07-01 12:41:05 -07:00
13ac0ba1fe now setuptools will pull the data dir with templates that are used by galaxy init 2015-07-01 11:12:10 -04:00
08e981b9f4 corrected api permissions 2015-07-01 11:12:10 -04:00
cf51d0a790 Fixing up some check-mode stuff 2015-07-01 15:10:25 -04:00
ad53b6f36a Merge pull request #11461 from pilou-/shell_removed
Fix "AttributeError: 'ActionModule' object has no attribute '_shell'"
2015-07-01 14:35:27 -04:00
7fa37870c8 Merge pull request #9683 from justinwyer/logical-block-size-and-sectors-9549
Disk size for advanced drives over 2 TB is incorrect
2015-07-01 14:14:04 -04:00
dcb9b5a69f Make --module-path work and expand tilde's in paths
Fixes #9937
Fixes #9949
2015-07-01 12:39:39 -04:00
fffb65d45f Update submodule refs 2015-07-01 09:34:17 -07:00
2e386deeae Make undefined variables in debug var=foo more obvious
Fixes #9935
2015-07-01 11:55:00 -04:00
b6c52ce115 Allow role variables to be optionally kept in a private scope 2015-07-01 11:33:14 -04:00
4d4512940d Fix "AttributeError: 'ActionModule' object has no attribute '_shell'"
'_shell' was removed with commit 2a5fbd8570
2015-07-01 17:22:09 +02:00
a155f65a89 Disable docs checks 2015-07-01 07:24:15 -07:00
dcb06ac7a8 Merge pull request #11445 from emonty/devel
Fix a tiny typo
2015-07-01 09:34:32 -04:00
0a2a9557b8 now allows for users to use ^D to not input a password
fixes #11413
2015-07-01 05:22:49 -04:00
4fe2d7fc8d Merge pull request #11458 from bennojoy/11448
fixes 11448 , yum with with_items
2015-07-01 18:04:32 +05:30
4889d04fc6 fixes 11448 , yum with with_items 2015-07-01 10:02:54 +05:30
f9bf6ce4d0 makes it more concise.
@msabramos's suggestions[1] incorporated.

[1] https://github.com/ansible/ansible/pull/11410#issuecomment-116319780
2015-07-01 09:54:02 +05:30
c6ed1ff4ad fix type error. 2015-07-01 12:16:01 +08:00
0070e17750 full rewrite of the paragraph.
following @abadger's suggestion[1] in the comments

[1] https://github.com/ansible/ansible/pull/11410#issuecomment-116049590
2015-07-01 09:29:44 +05:30
468770c894 Merge pull request #11261 from schrodervictor/adds-elasticache-to-ec2-dynamic-inventory
Adds ElastiCache to ec2 dynamic inventory plugin
2015-06-30 16:51:11 -04:00
7c1d569a26 Make sure tags are pulled out of playbook includes properly
Fixes #9862
2015-06-30 16:09:04 -04:00
54e7c8a3f7 Add python requirement to the documentation for openstack modules requiring shade 2015-06-30 12:51:20 -07:00
4b1a14eb16 Fix title length (for docs formatting) 2015-06-30 12:51:20 -07:00
e89f1186e7 Fix a tiny typo 2015-06-30 14:46:43 -04:00
ec4d1b11df Fix some more handler issues
* Only notify handlers when the task is changed
* Don't run handlers on hosts which have failed
2015-06-30 14:44:41 -04:00
2576f480fd Restoring a state check to play_iterator, which otherwise broke block functionality 2015-06-30 13:57:47 -04:00
4c610bb15d Merge pull request #11443 from sivel/issue/11441
assertRaises should be given an exception type. Fixes 11441
2015-06-30 11:27:20 -05:00
2cd3a1be00 assertRaises should be given an exception type. Fixes 11441 2015-06-30 11:02:33 -05:00
c4fea21322 Merge pull request #11440 from sivel/issue/11430
Check for name or pkg when templating squashed items
2015-06-30 11:38:19 -04:00
65fdcf8b9d Check for name or pkg when templating squashed items. Fixes #11430 2015-06-30 10:15:25 -05:00
a75e62b6e1 Merge pull request #11439 from sivel/rax-test-yaml-fixes
Fix YAML formatting issue for rax integration tests
2015-06-30 09:40:46 -05:00
43f81c7c01 Fix YAML formatting issue for rax integration tests 2015-06-30 09:38:12 -05:00
200706d5ab Merge pull request #9812 from fgsch/fix_1904
Allow globbing in creates= and removes= directives
2015-06-30 07:58:54 -04:00
0cfebb8760 Fixes a bug whereby tags are expected to be a set
Fixes #11424
Fixes #11429
2015-06-30 07:18:41 -04:00
f7da725d53 added bundler to changelog 2015-06-29 20:46:04 -04:00
62e780c74a moved to actual live plugin directory and ported to v2 2015-06-29 20:45:50 -04:00
d149ea5222 ported timer.py callback to v2 2015-06-29 20:45:50 -04:00
a41caf722d added example of whitelisted callback 2015-06-29 20:45:50 -04:00
7416e00541 fixed condition for loading whitelisted callbacks 2015-06-29 20:45:50 -04:00
dc83c0e3f3 Merge pull request #11360 from mrwacky42/patch-1
Clarify that setting ssh_args trumps control_path
2015-06-30 00:37:10 -04:00
9785e5397e Fix typo in SharedObjectLoader field basedirs 2015-06-29 22:51:53 -04:00
927072546b Fixing up some issues with plugin loading 2015-06-29 22:49:25 -04:00
2a5fbd8570 Winrm fixes for devel
* Include fixes for winrm connection plugin from v1 code
* Fixing shell plugin use
2015-06-29 22:49:25 -04:00
2a8ab4ab3e Merge pull request #9765 from runseb/update
Add tags for inventory
2015-06-29 20:41:14 -04:00
2d1cb7f328 Treat generators like lists and tuples 2015-06-29 14:55:11 -07:00
df77d087a5 Adds the check for 'not None' also when building host_info dict for ElastiCache clusters, nodes and replication groups 2015-06-29 23:28:55 +02:00
8a76371a1c Merge pull request #11394 from dlundquist/ipaddr-slaac-filter
IPv6 SLAAC address computation filter
2015-06-29 14:23:50 -07:00
4059904a18 Add splitext filter 2015-06-29 15:39:57 -05:00
d88a42570e Adds a check for 'not None' values when iterating ElastiCache SecurityGroups keys 2015-06-29 21:56:36 +02:00
a5dfb35301 Merge pull request #11420 from ansible/argspec-path-and-refactor
Refactor the argspec type checking and add path as a type
2015-06-29 11:45:44 -07:00
8a1a86797d Merge pull request #11425 from sivel/rax-tests-timeout
Make the wait_timeout for rax tests a configurable default
2015-06-29 12:51:01 -05:00
c440762b61 Make the wait_timeout for rax tests a configurable default 2015-06-29 12:09:16 -05:00
d612838116 Add packages needed to build the docs 2015-06-29 08:30:00 -07:00
be6db1a730 Refactor the argspec type checking and add path as a type 2015-06-29 08:05:58 -07:00
881dbb6da1 Add building of docs to travis 2015-06-29 08:00:30 -07:00
21c14363fd Allow callback plugins to be whitelisted 2015-06-29 10:56:28 -04:00
e1991d9e32 Merge pull request #11414 from yunano/changelog-wantlist
fix small typo for wantlist
2015-06-28 10:36:01 -04:00
e6251542a4 fix small typo for wantlist 2015-06-28 22:07:32 +09:00
24226646fc When loading the play hosts list, enforce some consistency
Fixes #9580
2015-06-28 01:00:32 -04:00
9d9cd0c42c Handle getting the ds for Conditionals which may not be mixed in 2015-06-28 00:30:27 -04:00
f433e709f2 Fix templating of hostvars values
Also adds play information into the hostvars creation, to assure the
variable manager used there has access to vars and vars_files

Fixes #9501
Fixes #8213
Fixes #7844
2015-06-27 21:04:16 -04:00
8ef28253e3 Properly catch and report conditional test failures 2015-06-27 15:37:10 -04:00
0eb1c880dd Use itertools instead of set for tags, as the data may not hash well
The tags field may contain bad data before it is post_validated, however
some methods assumed it would be a simple list or string. Using itertools
gets us around the problem of the data potentially not being hashable

Fixes #9380
2015-06-27 15:19:44 -04:00
af49944ab2 Merge pull request #11398 from resmo/for-ansible
cloudstack: fixes and updates
2015-06-27 13:28:37 -04:00
6daae92e73 Merge pull request #11409 from erikdw/staging-instead-of-stage
change 'stage' to 'staging', as it a much more common term for a pre-…
2015-06-27 06:31:57 -07:00
93115be17b Merge pull request #11408 from erikdw/fix-module-development-comment-typo
fix typo in module-development comment: by -> but
2015-06-27 06:30:13 -07:00
c17d8b9439 [grammar nazi] rearrangment. 2015-06-27 12:34:12 +05:30
de4d4bcc80 grammatical rearrangements. 2015-06-27 12:30:45 +05:30
fde99d8095 change 'stage' to 'staging', as it a much more common term for a pre-production environment, and there are already many references to 'staging' appearing in the ansible code and docs, so let's be consistent 2015-06-26 23:38:06 -07:00
cbae925307 Clarify that setting ssh_args trumps control_path 2015-06-26 23:32:30 -07:00
94011160b3 fix typo in module-development comment: by -> but 2015-06-26 23:30:13 -07:00
bb8d87ceb6 Allow field attributes which are lists to validate the type of the list items
Starting to apply this for tags too, however it is not correcting things
as would be expected.
2015-06-27 01:01:51 -04:00
f68223b9ed Don't add module args into variables at all
Getting recursive errors otherwise, so this is probably not something
we want to do. This most likely only worked in v1 due to the fact that
module args were templated earlier than the point in Runner() when
they were fed into the templating engine.
2015-06-27 01:01:51 -04:00
6d2e1a3b24 Merge pull request #11363 from danasmera/devel
Add quote to a variable following a colon
2015-06-27 00:54:37 -04:00
e153f76c95 now validate that we do get a vault password 2015-06-27 00:02:24 -04:00
bdceb154e5 Merge pull request #11365 from halberom/undocumented_filters
docs - added missing filters
2015-06-26 18:57:36 -04:00
a11b65814c added win_iss modules, corrected bad line join in prev commit 2015-06-26 16:58:14 -04:00
9ff0645fa2 add3ed missing rax mon module 2015-06-26 16:56:08 -04:00
4fbf26a478 added rax_mon_* mnodules to changelog 2015-06-26 16:56:08 -04:00
123d665acb added ec2_vpc_net new module to changelog 2015-06-26 16:56:08 -04:00
0729554803 added win_scheduled_task plugin to changelog 2015-06-26 16:56:08 -04:00
25fc0c7e1b Fixing bug in failed_when results introduced by c3c398c 2015-06-26 16:55:06 -04:00
a6a86a5bdb added missing filters, changed since to new in version 2015-06-26 21:49:04 +01:00
6b1ec141cb Merge pull request #11389 from silviot/patch-1
Update link to github in developing plugins docs
2015-06-26 12:35:17 -07:00
8fd5eecb2a Merge pull request #11372 from nitzmahone/docsite_install_v2_fix
added six to install-from-source docs
2015-06-26 12:34:38 -07:00
b723f9a09a Allow squashed loop items to use name=foo-{{item}}
Fixes #9235
Fixes #11184
2015-06-26 13:56:45 -04:00
7952723530 cloudstack: fix domain name is not unique, use full path 2015-06-26 09:25:26 +02:00
b9b1e294d7 cloudstack: add get_or_failback() 2015-06-26 09:25:26 +02:00
cf7744f2f1 IPv6 SLAAC address computation filter
Jinja2 filter to compute SLAAC address.

Usage:
    {{ '2db8::/64' | slaac(ansible_eth0.macaddress) }}
2015-06-25 13:20:21 -07:00
784b18cb24 Update link to github 2015-06-25 19:50:17 +02:00
9911a947ed Vendorize match_hostname code so that ansible can push it out to clients along with the code that uses it. 2015-06-25 08:17:58 -07:00
00aed57295 Update submodule refs 2015-06-25 07:13:46 -07:00
160e71e2cf Some flake8 cleanup 2015-06-25 07:13:37 -07:00
332ca927d9 Fix parent attribute lookup
Using 'value is None' instead of 'not value', in order to account
for boolean values which may be false

Fixes #11232
2015-06-24 20:57:53 -04:00
256a323de5 Submodule update 2015-06-24 15:03:34 -04:00
ed07a90289 added six to install-from-source docs 2015-06-24 11:40:59 -07:00
4942f18100 added role_path to magic var section 2015-06-24 16:54:53 +01:00
4fbd4ae18b Update VariableManager test for additional magic variable playbook_dir 2015-06-24 11:27:44 -04:00
548a7288a9 Use BUFSIZE when putting file as well as fetching file. 2015-06-24 01:00:22 -07:00
270be6a6f5 Fix exec_command to not use a shell 2015-06-23 22:27:45 -07:00
b8434db3cc fix: Add double-quote to a variable precedening color 2015-06-23 20:48:13 -04:00
874df00f74 Add double-quote to a variable precedening color 2015-06-23 20:44:17 -04:00
a1a7d6c462 Fix forwarding the user-given params from fetch_url() to open_url() 2015-06-23 15:17:26 -07:00
7b4ff28b87 Creating modules: use if __name__ 2015-06-23 14:45:44 -07:00
e461241d7b Fix fetch_file() method 2015-06-23 14:45:44 -07:00
d0d9be30d5 Correctly compile handler blocks for dependent roles 2015-06-23 15:48:48 -04:00
0b16580567 Add in playbook_dir magic variable 2015-06-23 14:29:39 -04:00
4c6adcf143 Submodule pointer update 2015-06-23 13:32:50 -04:00
4246777759 Re-implement the ssh connection retry, originally added in 2df690 2015-06-23 12:14:14 -04:00
006391eb83 Add the improved exception reporting to the minimal callback plugin 2015-06-23 12:14:14 -04:00
6aae500a2c Documentation fix 2015-06-23 08:58:26 -07:00
d19700944d URL has changed 2015-06-23 08:52:57 -07:00
125e6f49a1 Update submodule refs 2015-06-23 08:49:01 -07:00
72d4b40a26 Don't allow empty (none) loop values
Fixes #8593
2015-06-23 10:42:33 -04:00
24d2202591 Make sure role parsing can handle a few more types in includes/defs 2015-06-23 10:20:09 -04:00
aa53212a9b Don't use all task params for vars, just the module args 2015-06-23 10:20:09 -04:00
952166f48e Fix problem with chroot connection plugins and symlinks from within the chroot. 2015-06-22 20:08:08 -07:00
61e367f549 Better error messages when the file to be transferred does not exist. 2015-06-22 20:08:08 -07:00
7490044bbe Implement play_hosts magic variable (and ansible_current_hosts)
Fixes #8073
2015-06-22 21:03:55 -04:00
cb5f630f33 Don't post_validate vars and vars_files on Play objects
Fixes #11343
2015-06-22 11:23:23 -04:00
ff251a0dcc Catch runtime errors due to recursion when calculating group depth
Fixes #7708
2015-06-22 02:06:07 -04:00
97954ff658 Minor tweak to potentially speed the linear strategy up
* Don't fetch vars for the task unless we're going to use them
2015-06-22 00:53:34 -04:00
f17bdc4d61 Set the ansible_ssh_port variable instead of saving it internally for Host
Fixes #11330
2015-06-22 00:38:41 -04:00
5a02ea5f2b Merge pull request #11335 from parente/role-typo
Fix typo: "name" to "role"
2015-06-22 00:09:53 -04:00
2aba3b4172 Fix typo: "name" to "role" 2015-06-21 15:39:22 -04:00
b34b606fcf fixed and/or grouping 2015-06-21 01:51:28 -04:00
68325dbfe2 fixed remote tmp creation when becoem user is not root and '~/' instead of $HOME is the default 2015-06-21 01:43:35 -04:00
102de96ebf avoid password handling when no password is supplied 2015-06-21 01:24:35 -04:00
3bad03d57a cleaned up and optimized become handling paths 2015-06-21 01:13:22 -04:00
415c6bdc75 added sensu mdoules to changelog 2015-06-21 01:13:22 -04:00
83350c4156 added ec2_ami_copy to changelog 2015-06-21 01:13:22 -04:00
2367fb8934 added cs_facts to changelog 2015-06-21 01:13:22 -04:00
e4fcef2136 added ec2_eni to changelog 2015-06-21 01:13:22 -04:00
be81b650e8 fixes issue 11286 where role handlers are not run 2015-06-21 00:36:37 -04:00
6e61881e80 Merge pull request #11329 from joshainglis/doc-fix
Fixed shebang in module example
2015-06-20 15:02:47 +05:30
fc5be30c2f Change the use of a mutable arg for a default value for locals 2015-06-19 23:04:35 -04:00
0d92599d18 Make exception printing a bit smarter 2015-06-19 22:59:12 -04:00
a77b58e351 Bumpt the BUFSIZE to 64k for better performance 2015-06-19 11:52:06 -07:00
0777d02505 Fix problem with jail and zone connection plugins and symlinks from within the jail/zone. 2015-06-19 11:09:48 -07:00
ca2f2c4ebd Fix problem with jail and zone connection plugins and symlinks from within the jail/zone. 2015-06-19 09:41:48 -07:00
f0777d9c4e Update submodule refs 2015-06-19 09:08:57 -07:00
18a9eff11f Properly use local variables from templates including other templates
Fixes #6653
2015-06-18 16:10:21 -04:00
bbcd172eb3 Merge pull request #11319 from sivel/asg-tests
Add tests for rax_scaling_group
2015-06-18 15:43:43 -04:00
c0dfa8d512 Make sure task names are templated before callbacks are sent 2015-06-18 14:27:20 -04:00
b370f6efce Add tests for rax_scaling_group 2015-06-18 13:08:35 -05:00
98fee172ee Fix bug in async action plugin 2015-06-18 13:49:34 -04:00
b41b08ba7d Merge pull request #11306 from rhcarvalho/patch-1
Fix docs typo
2015-06-18 11:49:23 -04:00
270eb4274c Make sure we safe_eval booleans too
Fixes #5779
2015-06-18 11:12:46 -04:00
4d5a98d8d9 Merge pull request #11307 from dagwieers/patch-6
Change syslog (priority) level from LOG_NOTICE to LOG_INFO
2015-06-18 10:29:16 -04:00
7bb2a7aa87 actually no password to handle, this should return false 2015-06-18 10:23:37 -04:00
87a0ccc354 fixed typo 2015-06-18 10:12:04 -04:00
aede9f08db fixed case in which prompt was None 2015-06-18 10:05:23 -04:00
4ca4d36ae6 Change syslog (priority) level from LOG_NOTICE to LOG_INFO
If you look at the meaning of the different syslog levels, NOTICE means that the event may need someone to look at it. Whereas INFO is pure informational.

Since module invocations are in fact requested (deliberate) actions, they shouldn't need any additional post-processing, and therefore should not be logged as NOTICE.

This may seem like hairsplitting, but correctly categorizing system events helps weeding through the noise downhill.

According to Wikipedia: https://en.wikipedia.org/wiki/Syslog

5 	Notice 		notice 	Events that are unusual but not error conditions .
6 	Informational 	info 		Normal operational messages -no action required. Example an application has started, paused or ended successfully.
2015-06-18 11:00:10 +02:00
fdc06c134a Fix docs typo 2015-06-18 09:03:42 +02:00
7c65f3ddd7 partial become support for local connection plugin 2015-06-18 01:46:43 -04:00
671118ba71 fixed become password handling with paramiko 2015-06-17 23:31:55 -04:00
744ec2bbad put hostkey locking into function (still needs fixing)
implemneted become handling here, cannot generalize well enough in base class
2015-06-17 23:31:54 -04:00
d6672ad285 removed unused import 2015-06-17 23:31:54 -04:00
5cfd0f82a0 moved away from generic function for become 2015-06-17 23:31:54 -04:00
3fab516d3d fixed detection of incorrect password 2015-06-17 23:31:54 -04:00
c745796707 added hall notification module to changelog 2015-06-17 23:31:54 -04:00
f74f0e76f0 added dpkg_selections to changelog 2015-06-17 23:31:54 -04:00
08f62b6e13 added vsphere copy 2015-06-17 23:31:54 -04:00
faed1b2d05 better error reporting when doc parsing fails 2015-06-17 23:31:54 -04:00
b27d762081 addeed osx_defaults to changelog 2015-06-17 23:31:54 -04:00
a0f1d81ada added several openstack modules to changelog 2015-06-17 23:31:54 -04:00
87ca475704 Exclude the all/ungrouped groups from pattern matching results
Fixes #5375
2015-06-17 16:25:58 -04:00
90445ee67d Add ::1 where we see 127.0.0.1, for better ipv6 support
Fixes #5764
2015-06-17 16:03:19 -04:00
c3c398cffe Cleaning up some task failure detection problems
* fixed a bug in which failures from a with_* loop were not being
  caught correctly, leading to tasks continuing when they should stop
* when ignore_errors is enabled, the failure will no longer count
  towards the number of failed tasks
2015-06-17 15:40:04 -04:00
5bbbec9b61 Merge pull request #11301 from msabramo/include_inventory_file_in_unable_to_find_inventory_file_error_msg
Add inventory file to "Unable to find" error msg
2015-06-17 14:04:17 -04:00
a385744426 Add inventory file to "Unable to find" error msg
E.g.:

    $ ansible gabriel -m ping -i ssh_config.py
    ERROR! Unable to find an inventory file (ssh_config.py), specify one with -i ?
2015-06-17 11:00:13 -07:00
2ad8e7c9b3 Merge pull request #11300 from aioue/devel
add simple prefix filtering to vmware inventory
2015-06-17 13:47:42 -04:00
410285ecd6 add simple prefix filtering to vmware inventory
Significantly speeds up inventory collection on systems with many
excluded machines.
2015-06-17 18:41:54 +01:00
0c27315648 Merge pull request #11299 from rncry/patch-2
support instances with no public ip
2015-06-17 12:47:19 -04:00
daa319881f Make sure registered variable message is sent before other messages
Avoids a race condition where previously the registered variable message
was being sent after the 'host_task_ok' message, meaning the next task
may be started before the var is registered, leading to an undefined
variable error
2015-06-17 12:42:47 -04:00
16f66a39a6 support instances with no public ip
default to private ip if the instance doesn't have a public ip assigned. (causes list index out of range error otherwise)
2015-06-17 17:22:28 +01:00
8cfec0a27a Merge pull request #11297 from msabramo/serf_plugin_use_env_vars
Simplify serf inventory plugin
2015-06-17 11:31:57 -04:00
194b85338f Merge pull request #11298 from bennojoy/fix_11296
fixes 11296 where the groups does not have all the groups
2015-06-17 11:31:26 -04:00
dc63bbf0b9 Simplify serf inventory plugin
using newly added `EnvironmentConfig` class in `serfclient`.

See https://github.com/KushalP/serfclient-py/pull/17
2015-06-17 08:20:56 -07:00
cce6edeb6c Merge pull request #11293 from tamsky/tamsky-patch-1
for tags with empty value, do not append separator
2015-06-17 09:55:07 -04:00
0d5b7ae669 fixes 11296 where the groups does not have all the groups 2015-06-17 19:18:19 +05:30
888f3236c5 Merge pull request #11294 from msabramo/serf_plugin_use_env_vars
plugins/inventory/serf.py: Use SERF_RPC_* env vars
2015-06-17 09:38:56 -04:00
ce42c66e27 plugins/inventory/serf.py: Use SERF_RPC_* env vars
This makes the Serf inventory plugin use the `SERF_RPC_ADDR` and
`SERF_RPC_AUTH` environment variables that the `serf` command-line tool
already uses.

These can be used to get Serf data from a remote node instead of
requiring the ansible control host to be running a serf agent and to be
a member of the serf cluster.
2015-06-16 21:11:36 -07:00
ff998b6022 Make sure the templar is using the right vars when evaluating conditionals 2015-06-17 00:10:11 -04:00
a0e8b9ef98 for tags with empty value, do not append separator 2015-06-16 19:28:53 -07:00
4cac10e016 Merge pull request #11281 from trondhindenes/win_checksum
Bugfix: win_checksum
2015-06-16 19:26:36 -04:00
d7fcd9456a Merge pull request #11288 from kstrauser/aixfixes
Don't panic if AIX's uname doesn't support -W
2015-06-16 19:02:50 -04:00
eb820837ac Don't panic if AIX's uname doesn't support -W
The current code expects "uname -W" on AIX to always succeed. The AIX 5
instance I have doesn't support the -W flag and facts gathering always
crashes on it.

This skips some WPAR handling code if "uname -W" doesn't work.
2015-06-16 15:26:02 -07:00
896da2a09e Merge pull request #11287 from kstrauser/freebsd6fixes
Fixes for FreeBSD get_memory_facts
2015-06-16 18:10:56 -04:00
935da01068 Fixes for FreeBSD get_memory_facts
- swapinfo on FreeBSD 6 (maybe 7 too?) doesn't support the "-m" flag for
  fetching amounts in megabytes. This patch fetches amounts in kilobytes
  and divides by 1024 (and also returns the result as an int instead of
  a string).

- When no swap is configured, swapinfo prints a header line and nothing
  else:

    $ swapinfo
    Device         1K-blocks     Used    Avail Capacity

  The old version unexpectedly parsed that header line and emitted
  nonsense values like:

    "ansible_swapfree_mb": "Avail"
    "ansible_swaptotal_mb": "1K-blocks"

  This version emits those items altogether.
2015-06-16 14:35:36 -07:00
3b1b95b916 moved ipv6 handling to init
fixed become password handling
2015-06-16 15:48:10 -04:00
bb7d33adbc moved become password handlingn to base class 2015-06-16 15:48:10 -04:00
42e2724fa5 added serf inventory plugin 2015-06-16 15:48:10 -04:00
f300be0f38 added ec2_eni_facts 2015-06-16 15:48:10 -04:00
4b28a51f25 Don't fail outright when a play has an empty hosts list 2015-06-16 13:56:23 -04:00
605ddad37e Add test that url lookup checks tls certificates 2015-06-16 09:46:17 -07:00
30c1a2d861 Have group/host var file loading check for YAML extensions too
Fixes #11132
2015-06-16 11:55:56 -04:00
98e5f73f44 Merge pull request #11283 from msabramo/serf_inventory_plugin
Add serf inventory plugin
2015-06-16 11:46:36 -04:00
336f45f5b3 Add serf inventory plugin
Add inventory plugin for [Serf](https://serfdom.io/).
Requires [`serfclient` Python module](https://pypi.python.org/pypi/serfclient).
2015-06-16 08:23:38 -07:00
4705a79a98 Updating docs banners 2015-06-16 11:00:11 -04:00
d913f169a8 Update failed_when integration test to be more thorough 2015-06-16 11:00:11 -04:00
423f1233c8 removed typo file 2015-06-16 10:49:37 -04:00
daee298cb6 Bugfix: win_checksum.ps1 2015-06-16 14:20:34 +00:00
0a23a85bfc Merge pull request #11280 from Vebryn/patch-1
Update syslog_json.py
2015-06-16 10:20:02 -04:00
b1574ecfce Update syslog_json.py
localhost is better than locahost ;)
2015-06-16 16:13:01 +02:00
c87591f76f updated to new exec_command signature 2015-06-16 09:28:27 -04:00
b76dbb01cc generalized prereqs check
added vaultfile class for action and lookup plugin usage
2015-06-16 09:20:15 -04:00
9116ff1c28 replaced removed pager_print for print 2015-06-16 09:19:37 -04:00
98f5534d9c adaptaed to new exec signature
should fix #11275
2015-06-16 09:12:42 -04:00
5ed2e44026 adjusted with_dict test to now work 2015-06-15 17:42:40 -04:00
dc31086a17 added with_dict test 2015-06-15 17:12:36 -04:00
6c884c9e39 Merge pull request #11271 from sivel/build-play-method
Allow AdHocCLI to be more flexible for overriding
2015-06-15 16:21:32 -04:00
dcf81e3ffe removed useless comments 2015-06-15 15:04:19 -04:00
1d55e193c1 Expose the TaskQueueManager to self 2015-06-15 13:50:40 -05:00
670894e2bd Move building the play_ds into a method, that can be overridden 2015-06-15 10:35:26 -05:00
8ae58f7ea3 fixed executable, correctly this time 2015-06-15 11:26:45 -04:00
f576d29b6b allow for any non string iterable in listify 2015-06-15 11:02:51 -04:00
0d606b5705 added cs_template to changelog 2015-06-15 10:42:55 -04:00
d164c9c7a0 Adds explanation about all_elasticache_nodes and all_elastic_clusters settings 2015-06-15 11:36:33 +02:00
2acfbce64d Removes unnecessary commented code and replaces with useful information 2015-06-15 11:35:25 +02:00
f2d22c1373 Fixes error messages to mention ElastiCache 2015-06-15 10:02:54 +02:00
1ce1c52f6f centralized bad password handling, fixed outputing of become method 2015-06-15 01:40:53 -04:00
b89071e485 now detects incorrect password with sudo and su (at least in english) 2015-06-15 01:30:03 -04:00
5bac17de51 fixed pfexec test 2015-06-15 01:20:38 -04:00
be8d797c23 fixed su prompt function reference 2015-06-15 01:07:02 -04:00
872448e9e8 updated connection info update_vars to only update if data is not alreayd present
aslo added comment clarifying why we do this
2015-06-15 01:02:27 -04:00
956937b110 made executable shell configurable again 2015-06-15 00:15:31 -04:00
580993fef7 enabled initial support for password prompt on become
- moved check prompt/password functions to connection, make more senes there
- TODO: consider moving make_become to connection from connection_info
- removed executable param that was never overriden outside of connection info
2015-06-15 00:09:25 -04:00
bac35ae773 set correct become mehotds for plugin
fixed mixup with remote password vs become_password
2015-06-14 23:49:10 -04:00
ff443d4534 added note to figurte out correct var udpate on connection_info 2015-06-14 23:48:03 -04:00
c3ccf26b70 added become check back to connections 2015-06-14 23:45:56 -04:00
de82c953f2 added privilege escalation special var mapping 2015-06-14 23:19:49 -04:00
a248678518 initial become support to ssh plugin
- password prompt detection and incorrect passwrod detection to connection info
- sudoable flag to avoid become on none pe'able commands
2015-06-14 23:03:23 -04:00
a267f93c83 removed incorrect assumption on become user being set 2015-06-14 21:05:23 -04:00
ff15f374ad fixed new become settings, rearranged constants to find PE related vars easier 2015-06-14 20:50:38 -04:00
e8c3e3d645 Cleans some unnecessary white spaces in ec2.py dynamic inventory plugin 2015-06-14 23:38:09 +02:00
77a2ad0e8c Improves code organization in get_dict_from_describe_dict method 2015-06-14 23:32:10 +02:00
41b034a5d2 Process information about replica clusters for ElastiCache replication groups 2015-06-14 23:29:55 +02:00
e692a18a29 Process information about primary clusters for ElastiCache replication groups 2015-06-14 23:29:05 +02:00
43f9a653d0 Process CacheNodeIdsToReboot complex type for cache clusters 2015-06-14 23:27:16 +02:00
ffd74049da Comments about the naming pattern in the script, that certainly deserves future refactoring 2015-06-14 23:24:51 +02:00
f25ad9dc51 Adds the appropriate key checks for ElastiCache replication groups in get_dict_from_describe_dict method 2015-06-14 23:21:33 +02:00
069ee11699 Creates add_elasticache_replication_group method in ec2.py dynamic inventory script 2015-06-14 23:18:30 +02:00
c18f6cae11 Creates get_elasticache_replication_groups_by_region method to handle the API call 2015-06-14 23:15:33 +02:00
40ce072747 Adds the logic to process the new config entries about ElastiCache replication groups 2015-06-14 23:14:00 +02:00
22020ac3cd Adds the necessary config entries to ec2.ini, to support ElastiCache replication groups 2015-06-14 23:12:52 +02:00
e64daba8e7 Adds a flag (is_redis) to prevent duplicity of information about Redis single node clusters 2015-06-14 23:10:33 +02:00
2a242a0e1b Creates add_elasticache_node method in ec2.py 2015-06-14 23:08:39 +02:00
98a5531966 Makes the API requests to return nodes' information too 2015-06-14 23:03:15 +02:00
dbb0304cea Adds uncammelize helper method to put the labels in the expected output format 2015-06-14 23:01:13 +02:00
c6f2b08a60 Creates get_host_info_dict_from_describe_dict helper method to translate information from a 'describe' call (we don't have instance objects in this case) 2015-06-14 22:57:03 +02:00
2cd76cf0e3 Creates add_elasticache_cluster method to digest the API answer about ElastiCache clusters 2015-06-14 22:41:05 +02:00
06c6db8e6b Adds get_elasticache_clusters_by_region method to perform the API call to AWS (and sadly finds out that Boto support for ElastiCache is very outdated...) 2015-06-14 22:21:40 +02:00
50b320615e Little improvement in the organization of the configuration loader method 2015-06-14 22:13:27 +02:00
bc80bd36af Adds the necessary logic to ec2.py to load ElastiCache related configuration 2015-06-14 22:12:03 +02:00
382c6fe05b Adds basic configuration to ec2.ini to support ElastiCache Clusters and Nodes 2015-06-14 22:07:39 +02:00
e7abe06440 added first_found to template 2015-06-13 00:34:15 -04:00
8ee4c7266c corrected original_file code path to use actually use data from original file 2015-06-13 00:10:17 -04:00
491761f880 added note to add faf deprecation 2015-06-12 23:54:09 -04:00
a6ca133da8 got first_available working with copy 2015-06-12 23:54:09 -04:00
11f1d99a5b added test for first_available and copy 2015-06-12 23:54:09 -04:00
0f915dc122 Merge pull request #11254 from smarvin/patch-1
Update index.rst
2015-06-12 22:19:58 -04:00
0132c51346 Update index.rst
Adding some copy edits. Feel free to disregard.
2015-06-12 17:38:37 -07:00
aca125d03e Merge pull request #11252 from sivel/deprecated-warning
Display a warning when using a deprecated module
2015-06-12 16:30:45 -04:00
9ed3e2ef48 Display a warning when using a deprecated module 2015-06-12 15:21:33 -05:00
d315f6e22c Fix Etcd constructor 2015-06-12 12:59:29 -07:00
77c76e632e Switch etcd and url lookup plugins to verify ssl certificates 2015-06-12 12:54:57 -07:00
4161d78a94 Split the fetch_url() function into fetch_url and open_url().
open_url() is suitable for use outside of a module environment.  Will
let us use open_url to do SSL cert verification in other, non-module
code.
2015-06-12 12:54:56 -07:00
e07dde1a3c Merge pull request #11251 from sivel/issue/11244
Require passlib over crypt in password_hash for Mac OS X/Darwin. Fixes #11244

i was almost done with my patch ... but I like yours better
2015-06-12 14:58:02 -04:00
a4e2d1eb62 Require passlib over crypt in password_hash for Mac OS X/Darwin. Fixes #11244 2015-06-12 13:54:43 -05:00
acda3efe7a Merge pull request #11246 from soupdiver/patch-1
Update guide_gce.rst
2015-06-12 10:27:27 -04:00
48c1064d0b Update guide_gce.rst
Make the docs more specific.
2015-06-12 17:21:23 +03:00
b9bb3e83b7 added new test that allows for listed bare strings
now with_times: barestring, will error out in test
2015-06-11 13:45:04 -04:00
aaab69cae9 brought back terms testing as with_ is not only way to call and we cannot guarantee terms is a list otherwise. 2015-06-11 13:45:04 -04:00
091caf6279 added missing error class import 2015-06-11 13:45:04 -04:00
e9cf67004b updated fail_on_undefined test to new function signatures 2015-06-11 13:45:04 -04:00
5d7dac6938 added expect module to changelog 2015-06-11 13:11:09 -04:00
31ef87eb72 Add dnf to list of modules that we squash loop items for 2015-06-11 09:05:44 -07:00
176b04a812 Correct typo 2015-06-11 09:03:20 -07:00
c346788194 Slight optimization of how we squash loops. Add dnf to the list of modules for which we squash.
Fixes #11235
2015-06-11 08:55:56 -07:00
aed429554d better checks to ensure listify emits a non string iterable 2015-06-11 10:03:44 -04:00
47aeff1636 Merge pull request #11236 from sirkubax/patch-1
comment to ec2.ini inventory instances grouping
2015-06-11 09:30:30 -04:00
c8fde467b5 Merge pull request #11163 from sivel/ssh-private-key-fixme
Re-introduce ssh connection private key support
2015-06-11 09:16:27 -04:00
fbdc84becd Merge pull request #11234 from resmo/patch-2
changelog: add cs_network
2015-06-11 08:15:27 -04:00
0f68db2d7e Update ec2.ini
Warning about usage boto+ec2.ini
2015-06-11 11:51:35 +02:00
ef6bd9afb0 changelog: add cs_network 2015-06-11 09:31:24 +02:00
f174682e19 facts should now not be overriten with NA option unless they are NA
this way we don't need a break per distro that matched already with
the python default functions
2015-06-11 00:48:40 -04:00
4098e8283e several fixes to template
- now obeys global undefined var setting and allows override (mostly for with_ )
- moved environment instanciation to init instead of each template call
- removed hardcoded template token matching and now use actually configured tokens, now it won't break if someone changes default configs in ansible.cfg
- made reenetrant template calls now pass the same data it got, dictionary and lists were loosing existing and new params
- moved fail_on_undeinfed parameter to template call, as it should only realky be set to false on specific templates and not globally
- added overrides, which will allow template to implement jinja2 header override features
- added filter list to overrides to disallow possibly insecure ones, TODO: check if this is still needed as facts should not be templated anymore
- TODO: actually implement jinja2 header overrides
2015-06-11 00:21:53 -04:00
7291f9e965 removed cruft
made sure it does not fail on undefined
2015-06-11 00:13:40 -04:00
f29c1c7452 respect undefined config setting 2015-06-10 23:26:01 -04:00
40336b50af removed redundant string check
added playbook path lookup
2015-06-10 22:58:08 -04:00
7306a5397e simplified function, always attempt to template, always check if string before return, should avoid most cases of strings being passed to lookups 2015-06-10 22:55:50 -04:00
aa6e204b6e Merge pull request #11115 from jhawkesworth/second_go_at_fixing_1404
Part fix for https://github.com/ansible/ansible-modules-core/issues/1404 (replaces #11086)
2015-06-10 20:43:32 -04:00
40553fb4c7 Merge pull request #11229 from pastephens/patch-1
Update playbooks_vault.rst
2015-06-10 20:41:04 -04:00
deb741240e Update playbooks_vault.rst
As of 1.9 at least, you may specify a password file in your ansible.cfg and not have to extend your playbook calls with vault flags.
2015-06-10 16:36:26 -07:00
f2934eeb0a Merge pull request #11226 from resmo/for-ansible
cloudstack: cleanup, remove unused parts
2015-06-10 14:44:49 -04:00
034228f64b cloudstack: add missing api_timeout into v1 2015-06-10 20:31:26 +02:00
6eb96c1a56 cloudstack: methods renaming 2015-06-10 20:29:57 +02:00
d68111382d updated with nagios doc fix 2015-06-10 13:00:29 -04:00
39764ed7d8 updated submodule refs 2015-06-10 13:00:29 -04:00
0b074c449b cloudstack: methods renaming 2015-06-10 17:31:46 +02:00
7b3dd55c3d cloudstack: remove unused methods used for backward compatibility 2015-06-10 17:28:45 +02:00
09e1d3abf0 Merge pull request #11219 from Erethon/devel
ansible-pull: Add option to verify gpg signature of a commit
2015-06-10 10:24:21 -04:00
6f11896303 ansible-pull: Add option to verify gpg signature of a commit
Add option '--verify-commit' to verify a GPG signature of the checked
out commit. As noted in the git module documentantion, this requires
git version >= 2.1.0
2015-06-10 17:29:04 +03:00
655a7e365f Merge pull request #11221 from arcz/patch-1
Update README.md
2015-06-10 09:44:58 -04:00
312e79ccd5 Update README.md
There are over 1000 contributors now :)
2015-06-10 15:42:30 +02:00
757fb39a2e now uses new module_loader 2015-06-09 21:35:44 -04:00
24b7c353cc readjusted limit opts, makes no sense in adhoc when you already specify selection
changed pull to reflect this
2015-06-09 17:35:19 -04:00
845d564d89 removed debug, moved limit to runtask instead section 2015-06-09 17:32:34 -04:00
fdeca37257 switched to argv[0] from __file__ as it is what we actually wanted 2015-06-09 17:29:46 -04:00
5aec5e5eb0 fixed ansible pull, reorged validate function for cli to be function specific like parser
added missing cmd_functions with run_cmd, mostly for ansible pull
2015-06-09 17:24:43 -04:00
3bcbdf6841 Merge pull request #11215 from davejamesmiller/patch-1
Remove duplicated "By default" in docs
2015-06-09 16:00:31 -04:00
652daf3db4 Remove duplicated "By default" in docs 2015-06-09 19:48:38 +01:00
19161dfd72 fixed typo in placeholder check 2015-06-09 11:46:08 -04:00
f1e4ae5fc3 Merge pull request #11213 from resmo/for-ansible
cloudstack: prevent getting the wrong project.
2015-06-09 10:21:33 -04:00
fc3020c57a cloudstack: prevent getting the wrong project.
Since we use domain and account data to filter the project, listall is not needed and can return the wrong identical named project of another account if root admin permissions are used.

Fixed projects names are not case insensitive.
2015-06-09 16:16:58 +02:00
6fa7a11493 added iam_policy 2015-06-09 10:03:51 -04:00
6b5605c435 Merge pull request #11208 from tgerla/multiple-plays-docs
add an example of multiple plays in a single playbook
2015-06-09 08:23:05 -04:00
64ffa160dc Fixed shebang in module example 2015-06-09 11:05:20 +10:00
8e3213a91e updated copyright as MPD does not deserve the blame for this one 2015-06-08 20:20:07 -04:00
45f80328ae updated submodule refs 2015-06-08 20:14:47 -04:00
70b5c28694 initial implementation of the generic OS package module 2015-06-08 20:12:42 -04:00
597d3a5eaa add an example of multiple plays in a single playbook 2015-06-08 19:32:44 -04:00
e88a9e943c Use to_bytes to avoid tracebacks when passed a byte str instead of a unicode string
Fixes #11198
2015-06-08 11:15:11 -07:00
bbfc982dd5 added pear module to changelog 2015-06-08 10:52:19 -04:00
97bc92d2df minor cleanup, pushed ipv6 fixing to init
pushed up using host short var
made close conditional, started implementing close for controlmaster
2015-06-08 10:52:08 -04:00
ca89467e37 Merge pull request #11161 from joshainglis/ovirt-dynamic-inventory
oVirt Dynamic Inventory
2015-06-08 10:35:42 -04:00
5864744068 Merge pull request #11194 from edunham/patch-1
Fix confusing wording about aliases
2015-06-08 10:06:58 -04:00
f0fb2e7f65 Removed shebang line from .ini file 2015-06-08 13:01:54 +10:00
20df50e11c Fix confusing wording about aliases
Point out that nicknames for hosts can go in the hosts file, by fixing wording that seemed contradictory.
2015-06-06 21:35:51 -07:00
522c1cde9b Merge pull request #11193 from sivel/no-test-become-pass
Don't test for play.become_pass any longer
2015-06-06 10:33:24 -04:00
5ce3988d86 Merge pull request #11192 from sivel/better-parser-errors
Raise AnsibleParserError instead of AssertionError
2015-06-06 10:27:28 -04:00
230be812ba Don't test for play.become_pass any longer 2015-06-06 09:25:30 -05:00
6a1c175991 Raise AnsibleParserError instead of AssertionError 2015-06-06 09:16:38 -05:00
bdba807fd1 minor fixes to ssh error reporting
shoudl fix #11041
2015-06-06 00:16:35 -04:00
1a0775a498 Merge pull request #11190 from EdwardJKim/vault-import-fix
Add missing import in vault.py
2015-06-05 23:37:53 -04:00
6a5a930c5a Add missing import in vault.py 2015-06-05 23:04:21 -04:00
4776146154 added openstack client config module to changelog 2015-06-05 22:23:50 -04:00
3edbe17d3f added datadog monitor to changelog 2015-06-05 21:51:41 -04:00
3dd40b61d9 added puppet module 2015-06-05 21:46:06 -04:00
68e13126dd Merge pull request #11187 from sivel/fix-tests
Get tests passing
2015-06-05 19:20:18 -04:00
ed57f0732b added os_image and deprecated glance_image 2015-06-05 19:22:25 -04:00
65d982b186 Merge pull request #11186 from sivel/winrm-syntax-error
Fix syntax error in winrm
2015-06-05 15:47:21 -07:00
d67c9858a9 removed become_pass as it should not be used 2015-06-05 18:43:42 -04:00
24fd4faa28 avoid removing test all~ file 2015-06-05 18:42:14 -04:00
46673cd620 Merge pull request #11183 from sivel/issue/11169-become-pass
Don't empty out become_pass. See #11169
2015-06-05 18:21:29 -04:00
49d19e82ab Get tests passing
The largest failure in the tests was due to selinux not being installed.
The tests don't require it to be installed, so mock the import.
2015-06-05 16:05:39 -05:00
6f5ebb4489 Fix syntax error in winrm 2015-06-05 16:02:29 -05:00
45b4ee9cfe Don't allow setting become_pass in a play 2015-06-05 14:10:00 -05:00
f9b56a5d7c Fix raising AnsibleError 2015-06-05 11:41:23 -07:00
c2f26ad95d added iam, prefixed amazon modules 2015-06-05 14:04:39 -04:00
6bc2ea1f2b Don't empty out become_pass. See #11169 2015-06-05 12:02:35 -05:00
04f4f77d91 Merge pull request #11124 from sivel/jit-connect
Use a decorator to perform just in time connection
2015-06-05 11:38:17 -04:00
1e9c9df075 added webfaction modules to changelog 2015-06-05 11:21:08 -04:00
f4c6caa24d added elasticache_subnet_group to changelog 2015-06-05 10:17:11 -04:00
5e2c6ac80f Merge pull request #11182 from vroetman/patch-1
Update current released Ansible to 1.9.1

Thanks, note to team: we really need to make this dynamic on doc build
2015-06-05 09:58:25 -04:00
e3d40e541c Update current released Ansible to 1.9.1
Update current released Ansible to 1.9.1 and development version to 2.0
2015-06-05 09:55:24 -04:00
9ac624d2c9 Fix mock DictDataLoader _get_file_contents to match real code 2015-06-05 07:19:14 -04:00
73c956366e Correctly determine failed task state when checking results
Fixes #11172
2015-06-05 07:16:19 -04:00
a4ebee4b16 Merge pull request #11170 from dguerri/devel
Fix lookup() plugin
2015-06-04 16:05:06 -04:00
ee5e166563 Fixing ansible_*_interpreter use
Fixes ansible/ansible-modules-core#1459
2015-06-04 15:43:07 -04:00
ee06eebea3 Fix lookup() plugin
lookup() plugin is currently broken because _get_file_contents() now
returns a tuple: (contents, show_data).

This patch fix that issue.
2015-06-04 19:46:09 +01:00
bce281014c Decorate the ConnectionBase methods, switch to calling super from individual connection classes 2015-06-04 13:27:18 -05:00
9754c67138 Use a decorator to ensure jit connection, instead of an explicit call to _connect 2015-06-04 13:14:28 -05:00
f3f3fb7c49 Fixing vars_prompt 2015-06-04 13:54:51 -04:00
f7839dee11 Merge pull request #11168 from sivel/v1-sync
Resync the v1 directory with v1_last. Fixes #11162
2015-06-04 13:33:57 -04:00
ccb8bcebd3 Resync the v1 directory with v1_last. Fixes #11162 2015-06-04 11:36:01 -05:00
a98382681a Merge pull request #11166 from JavierMartinz/patch-1
Fixed Github examples directory URL
2015-06-04 12:02:00 -04:00
23cbfc17e5 Fixed Github examples directory URL 2015-06-04 17:52:37 +02:00
6a97e49a06 Re-introduce ssh connection private key support 2015-06-04 08:15:25 -05:00
23460e6480 Removed a dictionary comprehension for python 2.6 support 2015-06-04 17:59:53 +10:00
7692391568 Removed some text 2015-06-04 17:35:10 +10:00
efc3d2931e Fixed typo 2015-06-04 17:07:08 +10:00
0826106441 minor docs reformat
- clearer 'version added' for module options, now it sits under the option name
- made notes a section, so it now appears in toc
- moved requirements and made it a list, more prominent and more readable
2015-06-03 22:19:26 -04:00
337b1dc45c minor doc fixes 2015-06-03 20:56:33 -04:00
7dd3ef7b60 Older python-six from early RHEL and ubuntu do not have add_metaclass but do have with_metaclass 2015-06-03 13:29:24 -07:00
f3ccff42e5 Merge pull request #11142 from Etienne-Carriere/factor_f5
Add common fonctions for F5 modules (FQ Name functions)
2015-06-03 16:27:57 -04:00
0cbd7b6b24 Merge pull request #11156 from sivel/v1-hacking
Add the hacking directory to v1
2015-06-03 13:02:06 -07:00
c89f98168d Add the hacking directory to v1 2015-06-03 14:53:19 -05:00
94fa5e8794 Simplify Fully Qualified function 2015-06-03 21:19:11 +02:00
9856a8f674 added missing imports to doc module 2015-06-03 15:00:41 -04:00
96836412aa Make error messages tell which inventory script the error came from 2015-06-03 11:51:33 -07:00
a87687dccb Merge pull request #11147 from sivel/module-docs-import-mutablemapping
Import missing MutableMapping class for module_docs
2015-06-03 14:50:17 -04:00
1c8527044b Fix error handling when pasing output from dynamic inventory 2015-06-03 11:29:20 -07:00
67d065c758 Merge pull request #10946 from izhukov/inventory-DO-api-v2
Update DigitalOcean dynamic inventory to API v2
2015-06-03 14:06:25 -04:00
c3caff5eeb Fix for six version 1.1.0 (rhel6). 2015-06-03 10:25:07 -07:00
6b642afc7b Merge pull request #11146 from sivel/issue/11136
Don't set a default on the _become FieldAttribute
2015-06-03 12:38:20 -04:00
d8c8ca11cf Add compatibility for old version of six (present on rhel7) 2015-06-03 08:45:36 -07:00
2e39661a26 made with_ examples have explicit templating 2015-06-03 11:15:42 -04:00
89dceb503a Import missing MutableMapping class 2015-06-03 10:02:27 -05:00
f983557e7e Don't set a default on the _become FieldAttribute. Fixes #11136 2015-06-03 09:54:00 -05:00
74a537ede0 Merge pull request #11140 from RadishTheHut/connection_info
Fix for task_executor on OS X
2015-06-03 09:47:04 -04:00
5204d7ca88 Add common fonctions for F5 modules (FQ Name functions) 2015-06-03 08:20:26 +02:00
a899f8f016 Fix for task_executor on OS X
I get this exception during the setup task:

AttributeError: 'ConnectionInformation' object has no attribute 'remote_pass'

I believe it is supposed to be looking at the password attribute. Either that
or we should create a remote_pass attribute in ConnectionInformation.
2015-06-03 07:26:18 +02:00
3e2e81d896 missing path in import path for making paths 2015-06-02 23:42:00 -04:00
65b82f69e4 avoid failing when mode is none 2015-06-02 23:39:57 -04:00
5622fc23bc fixed frozen set, missing iterable 2015-06-02 23:35:15 -04:00
48c0d6388f moved RAW var to class and as a frozenset 2015-06-02 23:35:15 -04:00
9cd5c8092e Merge pull request #11135 from sivel/issue/11130-2
If remote_addr isn't set, set to ipv4_address
2015-06-02 15:35:11 -05:00
1b48111b12 If remote_addr isn't set, set to ipv4_address 2015-06-02 14:56:32 -05:00
f57eaece88 Merge pull request #11134 from sivel/import-display-cli-base
Add missing import in ansible.cli
2015-06-02 14:11:32 -05:00
6519118106 Add missing import in ansible.cli 2015-06-02 14:11:16 -05:00
7a617e7b93 Merge pull request #11131 from sivel/issue/11130
Don't override ansible_ssh_host with inventory_hostname
2015-06-02 14:03:25 -05:00
c4ae51089d Merge pull request #11129 from sivel/fix-scp-if-ssh
Fix command building for scp if ssh
2015-06-02 14:02:51 -05:00
697a1a4061 Don't override ansible_ssh_host with inventory_hostname 2015-06-02 14:01:11 -05:00
300eb3a843 Add six as a dependency for packaging 2015-06-02 11:43:35 -07:00
71014ab01e Fix command building for scp if ssh 2015-06-02 13:35:53 -05:00
093b5b6051 Merge pull request #11127 from bcoca/makedirs_safe
created makedirs_safe function for use in cases of multiprocess
2015-06-02 13:36:39 -04:00
e0ef217f97 Revert "Adding raw module to list of modules allowing raw params"
This reverts commit bc041ffea0.
same fix x2 does not fix it 'more'
2015-06-02 13:33:33 -04:00
ba02e5e3bf minor adjustments as per code review 2015-06-02 13:01:59 -04:00
8c6fa5fb77 added promox_template module to changelog 2015-06-02 12:41:02 -04:00
2590df6df1 created makedirs_safe function for use in cases of multiprocess
should fix #11126 and most race conditions
2015-06-02 11:41:30 -04:00
47be5b4166 added missing ansibleoptionserror import and moved args check in playbook to after parser exists to allow for creating usage info 2015-06-02 11:03:17 -04:00
d1b4371287 Correctly evaluate changed/failed for tasks using loops 2015-06-02 09:42:08 -05:00
860a96cf70 Merge pull request #11097 from resmo/for-ansible
cloudstack: updates and v1 sync
2015-06-02 10:25:45 -04:00
bc041ffea0 Adding raw module to list of modules allowing raw params
Fixes #11119
2015-06-02 08:42:24 -05:00
e251e70178 added raw to 'raw' modules 2015-06-02 08:54:37 -04:00
caf3cf6930 cloudstack: add timeout to utils 2015-06-02 14:51:25 +02:00
fc807e29c8 cloudstack: add api_timeout to doc fragments 2015-06-02 14:51:25 +02:00
7bb9cd3766 cloudstack: minor cleanup in doc fragments 2015-06-02 14:51:25 +02:00
8868f4b481 cloudstack: sync module_utils/cloudstack.py to v1
Commits from 31520cdd17 to 62ccc1b9b6 related to cloudstack.py
2015-06-02 14:51:15 +02:00
620fad9f8d Fixing an oops in inventory/__init__.py where the slots are incorrect 2015-06-01 20:02:15 -05:00
7f1b64d934 Submodule pointer update for core to the merged v2 branch 2015-06-01 19:46:29 -05:00
e547e1f9ba Merge branch 'devel' into devel_switch_v2 2015-06-01 16:53:15 -05:00
c7d1dd4b68 Updating v1/ansible/modules/core/ to use the v1_modules branch 2015-06-01 16:50:18 -05:00
fe41f109a9 Merge branch 'v2_final' into devel_switch_v2 2015-06-01 16:42:59 -05:00
4bc7703db3 Fixing some small bugs related to integration tests (v2) 2015-06-01 16:42:10 -05:00
30b92a6f4c Get-FileChecksum allways returns a string now,
and the test_win_copy integration tests that depend on the checksum
have been updated in this change too.
2015-06-01 21:53:49 +01:00
e36b7130ff Merge pull request #11106 from cchurch/test_winrm_tweaks
Minor tweaks to winrm integration tests
2015-06-01 11:01:59 -04:00
9a90ca5a36 Merge pull request #11062 from Etienne-Carriere/factor_f5
Factor primitives for F5 modules
2015-06-01 10:34:11 -04:00
816b20af0b Fixes #11046 2015-06-01 10:24:20 -04:00
5aa1a42848 Merge pull request #11103 from sysadmin75/11046_media_type_setup
fix fact gathering on OS X
2015-06-01 10:19:51 -04:00
46a72d108a added cs_project new module 2015-06-01 10:17:18 -04:00
d2ba0de6aa When running winrm tests against multiple hosts, fail the play when any host has a failure. 2015-05-31 23:16:45 -04:00
8d742df1de Allow prepare_win_tests role to run multiple times, before each role that depends on it. 2015-05-31 23:15:28 -04:00
908d6c0ef2 Fixes #11046 2015-05-31 20:05:02 -04:00
5658ddf02e Merge pull request #11096 from szarka/patch-1
Update guide_aws.rst
2015-05-29 19:05:08 -07:00
5954892457 Update submodule refs 2015-05-29 19:00:16 -07:00
d8bfb4c629 Update guide_aws.rst
Fixed typos.
2015-05-29 21:49:52 -04:00
529726d0ba fixed mistaken module update in prev commit 2015-05-29 16:22:55 -04:00
7e020d21de correctly identify ubuntu now in all cases
made NA the last resort
2015-05-29 16:19:09 -04:00
a8c290cc3b fixed ubuntu facts for all versions
made sure NA is option of last resort
2015-05-29 16:14:30 -04:00
2046d76310 Add defaults and a link to os-client-config docs 2015-05-29 13:10:13 -07:00
b659621575 Remove unneeded required_one_of for openstack
We're being too strict - there is a third possibility, which is that a
user will have defined the OS_* environment variables and expect them to
pass through.
2015-05-29 13:09:45 -07:00
2924c90a5d Merge pull request #10977 from emonty/fix-envvars
Fix envvars support in openstack modules
2015-05-29 13:05:03 -07:00
1e418fe56a Only run win_feature tests when the host has the ServerManager module. 2015-05-29 13:57:11 -04:00
dee2d53b3e Update v2 submodule refs 2015-05-29 08:51:50 -07:00
12691ce109 Add -Compress to ConvertTo-Json calls in common powershell code 2015-05-29 10:40:24 -04:00
a0935a1dcd Merge pull request #11090 from jhawkesworth/powershell-to-json-compress
Add -Compress to ConvertTo-Json calls in common powershell code
2015-05-29 10:35:02 -04:00
9371c38af9 Add -Compress to ConvertTo-Json calls in common powershell code 2015-05-29 14:50:08 +01:00
0828028c71 Fixing unit test for included file changes 2015-05-29 00:15:14 -05:00
7985d2a8be Moving included file stuff to a proper dedicated class and file (v2) 2015-05-28 23:58:38 -05:00
fe014148d9 Removing errant debug print 2015-05-28 20:29:16 -05:00
ac14ad1419 Test on fields that are actually set 2015-05-28 17:02:48 -07:00
e7a096c4c5 cowsay is back! 2015-05-28 20:01:39 -04:00
73b7d96501 Test on fields that exist 2015-05-28 17:01:18 -07:00
e5190327f2 this fixes ansible on openbsd and freebsd systems. only tested on openbsd. 2015-05-28 19:17:31 -04:00
5d213cab23 Update extras submodule ref for doc fix 2015-05-28 16:00:58 -07:00
5ffc1183dd WHoops, that was the core module stable branch 2015-05-28 15:37:12 -07:00
2f4ad2714f Update core module ref 2015-05-28 15:36:35 -07:00
1bda7cc200 Test that uri module validates certs 2015-05-28 15:35:45 -07:00
0f4a3409d8 Add test that validate_certs=no works 2015-05-28 15:35:25 -07:00
4d8427538d Update submodule refs 2015-05-28 15:10:06 -07:00
60bea844b3 Merge branch 'v2_final' into devel_switch_v2 2015-05-28 15:27:09 -05:00
2bad888f28 Merge branch 'v2_final' into devel_switch_v2
Conflicts:
	lib/ansible/inventory/__init__.py
	lib/ansible/modules/core
	lib/ansible/utils/__init__.py
	lib/ansible/utils/module_docs.py
2015-05-28 15:26:03 -05:00
afc19894e1 Make fetch_url check the server's certificate on https connections 2015-05-28 13:20:40 -07:00
1ccf2a4685 Make fetch_url check the server's certificate on https connections 2015-05-28 12:35:37 -07:00
aef76cc701 More complex example of using test-module 2015-05-28 14:43:25 -04:00
37ae5aab31 Capture only IOError when reading shebang from inventory file, to avoid ignoring other possible exceptions like timeouts from a task 2015-05-28 12:19:32 +02:00
e59d4f3b51 More module_utils/basic.py unit tests for v2 2015-05-28 01:26:04 -05:00
388827a636 Update submodule ref 2015-05-27 20:28:29 -07:00
b91532aff3 Drop the mysql test db first so that we test with a clean slate. 2015-05-27 13:39:09 -07:00
c2968d6d84 New lookup plugin : ini. Can handle ini file and java properties file.
Can also read a list of value in a section using regexp.
2015-05-27 21:51:20 +02:00
b72a912562 Update submodule refs 2015-05-27 06:50:46 -07:00
83074f4d93 doc: we need GPLv3 license headers
GPLv2 only headers are incompatible with GPLv3
2015-05-27 15:10:10 +02:00
7508709045 updated as per feedback 2015-05-27 07:30:10 -04:00
339a02c384 Started reworking module_utils/basic unit tests (v2) 2015-05-27 03:21:15 -05:00
ea4421d10e Update submodule refs 2015-05-26 15:33:47 -07:00
7a0c521131 added os_server_actions 2015-05-26 17:30:57 -04:00
f1ab1c48f4 Update submodule refs for v2 2015-05-26 12:38:26 -07:00
3865c5051b Merge pull request #11058 from srvg/bug/11017
limit extensions for files in group/host_vars dir
2015-05-26 15:31:12 -04:00
c87586e9e5 updated formatting 2015-05-26 15:11:30 -04:00
d793ed360b Fix syntaxerror in the required_if arg spec check 2015-05-26 11:30:06 -07:00
0f23d8a503 Fix syntaxerror in the required_if arg spec check 2015-05-26 11:29:35 -07:00
7c6ebcab6d Merge pull request #11073 from msabramo/include_more_info_in_errors
Include more info when a task fails
2015-05-26 14:26:50 -04:00
31609e1b16 Add required_if to AnsibleModule
There is a common pattern in modules where some parameters are required
only if another parameter is present AND set to a particular value. For
instance, if a cloud server state is "present" it's important to
indicate the image to be used, but if it's "absent", the image that was
used to launch it is not necessary. Provide a check that takes as an
input a list of 3-element tuples containing parameter to depend on, the
value it should be set to, and a list of parameters which are required
if the required parameter is set to the required value.
2015-05-26 11:21:38 -07:00
c6b286424f Merge pull request #9423 from emonty/features/required-if
Add required_if to AnsibleModule
2015-05-26 11:20:40 -07:00
aea8758b44 added os_network and deprecated quantum_network 2015-05-26 13:51:32 -04:00
d0a154c446 Include more info when a task fails
Adds "playbook", "role", and "task" fields to the output when a task fails.

This makes it easier to pinpoint where the problem is, especially
when you have a lot of roles and playbooks.

e.g.:

    failed: [vagrant] => {..."playbook": "/Users/marca/dev/ansible/vagrant.yml",
                          ..."role": "pythonapp",
                          ..."task": "pip install -r /opt/src/{{ sm_app_role }}/requirements.txt"...}
2015-05-26 09:25:12 -07:00
540c23dfce this fixes ansible on openbsd and freebsd systems. only tested on openbsd. 2015-05-26 12:04:35 -04:00
16c70dd7d4 added equivalent of #9636 to v2 2015-05-26 11:55:52 -04:00
6000db7e5d Merge pull request #9636 from Batmat/fix-message-i18n-parsing-error
Setting LC_MESSAGES: prevent unparseable messages (fixes issue #9635)
2015-05-26 11:49:56 -04:00
b740b0372a added new win_environment module 2015-05-26 10:05:25 -04:00
5f246dc1a6 Update extras submodule for doc fixes 2015-05-25 09:35:40 -07:00
dcc691f462 Update submodule refs 2015-05-25 09:23:04 -07:00
eaddc0b309 removed duplicate retry config entries 2015-05-25 11:06:04 -04:00
544ece20a8 Merge pull request #11063 from mmoya/remove-duplicate-constants
Remove duplicate RETRY_FILES_* constants
2015-05-25 11:01:07 -04:00
0f0f28145b added promox module to changelog 2015-05-25 10:35:28 -04:00
308879075d Remove duplicate RETRY_FILES_* constants 2015-05-25 16:26:37 +02:00
f55d1578d9 Merge pull request #11060 from erikdw/fix-playbook-intro-typo
fix typo in --ask-sudo-pass reference within playbook_intro doc
2015-05-25 09:56:04 -04:00
3775dd5ec8 Factor F5 primitives 2015-05-25 09:53:23 +02:00
5c455ad729 fix typo in --ask-sudo-pass reference within playbook_intro doc 2015-05-24 17:02:02 -07:00
d4a31e8d26 Adding unit tests for TaskExecutor (v2) 2015-05-24 07:47:06 -05:00
b92d70c5b6 tests files extensions in group/host_vars dir
only files with extensions as per
C.YAML_FILENAME_EXTENSIONS should be parsed
2015-05-23 21:37:12 +02:00
b6ea8de399 limit extensions for files in group/host_vars dir
inventory vars: make loading from a directory obey the same rules as
when checking the base paths, looking at the file name extensions
as defined in CONSTANTS.YAML_FILENAME_EXTENSIONS

Fixes Github issue #11017
2015-05-23 20:34:08 +02:00
3010190592 Fixing up the hacking module_formatter code for v2 2015-05-23 08:42:17 -05:00
ed4df57361 Submodule update for devel 2015-05-22 13:30:00 -05:00
9f1cd0f42a Merge pull request #11036 from jolexa/patch-1
Minor Fix for broken link
2015-05-22 11:10:22 -04:00
838ff32001 Fix unit test for conn_info (v2)
The default user expected in the connection information is the current
user, not root
2015-05-22 08:38:39 -05:00
ecd5eb902d Adding unit tests for ConnectionInformation (v2) 2015-05-22 03:32:40 -05:00
a8d52e3e94 Have to setup the proper mime-types before importing SImpleHttpServer 2015-05-21 12:24:41 -07:00
7af2632c87 Forgot to invoke wrapper instead of SimpleHttpServer 2015-05-21 11:56:58 -07:00
b312e97a30 Think that integration tests are failing in json due to lack of json mimetype. Make a short wrapper to fix that. 2015-05-21 10:59:57 -07:00
16c2de84ec Update the submodule refs 2015-05-21 10:00:25 -07:00
13253f9c68 Merge pull request #10565 from bcoca/with_sequence_expand
made sequence more flexible
2015-05-21 08:05:17 -07:00
04e15ab54f Update v2 submodule refs 2015-05-21 07:59:02 -07:00
9921a1d2be Unit tests for base strategy class (v2) 2015-05-21 02:03:59 -05:00
bb81f025b0 Merge pull request #8679 from j0057/support-arch-8653
Add support for Arch to module_utils.basic.py
2015-05-20 22:57:54 -07:00
cc51e6b7c2 Update submodule refs in v2 2015-05-20 18:12:09 -07:00
3b5a3aa80a Update submodule refs 2015-05-20 17:58:40 -07:00
13578738bf Merge pull request #11014 from ansible/uri-integration
Uri integration tests
2015-05-20 17:57:06 -07:00
f90ea8a3f8 Merge pull request #10236 from emonty/features/deprecate-old-nova-inventory
Add deprecation notices to the old nova inventory
2015-05-20 14:09:08 -07:00
96759cda82 Add deprecation notices to the old nova inventory 2015-05-20 14:01:58 -07:00
2180981a6e Minor Fix for broken link 2015-05-19 22:18:24 -05:00
0bb4101842 Fix doc formatting 2015-05-19 15:13:09 -07:00
b48be7c484 Update submodule refs for v2 2015-05-19 14:27:54 -07:00
73804b375e Update submodule ref for core doc update 2015-05-19 14:24:16 -07:00
b93674b380 Update submodule refs 2015-05-19 14:19:17 -07:00
ff36309072 Merge pull request #11027 from bcoca/module_checklist
added module checklist docs
2015-05-19 16:18:25 -04:00
8da580a29c basic: fix ValueError if value of a type='int' is not an int
With this fix, we get a friendly error message:

    failed: [localhost] => {"failed": true}
    msg: value of argument start_port is not of type int and we were unable to automatically convert
2015-05-19 11:51:56 -04:00
9ec5299c12 Merge pull request #11032 from resmo/fix/value_error
basic: fix ValueError if value of a type='int' is not an int
2015-05-19 11:47:40 -04:00
8f29ca23ae basic: fix ValueError if value of a type='int' is not an int
With this fix, we get a friendly error message:

    failed: [localhost] => {"failed": true}
    msg: value of argument start_port is not of type int and we were unable to automatically convert
2015-05-19 17:40:46 +02:00
9a88e0fc8e removed empty choices from files 2015-05-19 10:46:44 -04:00
da6d15d1f9 removed empty choices from files 2015-05-19 10:46:20 -04:00
78985e5c33 Merge pull request #11030 from resmo/feature/cloudstack_tests_cs_portforward
cloudstack: add tests for cs_portforward
2015-05-19 08:58:27 -04:00
5c6616dc9d Merge pull request #11029 from resmo/feature/cloudstack_tests
cloudstack: add tests for cs_firewall
2015-05-19 08:56:35 -04:00
3916dc8f9e cloudstack: add tests for cs_portforward 2015-05-19 10:11:55 +02:00
3d816402ba cloudstack: add tests for cs_firewall 2015-05-19 09:39:50 +02:00
21fa385ce7 Reorganizing plugin unit tests and adding start of strategy tests (v2) 2015-05-18 17:26:59 -07:00
2e07567c16 Retry exec command via ssh_retry
This PR adds the option to retry failed ssh executions, if the failure
is caused by ssh itself, not the remote command. This can be helpful if
there are transient network issues. Retries are only implemented in the
openssh connection plugin and are disabled by default. Retries are
enabled by setting ssh_connection > retries to an integer greater
than 0.

Running a long series of playbooks, or a short playbook against a large
cluster may result in transient ssh failures, some examples logged
[here](https://trello.com/c/1yh6csEQ/13-ssh-errors).

Ansible should be able to retry an ssh connection in order to survive
transient failures.

Ansible marks a host as failed the first time it fails to contact it.
2015-05-18 14:22:52 -07:00
f083ca747a Update submodule ref to fix postgres_user 2015-05-18 12:46:31 -07:00
e69c7f5474 Update modules refs 2015-05-18 12:08:45 -07:00
5343c99cb1 Update submodule pointers 2015-05-18 09:25:15 -07:00
684e30a5f4 Update submodule refs 2015-05-18 09:00:16 -07:00
61110c08b8 added ec2_win_password module 2015-05-18 10:07:17 -04:00
6c1e806a2f added return docs management 2015-05-18 09:57:44 -04:00
d42cfb3386 added module checklist docs 2015-05-18 08:57:22 -04:00
9ef5d8da6e added new rabbitmq modules 2015-05-18 08:17:29 -04:00
16df2726ca Merge pull request #11018 from tyll/ed25519
facts: Add ed25519 ssh pubkey
2015-05-18 08:15:11 -04:00
525de8b7cf Fix codecs.escape_decode() usage 2015-05-17 09:28:48 -07:00
8f71e47a73 Update core and extras module refs 2015-05-17 09:23:39 -07:00
8e2938c997 Update core module ref for lineinfile fix 2015-05-17 09:22:31 -07:00
a960fcd569 Adding module_utils tests from v1 to v2 2015-05-17 01:29:40 -05:00
398b1d3e60 Cleaning up template test syntax a bit 2015-05-17 01:13:22 -05:00
9aa8676bdd More template unit tests for v2 2015-05-17 01:06:02 -05:00
23cd3294d0 Starting to add v2 tests for template 2015-05-16 15:45:01 -05:00
718898891e Merge pull request #11011 from bcoca/fuse_selinux_fix
attempt to fix selinux context on fuse filesystems
2015-05-15 18:07:35 -04:00
02d784598f facts: Simplify ssh key fetching 2015-05-15 22:36:13 +02:00
e7846343e5 facts: Add ed25519 ssh pubkey 2015-05-15 22:25:20 +02:00
5a94720905 Pull in a lot more doc fixes 2015-05-15 12:12:45 -07:00
674d1016c0 Update extras ref for doc fix 2015-05-15 11:52:57 -07:00
b0448d9cf4 Update submodule refs 2015-05-15 11:34:54 -07:00
0913b8263c made special treatment of certain filesystem for selinux configurable 2015-05-15 13:52:27 -04:00
2e31a67532 Update module refs in v2 2015-05-15 10:42:41 -07:00
e2de336a23 made special treatment of certain filesystem for selinux configurable 2015-05-15 13:19:15 -04:00
8a26b17f16 Merge pull request #11009 from kustodian/fix-pattern-documentation
Fixed documentation for host pattern portions
2015-05-15 09:20:51 -07:00
ac7dce4631 Fixing broken set_extra_vars method after fixing unit tests (v2) 2015-05-15 10:45:55 -05:00
b22bf0c7c9 Merge pull request #11015 from mscherer/fix_typo_doc
Fix error in the column name in the doc
2015-05-15 10:05:00 -04:00
85aa984340 Fix error in the column name in the doc 2015-05-15 01:05:38 -04:00
48d62fd934 Cleaning up VariableManager tests (v2) 2015-05-14 20:10:31 -05:00
0f9ad9dad2 Update integration tests from @darkk to work with the current uri module code 2015-05-14 14:21:29 -07:00
3383a7b37a tests: replace start-stop-daemon with async action 2015-05-14 12:58:24 -07:00
ae9ba4afa1 uri: provide raw_content, parse json without double-decoding. Fixes #7586
Regression potential:
 - `raw_content` is written to `dest` file instead of decoded `content`
 - `raw_content` doubles module reply
2015-05-14 12:58:24 -07:00
a0509cda1e Fix test_role unit tests to use unique role names to avoid role caching errors 2015-05-14 14:31:11 -05:00
14719a6f08 Add judgment to to fix path0 if ANSIBLE_CONFIG is set to a dir 2015-05-14 22:02:30 +08:00
fa1549fec1 Fixed documentation for host pattern portions 2015-05-14 12:24:36 +02:00
b7d644d484 Fix broken cache logic 2015-05-14 09:42:48 +03:00
46d7f5281a added pushbullet to changelog 2015-05-13 20:05:47 -04:00
b91ce29007 Go to next task when we get an error in linear 2015-05-13 12:52:51 -07:00
bbda86ad0a Fix parsing tests so that they all run 2015-05-13 11:04:12 -07:00
b94e2a1f4e Fixing bugs related to parsing and fixing up parsing integration tests (v2) 2015-05-13 11:27:12 -05:00
b85ce38834 slight changes to error handling to align with v1 2015-05-13 11:15:32 -04:00
892fba265b Update to fix documentation build 2015-05-13 08:15:12 -07:00
3861597696 Bring back cache 2015-05-13 18:12:48 +03:00
0a1dc74463 Update submodule refs 2015-05-13 07:52:13 -07:00
079fca27a2 Update module refs for v2 2015-05-13 06:57:04 -07:00
c82574e044 added cs_portforward 2015-05-13 09:46:02 -04:00
7b33f5c952 added circonus annotation 2015-05-13 09:21:55 -04:00
830225d9c1 Fix errors in subelements lookup plugin and associated tests (v2) 2015-05-12 15:09:03 -05:00
4d999f8fe0 Fix logic error in parent attribute retrieval for blocks/roles (v2) 2015-05-12 15:08:35 -05:00
dcb54d9657 Add integration test to verify #10073
In issue #10073 a misbehaviour in literal handling for inline lookup
arguments that can cause unexpected behaviur was reported. This
integration testcase reproduce the problem.

After applying pull request #10991 the issue is fixed and the test
passes.

Signed-off-by: Jan Losinski <losinski@wh2.tu-dresden.de>
2015-05-12 11:16:17 -07:00
b03b7892f8 Fix method of exiting task loop (v2) 2015-05-12 13:09:08 -05:00
d0d0e9933f Update module refs in v2 2015-05-12 11:05:58 -07:00
9b646dea41 Add optional 'skip_missing' flag to subelements 2015-05-12 12:52:16 -05:00
1ca8cb8553 Fixing up v2 unit tests 2015-05-12 12:24:57 -05:00
361eb29146 Also make task_executor connect explicitly (v2) 2015-05-12 11:30:08 -05:00
3697d6582f Connection plugins no longer auto-connect (v2)
Also fixed a bug in ssh.py where an attribute was being inappropriately
initialized in the _connect() method instead of __init__()
2015-05-12 11:23:40 -05:00
09605706d9 relly fix it this time 2015-05-12 12:26:20 -04:00
12a800c0e7 fixed less opts issue 2015-05-12 12:24:32 -04:00
8fdf9ae59b moved module_doc_fragments to v2 2015-05-12 12:18:55 -04:00
6918a588c6 Update the extras module ref 2015-05-12 08:44:24 -07:00
75b2082529 Submodule update 2015-05-12 10:33:19 -05:00
537baf6512 Merge pull request #10903 from gtback/include-variable-structure-docs
Make "include" variable documentation consistent
2015-05-11 22:56:56 -04:00
f164926a9d Merge pull request #10983 from resmo/patch-1
changelog: add cs_account
2015-05-11 15:32:03 -04:00
adc7f91865 changelog: add cs_account 2015-05-11 21:30:59 +02:00
67b656c236 Merge pull request #10979 from resmo/feature/test_cs_account
cloudstack: add test for cs_account
2015-05-11 15:25:55 -04:00
490cde3cbd Add python2.6+ as a documented requirement for rackspace modules 2015-05-11 12:25:03 -07:00
b947704e2b Merge pull request #10982 from alexmuller/fix-docs-playbook-intro-sudo
Remove unnecessary 'from' in playbook intro docs
2015-05-11 15:20:28 -04:00
1caee5cb79 Remove unnecessary 'from' in playbook intro docs
To make this sentence make sense.

Fixes #10970.
2015-05-11 20:12:21 +01:00
fd321355d6 Adding 'role_path' to VariableManager "magic" variables (v2) 2015-05-11 14:04:17 -05:00
7b1c6fbab9 Fix playbook includes so tags are obeyed (v2) 2015-05-11 12:48:03 -05:00
e9bf3fc30b Merge pull request #10981 from aioue/patch-2
Update become.rst
2015-05-11 13:36:15 -04:00
0c21f05bcd Update become.rst
Visually separate commands and values from description text for clarity. Add value detail for become_user and become_method to match become.
2015-05-11 18:33:24 +01:00
c80c5c980d Add python2.6 dep to aws and cloudstack doc fragments 2015-05-11 10:10:58 -07:00
daf533c80e V2 fixes
* PluginLoader class will now be more selective about loading some
  plugin classes, if a required base class is specified (used to avoid
  loading v1 plugins that have changed significantly in their apis)
* Added ability for the connection info class to read values from a
  given hosts variables, to support "magic" variables
* Added some more magic variables to the VariableManager output
* Fixed a bug in the ActionBase class, where the module configuration
  code was not correctly handling unicode
2015-05-11 11:29:48 -05:00
f141ec9671 Update v2 module refs 2015-05-11 09:28:19 -07:00
ebb4695da8 Update the submodule pointers 2015-05-11 09:09:00 -07:00
9180ede6e0 cloudstack: add test for cs_account 2015-05-11 17:37:35 +02:00
0c305b72cd Fix align again, strange vim error. ansible/ansible#10917 2015-05-11 14:33:50 +00:00
cd14d73be8 Add defaults and a link to os-client-config docs 2015-05-11 08:10:37 -04:00
d2782f0d84 Remove unneeded required_one_of for openstack
We're being too strict - there is a third possibility, which is that a
user will have defined the OS_* environment variables and expect them to
pass through.
2015-05-11 08:06:21 -04:00
31b0ffafa8 Align fix for ansible/ansible#10917 2015-05-10 14:43:36 +00:00
ad9981f565 Fix for ansible/ansible#10917
Add missing broadcast addr for network facts for Linux
2015-05-10 14:37:46 +00:00
d1977dad23 started implementing syntax check 2015-05-08 19:19:03 -04:00
ded6e9be67 Merge pull request #10965 from resmo/changelog
changelog: add cs_instancegroup
2015-05-08 19:07:30 -04:00
4a445a1247 changelog: add cs_instancegroup 2015-05-09 00:30:41 +02:00
f9f8af06fc Change asserts to assertIsInstance for better error messages 2015-05-08 13:49:10 -07:00
7f21f270d9 Be more lenient in instance check: MutableMapping is more general than dict 2015-05-08 13:18:19 -07:00
3a87b2727d Fix format strings for python2.6 2015-05-08 13:11:04 -07:00
ee74eec98a Merge pull request #10963 from sivel/v2-testing-stuff
v2_final Testing additions and fixes
2015-05-08 13:02:14 -07:00
419ef0d19c Merge pull request #10959 from bcoca/sudo_docfix
fixed docs on the meaning of -H sudo arg
2015-05-08 14:53:42 -04:00
a0fc8bb0bd Testing additions and fixes
* Fix import pathing for units.mock
* Add some additional requirements
* Use compileall to test compatiblity with different python versions
2015-05-08 13:40:02 -05:00
a6683ba2b8 Merge pull request #10958 from resmo/fix/cloudstack_variable_typo
cloudstack: fix typo in variable, fixes get_domain()
2015-05-08 14:31:49 -04:00
56c9614e74 made playbook include taggable, removed unused conditional import 2015-05-08 14:26:06 -04:00
e6844f7e6c Update core module ref for mysql fix 2015-05-08 10:41:31 -07:00
bb8ab27140 Merge pull request #10948 from dougluce/devel
Update issue template to ask for config details
2015-05-08 11:45:35 -04:00
2e8758d8c4 fixed docs on the meaning of -H sudo arg
fixes #7418
2015-05-08 11:08:10 -04:00
62ccc1b9b6 cloudstack: fix typo in variable, fixes get_domain() 2015-05-08 16:42:07 +02:00
0f1eb3cfc2 Better fix for serializing/deserializing cache plugins (v2) 2015-05-07 23:56:33 -05:00
cd6d1f9221 Fix pickling errors with cache plugins (v2)
Fixes #10945
2015-05-07 21:15:02 -05:00
238e2dee5d Config might be important for issues. 2015-05-07 22:26:16 +00:00
0d3e015dd1 Update DigitalOcean dynamic inventory to API v2 2015-05-07 22:53:10 +03:00
198476e345 Cleaning up some portions of synchronize action plugin (v2) 2015-05-07 13:06:51 -05:00
8db21f99b7 Set the inventory on the variable manager for the adhoc cli usage (v2) 2015-05-07 12:53:59 -05:00
dd7a641e76 Merge pull request #10943 from sivel/sync-ssh-args-v2
Add ability to specify using ssh_args in synchronize for v2
2015-05-07 12:52:29 -05:00
88e8ecb620 Actually get the synchronize action plugin to work 2015-05-07 12:27:30 -05:00
4f4df29cb0 Add ability to specify using ssh_args in synchronize for v2 2015-05-07 11:38:15 -05:00
cee7cd5d3b Update v2 module refs 2015-05-07 08:29:04 -07:00
bc4d51a4fd Update module refs 2015-05-07 08:17:25 -07:00
d6accfe31f Merge pull request #10940 from aioue/patch-1
Update playbooks_tags.rst
2015-05-07 08:43:53 -04:00
1108fd3dd2 Update playbooks_tags.rst
highlight the command part of the sentence to clarify use of 'all' tag.
2015-05-07 12:22:08 +01:00
1152c7327a Fix serialization bug for plugins (v2) 2015-05-06 15:18:37 -05:00
4f28a814ae Return a list instead of tuple when password is specified to ssh connection plugin (v2) 2015-05-06 08:47:23 -05:00
7733dc7bb5 Fix for new octal syntax 2015-05-06 06:41:16 -07:00
79fe1901f6 Update module pointers for v2 2015-05-06 06:05:44 -07:00
374ea10e6f Update the core module pointer 2015-05-06 06:02:33 -07:00
2b49019579 Merge pull request #10926 from jhawkesworth/wmf_3_bug_advice
Documentation update; Add advice about using unpatched Windows Management Framework 3.0.
2015-05-06 08:21:23 -04:00
5489d172de Use same interpreter for test-module and module it runs
Default python interpreter to the same interpreter the test-module
script is executed with.  This is so that the interpreter doesn't have
to be specified twice in the command when using non-default python
(e.g. ``/path/to/python ./hacking/test-module -I python=/path/to/python ...``)
2015-05-06 11:57:25 +01:00
50542db0be Make the default playbook name an empty string (v2) 2015-05-06 02:56:52 -05:00
8214ac7841 Add serializer/deserializer to plugin base object (v2)
Fixes #10923
2015-05-06 01:31:02 -05:00
9d572afb61 Add advice about using unpatched Windows Management Framework 3.0.
Hopefully this should reduce bug reports like #10878 and #10825
2015-05-06 06:33:34 +01:00
d34b586eb6 Add ability for connection plugins to set attributes based on host variables (v2) 2015-05-05 16:40:11 -05:00
9b95c22dc0 Update for doc fixes 2015-05-05 13:59:00 -07:00
6cbff51408 Pick up documentation fixes 2015-05-05 13:51:22 -07:00
4839243366 Documentation fixes 2015-05-05 13:51:22 -07:00
4c8d27f7bb Make module formatting into links to the other module docs 2015-05-05 13:51:22 -07:00
8fae2abed4 Properly fail out of the task loop in the linear strategy on failures (v2) 2015-05-05 13:41:32 -05:00
fba5588028 Handle empty role definitions in YAML (v2) 2015-05-05 13:17:04 -05:00
ba822ce0f9 Backporting release info/changelog stuff to devel 2015-05-05 10:28:43 -05:00
6694db7d56 Merge pull request #10918 from tyll/ansible_inventory
Ansible inventory
2015-05-05 11:03:15 -04:00
f36a92f729 Re-Generate man pages 2015-05-05 16:55:09 +02:00
8ad2eac7e1 Mention ANSIBLE_INVENTORY
Support for ANSIBLE_HOSTS is faded out, see commit
c73254543a, therefore do not mention it in
the man pages.
2015-05-05 16:54:32 +02:00
91caadab86 Merge pull request #10884 from nickhammond/privilege_escalation
Add become docs to the intro configuration for #10881
2015-05-05 10:47:03 -04:00
e971b60f26 updated docs about ansible_hosts/inventory env vars 2015-05-05 09:48:57 -04:00
93be064aa4 Merge pull request #10916 from chrismeyersfsu/feature-integration_azure
add azure integration tests
2015-05-05 08:46:31 -04:00
cf300da02c azure changes to Makefile 2015-05-05 08:42:07 -04:00
efb190d5a5 add azure integration tests 2015-05-04 23:45:03 -04:00
483c61414e added missing : 2015-05-04 18:42:44 -04:00
013c4631e3 hack to prevent tempalte/copy errors on vagrant synced folders that report incorrectly errno 26
fixes #9526
2015-05-04 18:37:38 -04:00
f5471186f9 Merge branch 'v2_final' of https://github.com/ansible/ansible into v2_final 2015-05-04 16:39:18 -05:00
8f504dacdd Merge branch 'devel' into v2_final
Conflicts:
	lib/ansible/modules/core
	v2/ansible/modules/core
	v2/ansible/modules/extras
2015-05-04 16:35:11 -05:00
c488ea019f Fix cs_instance docs 2015-05-04 13:52:48 -07:00
17e65b45d0 Merge pull request #10913 from bcoca/sudosu_ask_fix
now properly inherit data from ansible.cfg for sudo/su ask pass
2015-05-04 16:51:19 -04:00
124a0d3519 now properly inherits from ansible.cfg sudo/su ask pass
fixes #10891
2015-05-04 16:45:43 -04:00
b23a879273 now properly inherit data from ansible.cfg for sudo/su ask pass
fixes #10891
2015-05-04 16:42:25 -04:00
cbde1c5ec0 Fix extending non-dict types from doc fragments 2015-05-04 13:39:07 -07:00
b19d426f0b Normalize the way requirements is specified 2015-05-04 13:39:07 -07:00
99909b08ba Submodule update 2015-05-04 15:06:00 -05:00
fdb0591877 Update module pointers 2015-05-04 12:06:02 -07:00
61ec84ef71 Update module refs 2015-05-04 11:09:54 -07:00
1071fa12ca Merge pull request #10908 from resmo/feature/cloudstack-tests
cloudstack: integration tests
2015-05-04 12:29:27 -04:00
5959f83248 Merge pull request #10860 from bcoca/role_doc_clarify
clarify role spec, dependencies and galaxy involvment.
2015-05-04 12:17:17 -04:00
2543403c21 deprecated nova_compute and added new os_server for openstack to changelog 2015-05-04 12:04:18 -04:00
1194195b1a smoother commands with less quotes for pbrun 2015-05-04 11:38:28 -04:00
8259f449de added cloudstack inventory 2015-05-04 11:34:14 -04:00
69ac1b7eee Merge pull request #9835 from resmo/feature/cloudstack-inventory
cloudstack: add dynamic inventory
2015-05-04 11:30:04 -04:00
354bdaacb8 added new cloud/open|stack modules to changelog 2015-05-04 11:20:12 -04:00
795a45fa4a Merge pull request #10833 from resmo/feature/extend_cloudstack_utils
cloudstack: extend and fix cloudstack utils
2015-05-04 10:49:57 -04:00
4d357a73f6 Merge pull request #10868 from jaypei/devel
Add lineinfile integration tests for quoted string
2015-05-04 10:48:49 -04:00
803fb397f3 Fixing filter plugins directory from switch 2015-05-04 01:33:10 -05:00
249fd2a7e1 Re-adding submodules after moving things around 2015-05-03 22:30:51 -05:00
ce3ef7f4c1 Making the switch to v2 2015-05-03 21:47:26 -05:00
0588a0fdd9 cloudstack: integration tests 2015-05-03 16:06:30 +02:00
333c623b35 cloudstack: implement account und domain support in utils 2015-05-03 14:59:44 +02:00
af74d7f1a9 cloudstack: add get_domain() and get_account() to utils 2015-05-03 14:34:25 +02:00
8cf4452d48 Fix module arg parsing when 'args' are present but not a dict (v2) 2015-05-02 22:17:02 -05:00
6a44056d76 Fix bug in f310d13 (v2) 2015-05-02 22:15:45 -05:00
a87d889182 Generalize plugin enumeration a bit (v2) 2015-05-02 01:34:03 -05:00
f310d13280 Make sure all plugin loaders are loaded from roles and shared correctly (v2) 2015-05-01 23:48:47 -05:00
0b836262f0 draft ansible pull uspport 2015-05-01 18:29:28 -04:00
8a7496af42 Make "include" variable documentation consistent
There is already a good example of a list variable ("ssh_keys")
contained above this snippet, so reuse the content here.
2015-05-01 16:45:56 -05:00
c926bb683a Merge pull request #10901 from mscherer/fix_var_not_exist
Fix pylint error on "cachefile does not exist"
2015-05-01 14:17:35 -04:00
8d324e6a50 Fix pylint error on "cachefile does not exist"
Since cachefile is used to show the error message when stat
fail, the variable need to be declared.
2015-05-01 13:57:13 -04:00
108a1e153a Merge pull request #10899 from wenottingham/patch-5
Tweak vault description
2015-05-01 13:56:02 -04:00
4d4e2bb5a0 Tweak vault description.
Vault isn't specifically for source control. Make description a little more generic and descriptive.
2015-05-01 13:53:29 -04:00
be317ed3ee Merge pull request #10898 from daidoji/patch-1
Update intro_dynamic_inventory.rst
2015-05-01 13:31:24 -04:00
c9815ef286 Update intro_dynamic_inventory.rst
Examples of special characters being converted to underscores for clarity.
2015-05-01 10:23:56 -07:00
2f1b561bd3 porting fix #10893 to v2 2015-05-01 12:39:54 -04:00
0951a74ea0 Merge pull request #10893 from sidick/fix_fetch_url_with_custom_https_port
Allow the use of HTTP on custom ports in the fetch_url function
2015-05-01 12:35:42 -04:00
034ac8ae78 cloudstack: _has_changed() should not compare None values 2015-05-01 17:25:06 +02:00
428f667497 Update module refs 2015-05-01 08:19:02 -07:00
4e08064afa Fix issue where included blocks were not filtered on tags (v2) 2015-05-01 08:32:43 -05:00
6e65ccabc3 Allow the use of HTTP on custom ports in the fetch_url function 2015-05-01 13:52:29 +01:00
1c250ee4e7 Pull in route53 fix 2015-04-30 20:07:36 -07:00
f9e9dd1684 v2 ansible-doc now does everything v1 did 2015-04-30 22:54:38 -04:00
38d2042739 v2 ansible-doc can now list modules 2015-04-30 22:33:29 -04:00
df881b7f37 Update core module ref for docker fix 2015-04-30 19:10:52 -07:00
13978a7d75 fixed typo 2015-04-30 21:27:29 -04:00
9de6fea2fa one cli to bind them all 2015-04-30 21:23:08 -04:00
040a39f249 there will be only one cli 2015-04-30 21:23:08 -04:00
da5e201b07 Change python-q into sharutils as the epel repo for centos6 is being funky. 2015-04-30 17:48:03 -07:00
f2afd1a248 Update core pointer to pick up docker fix 2015-04-30 17:44:38 -07:00
6a985b9c6b Add Fedora mysql vars so we get mariadb rather than mariadb-galera 2015-04-30 16:16:27 -07:00
3ccc2ae299 Fix include test to keep type 2015-04-30 15:25:53 -07:00
974731bec0 Fix filename of output file 2015-04-30 13:54:25 -07:00
fec9b8a5ad Merge pull request #10885 from bcoca/galaxy_v2
revamped base CLI and moved galaxy to it's own classes/api
2015-04-30 16:43:08 -04:00
b851ce29e9 Update core modules to pick up mysql_user fix 2015-04-30 12:55:59 -07:00
8d0ceeca91 Make template test work with both py2.6 and 2.7+ 2015-04-30 09:24:51 -07:00
aafda44bb3 Add play to the parent object structures for inheritence in v2 2015-04-30 11:14:01 -05:00
fb96173d10 to_nice_json filter no longer has a trailing space when formatting dicts 2015-04-30 08:52:02 -07:00
dabf16a714 Update core module pointers for v1 and v2 2015-04-30 08:09:28 -07:00
4e85419257 Merge pull request #10853 from cgar/spelling
just a few spelling error changes

I swear only 95% of those are mine!
2015-04-30 09:02:09 -04:00
ccc9a33b56 most of galaxy is working, install still needs work
normalized return codes in bin
refactored galaxy classes a bit, ignoring 'compatct' role spec
2015-04-29 23:55:44 -04:00
be15d74935 Add become docs to the intro configuration for #10881 2015-04-29 21:22:24 -05:00
b11cd73df1 cloudstack: add tag support in utils 2015-04-29 21:06:58 +02:00
cec4d0889b now prevents option override 2015-04-29 10:51:15 -04:00
cdefeb6d84 refactored most binaries
added AnsibleOptionsError
removed pulicate parser error class
2015-04-29 10:51:15 -04:00
900b992ba9 fixed var name for ansible vault editing existing data 2015-04-29 10:51:15 -04:00
950aa8511a no exceptions with less than 3 'v's 2015-04-29 10:51:15 -04:00
75b969e2d7 initial galaxy port to v2 2015-04-29 10:51:15 -04:00
9898522a00 now all cli use display.error 2015-04-29 10:51:15 -04:00
14fb4383f3 now uses display.error 2015-04-29 10:51:15 -04:00
522c3feab9 made error color red from bright red 2015-04-29 10:51:15 -04:00
532aefc2c8 verbose is only to screen 2015-04-29 10:51:15 -04:00
1ff83b43ae added error 2015-04-29 10:51:15 -04:00
a346507b26 added os_server_facts to changelog 2015-04-29 10:51:15 -04:00
b08e35bb8a Fixing tag logic in v2 2015-04-29 09:47:11 -05:00
288fe1179a Add lineinfile integration tests for quoted string
Reference #10864
2015-04-29 19:50:59 +08:00
4bb37b82c4 Fix duplicate callback issue in v2
All v2+ callbacks can now optionally define a CALLBACK_TYPE, which
when set to 'stdout' will limit those callbacks which are used for
primary output to a single callback plugin (specified to the
TaskQueueManager object and configurable in ansible.cfg/environment)
2015-04-29 01:09:27 -05:00
cf3f7b0043 Correct minor grammar error in Playbook intro docs
Signed-off-by: Daniel Farrell <dfarrell@redhat.com>
2015-04-28 18:24:01 -04:00
3846528366 clarify role spec, dependencies and galaxy involvment.
fixes #10832
2015-04-28 16:38:53 -04:00
dc12669c40 Another test case for testing splitter parsing 2015-04-28 11:44:55 -07:00
84fe6655d1 Fixing option order in connection info (v2) 2015-04-28 13:26:21 -05:00
2bf95aaa2d fixed default become user to be 'root' 2015-04-28 14:19:26 -04:00
47c3d75c3c Add test for https://github.com/ansible/ansible/issues/9851 2015-04-28 14:17:53 -04:00
8b620640b0 Update extras submodule refs to pick up docs fixes 2015-04-28 11:13:29 -07:00
39650efc38 Fix title underline for rst 2015-04-28 11:11:49 -07:00
223c2a2721 Update submodules 2015-04-28 10:44:43 -07:00
50da8812d6 Fix up connection plugin test for new_stdin parameter 2015-04-28 10:39:30 -07:00
bf003d31e0 Not a full port to v2's api, just a few fixups 2015-04-28 10:39:30 -07:00
1bf5224f82 Enable writing plugins for jinja2 tests 2015-04-28 09:32:11 -06:00
6a8062baad accidentally 'fixes' ubuntu distribution parsing, this order should not matter, need followup to figure out why this is the case 2015-04-28 10:16:14 -04:00
cfbfd38723 just a few spelling error changes 2015-04-28 09:36:42 -04:00
d9633037d5 cloudstack: update copyright in dynamic inventory 2015-04-28 09:20:54 +02:00
9e5a16703b cloudstack: add check for empty inventory 2015-04-28 09:20:54 +02:00
bfa71054f5 Fix an issue when the cloudstack installation don't have any instance group 2015-04-28 09:20:54 +02:00
92a25b340b cloudstack: add dynamic inventory
Signed-off-by: René Moser <mail@renemoser.net>
2015-04-28 09:20:54 +02:00
4205d74b11 Merge pull request #10835 from logston/update-ec2.py
Make ec2 inventory plugin Python 3 compatible
2015-04-27 20:17:35 -04:00
3879550e74 Finish backporting of smart transport selection from v1 into v2 2015-04-27 14:43:25 -05:00
6eba0d173d Revert shebang change added in v2 bin/ scripts 2015-04-27 13:57:26 -05:00
ed86e1bd7e Merge pull request #10842 from tylerharper/patch-1
update --ansible-private-keyfile to --private-key in documentation
2015-04-27 13:34:22 -04:00
29201c0dea Applying 499081490 fix for rax.py to v2 2015-04-27 11:59:11 -05:00
313d01736a Applying cfd05ceaf fix for rax.py to v2 2015-04-27 11:57:36 -05:00
93cc08e613 Applying bf916fb5 fix to v2 2015-04-27 11:55:14 -05:00
805e83d209 Updating module_utils/facts.py in v2 with v1 version 2015-04-27 11:50:51 -05:00
8d174e7044 Updating module_utils/ec2.py in v2 with version from v1 2015-04-27 11:37:49 -05:00
49bf70ed94 Moving new module_utils/cloudstack.py to v2 2015-04-27 11:31:17 -05:00
55cf641b4b Applying backup_local fixes to v2 2015-04-27 11:31:17 -05:00
582259f98b Applying c9fb97cc8 (permissions on symlink fix) to v2 2015-04-27 11:31:17 -05:00
0303d9ce49 added new consul modules to changelog 2015-04-27 12:20:17 -04:00
5034a2c702 Use six to import urlparse 2015-04-27 08:50:04 -07:00
ed2e6fc8fa Restore python3 fixups 2015-04-27 08:46:26 -07:00
8007829228 Enable warnings for python3 on scripts shebangs. 2015-04-27 08:34:16 -07:00
af2dff9cfb Restore the python3-compat import __future__ and Exception as update. 2015-04-27 08:33:29 -07:00
ee32403467 change --ansible-private-keyfile to --private-key
An old command line option was left in the documentation.
2015-04-27 11:16:56 -04:00
3aede800c5 Fixing winrm connection for v2 2015-04-27 00:28:43 -05:00
2f255f5b96 cloudstack: get_vm(): fix missing zone
Fixes returning wrong VM having identical name in different zone.
2015-04-26 23:09:33 +02:00
e8768b2b87 Use six to check for string_types 2015-04-25 19:45:22 -04:00
50932ce556 Use six.moves to import configparser 2015-04-25 17:06:01 -04:00
ca88189bf7 cloudstack: add method to to get infos of API
get_capabilities() allows you to get infos e.g. `cloudstackversion`
to compare functionality of the API in your modules.
2015-04-25 18:32:02 +02:00
1674b47445 Make ec2 inventory plugin Python 3 compatible 2015-04-24 21:14:06 -04:00
946c37fd88 Merge pull request #10612 from sivel/sync-ssh-args
Add ability to specify using ssh_args in synchronize
2015-04-24 17:02:18 -04:00
3c0e406f5d cloudstack: fix missing self. in cloudstack utils 2015-04-24 20:25:19 +02:00
6354ca0718 cloudstack: add _has_changed() to utils
Generic method to compare values in dict.
2015-04-24 19:16:42 +02:00
765c8fe368 cloudstack: use _get_by_key in get_...() methods in utils
But also add backward compatibility for existing modules in extras.
2015-04-24 19:09:49 +02:00
88540d3cdc cloudstack: add _get_by_key() to utils
Generic method to get the whole dict or just a singe value by key if found.
2015-04-24 19:06:33 +02:00
31520cdd17 cloudstack: fix other projects not found 2015-04-24 18:58:57 +02:00
8574d40b98 Initial work to make paramiko connections work under v2 2015-04-24 02:47:56 -04:00
8c08f1b302 Updating connection plugins not yet updated in v2 to catch new code 2015-04-23 18:54:48 -05:00
716a87ff36 Merge pull request #10142 from bcoca/v2_retry_files_config
v2 added retry configs, pending is actual functionality to make it conditional
2015-04-23 11:45:48 -05:00
c11e7184da Merge pull request #10812 from jcpowermac/fix_vmware_util_module
Fixes VMware module utils
2015-04-22 15:08:57 -04:00
87bc705806 Fixes VMware module utils
Resolves syntax errors in the `wait_for_tasks`
Removes throw from `find_datacenter_by_name`
2015-04-22 14:54:05 -04:00
b5127c3442 added new vmware_datacenter module to changelog 2015-04-22 10:21:17 -04:00
a1ddeaebe9 Merge pull request #10760 from jcpowermac/add_vmware_module_utils
Adding a new VMware utilities module
2015-04-21 20:41:51 -04:00
8161dab60a added notes about privilege escalation limitations 2015-04-21 15:32:35 -04:00
9f54276fdd changed formating to rst lists 2015-04-21 15:27:09 -04:00
5ff9859c9b added new cloudstabck modules to changelog 2015-04-21 15:25:41 -04:00
cd95f39957 Merge pull request #10807 from Aclima/fix/playbooks_vault_emphasis
Correct emphasis markup nit in playbooks_vault.rst
2015-04-21 14:55:06 -04:00
c5e9a87e74 Correct emphasis markup nit in playbooks_vault.rst
It looks like the original intention was to italicize, but someone was used to another markup language. I have switched the wrapped tags so we're showing italics and not a broken link.
2015-04-21 11:11:57 -07:00
3130fe2939 Merge pull request #10806 from hnakamur/add_python_2.7_to_control_machine_requirements
Add Python 2.7 to Conrol Machine Requirements in docsite
2015-04-21 14:08:12 -04:00
f0158d4eed Add Python 2.7 to Conrol Machine Requirements in docsite 2015-04-22 02:57:26 +09:00
6935d467eb Add tests for yum module taking lists of packages in various formats 2015-04-21 10:09:19 -07:00
7669a0b275 Fixing some v2 bugs 2015-04-21 12:02:40 -05:00
d996a2c216 ported fix from v1 to v2 on oracle linux family detection 2015-04-21 11:48:43 -04:00
501f372d75 Merge pull request #10800 from resmo/fix/update-changelog
changelog: update cloudstack module names
2015-04-21 11:10:28 -04:00
c58aaf72fc Properly handle lack of stdout in results in v2
Fixes #10549
2015-04-21 09:48:56 -05:00
351591fb80 Merge pull request #10802 from pahaz/patch-2
Python 3 compatible `except` statment
2015-04-21 10:15:59 -04:00
bc47fe6f82 Python 3 compatible except statment 2015-04-21 19:13:11 +05:00
db3eaef833 Merge pull request #10798 from hver/patch-1
Fixed links
2015-04-21 09:34:29 -04:00
9b317858c1 Modified per @bcoca
Removed try/except raises
Modified wait_for_task
Added api exception error message
2015-04-21 08:33:32 -04:00
14637c6c7e changelog: update cloudstack module names 2015-04-21 14:13:58 +02:00
da3780908a Fixed links 2015-04-21 11:32:10 +02:00
2a59f27db4 Merge pull request #10789 from mavit/oracle_linux_os_family
Consistently use "OracleLinux" in OS detection.
2015-04-20 18:50:57 -04:00
a4da082d05 Merge pull request #10793 from mekstrem/patch-1
Correct minor spelling typos.
i swear i spellchecked!
2015-04-20 18:23:04 -04:00
1d966ac5bb Correct minor spelling typos. 2015-04-21 00:13:52 +02:00
ff6c654847 Merge pull request #10787 from jlaska/fix_gce_pycrypto26
Fix traceback with using GCE on EL6 with python-crypto2.6
2015-04-20 15:47:13 -04:00
3db5d8199d Merge pull request #10788 from bcoca/become_intro_docs
updated intro to new become syntax, also added link to full become docs
2015-04-20 13:49:40 -04:00
d22898f702 changed vaulteditor import to new path, now vault seems to work 2015-04-20 13:42:24 -04:00
56deb35e67 updated intro to new become syntax, also added link to full become docs 2015-04-20 13:31:36 -04:00
1359bbee87 Fix traceback with using GCE on EL6 with python-crypto2.6
This fix resolves an issue on EL6 systems where there may be multiple versions
of pycrypto installed.  EPEL provides both `python-crypto` and
`python-crypto2.6`.  These packages are co-installable.  However, modules
importing the `Crypto` library must specify which version to use, otherwise the
default will be used.

This change follows the same pattern established in `bin/ansible` for
specifying python library requirements.
2015-04-20 12:49:25 -04:00
d600c65095 Fix fetch action plugin in v2 to use the inventory_hostname in the dest dir
Fixes #10736
2015-04-20 11:16:35 -05:00
cef93db0a7 Merge pull request #10754 from invenia/devel
Python 2/3 compatibility fixes to parsing in v2.
2015-04-20 11:00:35 -04:00
6a35463e9c added note for new find module 2015-04-20 10:53:03 -04:00
822c2c0cd3 cloudstack: fix vm not found by displayname 2015-04-20 09:40:49 -05:00
0a26b149fc cloudstack: add error result handling in async job 2015-04-20 09:40:49 -05:00
f5b00084e1 Merge pull request #10777 from romain-dartigues/plugins_undefined_names
Undefined names found by pyflakes in plugins/inventory/
2015-04-19 23:43:32 -04:00
1046a396ae fixed typo 2015-04-19 23:34:07 -04:00
6d68d66d3c 1st draft port to v2 2015-04-19 23:32:07 -04:00
e38eb2589a Undefined names found by pyflakes 2015-04-19 18:18:52 +02:00
d8be6fec65 Consistently use "OracleLinux" in OS detection.
Previously, a mixture of "OracleLinux" and "Oracle Linux" was used,
causing the `ansible_os_family` fact not to be set to `RedHat`.

Fixes #10742.
2015-04-19 17:00:35 +01:00
d590dc35e7 Merge pull request #10769 from mscherer/add_requires_v2
Add a requires on python-six 1.4.0 ( for add_metaclass )
2015-04-19 01:17:48 -04:00
7dd0858cb7 Merge pull request #10770 from mscherer/fix_ssh_connection_v2
Fix C.ANSIBLE_SSH_CONTROL_PATH string interpolation
2015-04-19 01:17:15 -04:00
cd25e0fba0 Fix C.ANSIBLE_SSH_CONTROL_PATH string interpolation
Since C.ANSIBLE_SSH_CONTROL_PATH use the old format
( "%{directory}" ), we need to use the % operator
and not the format method, at least for python 2.
2015-04-19 00:06:50 -04:00
8ffe895638 Merge pull request #10768 from mscherer/port_some_change_to_v2
Port some changes that occured on v1 get_facts modules to v2
2015-04-18 23:27:13 -04:00
873fd7db56 Add a requires on python-six 1.4.0 ( for add_metaclass )
This also mean that this doesn't run on RHEL 7 as of today.
2015-04-18 23:13:32 -04:00
5d446bbd5b Merge pull request #10767 from sivel/issue/10763
Correct the ternary example. Fixes #10763
2015-04-18 22:48:44 -04:00
2a6a01e122 Port some changes that occured on v1 get_facts modules to v2
- 5c64956a7 Set distribution, release, and version for NetBSD
- ec01e071d adjusted for the possibility of lsblk not existing
  for fact gathering
- d4eddabb2 Patch for bug #10485 - ansible_distribution fact
  populates as 'RedHat' on Oracle Linux systems
- 7813ffd71 Adding uptime_seconds fact for linux and darwin platforms
- 29cca0191 Adding oVirt recognition for oVirt guests.
- d0197195e Handle /etc/os-release files with 'Raspbian' in them
- 58a5f8dfa Pulls machine id in ansible facts
- 1968f9969 Wrong OS_FAMILY declaration for openSUSE
- 5dec45e24 Fix wrong distribution facts on SLES/openSUSE

and a few others
2015-04-18 22:46:36 -04:00
eae6005a89 Merge pull request #10762 from kevgathuku/patch-1
[Docs] Make shell quoting rules explanation a bit clearer
2015-04-18 22:17:27 -04:00
d34e7d7bca Correct the ternary example. Fixes #10763 2015-04-18 16:05:35 -05:00
5913227d9f Make shell quoting rules explanation a bit clearer
I personally got confused by the use of 'vs' in the explanation.
Maybe this explains it better?
2015-04-18 12:47:02 +03:00
986910be5d Adding a new VMware utilities module 2015-04-17 14:48:57 -04:00
f4172fb9da Fix tag handling on meta:flush_handlers tasks
Fixes #10758
2015-04-17 13:02:09 -05:00
65be14e8b4 Merge pull request #10757 from jeffrizzo/netbsd_facts
Set distribution, release, and version for NetBSD.
2015-04-17 13:51:45 -04:00
2e9c028c6c Merge pull request #10747 from bcoca/fix_lsblk_missing
adjusted for the posibolity of lsblk not existing for fact gathering
2015-04-17 11:12:29 -04:00
5c64956a7e Set distribution, release, and version for NetBSD. 2015-04-16 16:43:38 -07:00
3e25f633fe Applied some stashed fixes.
* Fixed file.close() typo in test_vault_editor
 * Updated unicode.py to redefine basestring properly in python3 and fixed a couple missed py27 specific code.
 * Realized the patch in test_data_loader was still failing cause we are passing the string 'builtins.open' and not actually using it in that file and soe instead of failing in py34 it would fail in py27.
2015-04-16 17:20:46 -04:00
f3fed01a7e Attempted to updated the vault editor to support 2/3 compatibility.
Unfortunately, I wasn't able to fix a bug in the VaultAES in which during
the test_decrypt_1_0 and test_rekey_migration in which VaultAES wasn't successfully
writing the writing the encrypted key to out_file (BytesIO).

Added skipping vault_editor tests test_decrypt_1_0 and test_rekey_migration in python3
since I wasn't able to successfully backport VaultAES without weird bugs.
2015-04-16 16:01:21 -04:00
43ab4c12dd Fixed NoneType import error which worked in python2, but not 3.
In mod_args we were checking `isinstance(thing, NoneType)` when
thing is None works the same since NoneType can't be subclassed in
python 2 or 3 and it removes the need for the NoneType import.
2015-04-16 16:01:21 -04:00
176ae06cbd Updated the vault/__init__.py and test_vault.py files to support 2/3.
Existing tests pass under both versions, but there could still be some issues
since, it involves a lot of 2/3 bytes-unicode conversions.
2015-04-16 16:01:21 -04:00
28443cf0a9 Updated parsing/vault/test_vault.py to use the fake byte literals in six when using hexlify.
This was to fix the `TypeError: 'str' does not support the buffer interface` errors.
2015-04-16 16:01:21 -04:00
f8fe1357b0 Updated the utils/unicode.py file with 2/3 compatibility.
NOTES:
  1. replaced unicode, str, etc with their six counterparts
  2. isinstance(obj, basestring) -> isinstance(obj, (string_types, text_type))
  3. I'm not entirely confident about the behaviour of __str__ and __unicode__ between versions
     so that might require a bit more testing.
2015-04-16 16:01:21 -04:00
1e139fe08f Updated the test_data_loader to use six.builtins vs __builtins__ 2015-04-16 16:01:21 -04:00
77cd7a6e89 Fixed 2/3 compatibility issues in parsing/yaml/test_loader with six. 2015-04-16 16:01:20 -04:00
7e9292c755 Updated parsing/yaml/objects.py with 2/3 compatibility. 2015-04-16 16:01:20 -04:00
fa1eff8356 added new ec2_ami_find and deprecated ec2_ami_search 2015-04-16 15:42:55 -04:00
a0c34da779 Support querying systemd container information
systemd writes a /run/systemd/container file in any container it starts
to make it really easy to detect the container type. This adds support
for detecting systemd-nspawn containers (and any other container format
that will write data there for compatibility).
2015-04-16 14:27:50 -04:00
3075a4db25 Merge pull request #10734 from ralphbean/devel
Remove check of hardcoded AWS region list.
2015-04-16 11:06:16 -07:00
b9a3e969c7 Merge pull request #10750 from mscherer/fix_coreos_facts
Add CoreOS facts detection, fix https://github.com/ansible/ansible-modul...
2015-04-16 11:02:05 -07:00
21a2a8bc94 Merge pull request #10744 from bcoca/v2_base_consolidation
made certain flags part of base to make them universally settable
2015-04-16 13:19:05 -04:00
b4f02625cd Add CoreOS facts detection, fix https://github.com/ansible/ansible-modules-core/issues/1000 2015-04-16 13:04:23 -04:00
c4ede91b32 Merge pull request #10749 from phips/update_become_docs
Fixed a few typos in the become documentation
2015-04-16 12:32:17 -04:00
77afdd16b0 Fixed a few typos in the become documentation 2015-04-16 17:30:54 +01:00
ec01e071d8 adjusted for the posibolity of lsblk not existing for fact gathering 2015-04-16 11:57:51 -04:00
f478f1ec10 fixed vars in block now that they are a field atribute also 2015-04-16 11:13:21 -04:00
2ad787038f removed vars from block as its now in base 2015-04-16 10:26:18 -04:00
92c8275f94 made certain flags part of base to make them universally settable 2015-04-16 08:36:59 -04:00
7e1644bffd Add smoketest unittests for the connection plugins 2015-04-15 16:33:57 -07:00
01df51d2ae Improve the API for connection plugins and update local and ssh to use it 2015-04-15 16:32:44 -07:00
1f7d23fc18 Fix call to skipUnless by adding a reason 2015-04-15 15:57:13 -07:00
b4fa438927 Merge pull request #10737 from ansible/v2-optional-test-reqs
Make some of the optional requirements optional for testing -- we'll skip the tests instead
2015-04-15 15:38:21 -07:00
0be531db71 Make some of the optional requirements optional for testing -- we'll skip the tests instead 2015-04-15 15:35:21 -07:00
4903bca0c1 Remove check of hardcoded AWS region list.
You can extend boto to point at other regions that are defined in a
private cloud by defining ``BOTO_ENDPOINTS`` or ``endpoints_path`` in
the ``~/.boto`` file.

Ansible was doing a premature check against a hard-coded list of regions
that interrupted this possibility.  This commit removes that and
clarifies what the user can do if they specify a non-AWS region.
2015-04-15 17:55:27 -04:00
abb93d9115 Merge pull request #10732 from mscherer/prefer_dnf_to_yum
Prefer dnf to yum.
2015-04-15 16:27:19 -04:00
f624ec4cb8 Prefer dnf to yum.
On Fedora 22 and later, yum is deprecated and dnf is installed by
default. However, the detection do not seems to take this in account,
and always use yum, even when yum cli is just a wrapper to tell "use
dnf", as this is the case on F22 and later ( see package dnf-yum ).

As dnf is not installed by default, except on F22, this shouldn't
break anything.
2015-04-15 16:11:08 -04:00
309bbda5c4 Merge pull request #10574 from joefis/patch-1
Vagrant inventory: exit 0 on success
2015-04-15 15:33:16 -04:00
055d14449b Merge pull request #10729 from mchlumsky/plugins_cache_abc
Use abc for BaseCacheModule
2015-04-15 11:34:35 -07:00
45247eb4b3 Use abc for BaseCacheModule 2015-04-15 13:09:59 -04:00
a0def30c34 Add integration test for unarchive filelist feature 2015-04-15 09:28:50 -07:00
7462e7e110 Merge pull request #10718 from mscherer/remove_deadcode
Remove old dead code ( variable no longer exist, not used )
2015-04-15 09:19:30 -07:00
baad0a62f9 Merge pull request #10723 from mscherer/fix_errors_playbook
Fix errors reporting for playbook/*
2015-04-15 09:16:30 -07:00
3f03f76f97 Merge pull request #10722 from mscherer/fix_wrong_exception
Do add a unused named argument using a variable that was removed
2015-04-15 09:15:56 -07:00
1afd24ae9f Merge pull request #10721 from mscherer/fix_role_metadata
Fix serialize function by using the right members name
2015-04-15 09:15:05 -07:00
1aff837ab8 Merge pull request #10720 from mscherer/fix_roles_requirements
Fix variable name
2015-04-15 09:14:15 -07:00
a6592ba0f9 updated banners as per marketing's request 2015-04-15 11:49:46 -04:00
791dbd7661 Update extras module ref on v2 2015-04-15 05:15:30 -07:00
aab681bc2b Update core and extras module refs and add tests for an unarchive
problem that the update fixes:

https://github.com/ansible/ansible-modules-core/issues/1064
2015-04-15 05:14:20 -07:00
02e7385002 Filter tasks based on tags during iterator setup in v2 2015-04-15 01:17:02 -05:00
96a7d85b61 Adding more magic variables for connection info to v2 2015-04-15 01:17:02 -05:00
b20d54520c Fix errors reporting for playbook/* 2015-04-15 01:06:02 -04:00
b43ede1eb4 Do add a unused named argument using a variable that was removed
Found by pylint.
2015-04-15 01:03:31 -04:00
72cf11f8e1 Fix serialize function by using the right members name 2015-04-15 00:59:39 -04:00
5aa56245d5 Fix variable name
There is no 'role' variable, and given the test and code after, that's
likely a test on 'ds'
2015-04-15 00:58:11 -04:00
460dc5e4db Fix errors import 2015-04-14 19:56:17 -07:00
719d01067e Use six to assign metaclass for py2 and py3 compat 2015-04-14 19:43:23 -07:00
c0f6712a37 Merge pull request #10719 from mscherer/fix_error_action_v2
Fix the filename in error message (pylint)
2015-04-14 19:22:19 -07:00
61379a609b Merge pull request #10717 from mscherer/fix_connexion_info
Fix various pylint issues ( missing import and wrong variable names )
2015-04-14 19:19:23 -07:00
9097274fe0 Fixing minimal callback for v2 to use the new api 2015-04-14 21:11:12 -05:00
dd1c14a0c7 Adding a method for setting up magic variables from connection info in v2 2015-04-14 21:11:12 -05:00
0fb4520d7a Merge pull request #10716 from mscherer/fix_export
Fix the name of the exported class ( pylint )
2015-04-14 18:59:38 -07:00
2d9097e025 Fix the filename in error message (pylint) 2015-04-14 19:13:27 -04:00
6dcc883ac9 Remove old dead code ( variable no longer exist, not used ) 2015-04-14 19:07:57 -04:00
1acd56a9aa Fix various pylint issues ( missing import and wrong variable names ) 2015-04-14 19:04:08 -04:00
07c3107cfe Fix the name of the exported class ( pylint ) 2015-04-14 19:03:18 -04:00
dfce750fe6 Merge pull request #10701 from bcoca/delegate_to_fix_indent
fixed indent when looking at delegate_to vars
2015-04-14 18:56:34 -04:00
0da7834584 Move command for v1 back into testenv so that we have a default
(We have a jenkins build that creates a [testenv:jenkins] so it needs
there to be a default value
2015-04-14 15:46:25 -07:00
b4437ebd9a Merge pull request #10713 from mscherer/fix_shell_plugin_import_v2
Rename the import, since the directory was renamed for v2
2015-04-14 15:17:55 -07:00
8134ffeb1f Merge pull request #10712 from mscherer/fix_v2_sh_plugin
Add missing imports. They are used later in mkdtmp, needed by action plu...
2015-04-14 15:17:19 -07:00
67e59c5429 Merge pull request #10715 from mscherer/fix_import_errors_lookup_plugin
Add/correct missing imports for AnsibleError in v2 lookup plugins
2015-04-14 15:16:10 -07:00
570f9db6bf Add/correct missing imports for AnsibleError in v2 lookup plugins 2015-04-14 17:42:57 -04:00
674d1e72f6 Rename the import, since the directory was renamed for v2 2015-04-14 17:05:02 -04:00
f25f2d9626 Merge pull request #10711 from mscherer/fix_wrong_name_parsererror
Fix the exception name ( AnsibleParserError, not AnsibleParsingError )
2015-04-14 13:57:05 -07:00
c0c115317a Add missing imports. They are used later in mkdtmp, needed by action plugins 2015-04-14 16:56:35 -04:00
2319328f14 Merge pull request #10710 from invenia/devel
Updated the tox.ini file to run multiple ansible versions.
2015-04-14 13:56:31 -07:00
12bd0e7a6b Merge pull request #10709 from mscherer/fix_missing_builtin
Add a import for 'builtins' module, used in CleansingNodeVisitor.
2015-04-14 13:55:10 -07:00
0c74b356d2 Add a import for 'builtins' module, used in CleansingNodeVisitor.
This was previously done by ./lib/ansible/utils/__init__.py, but
this code is no longer here in v2 anymore. And since the module
got renamed in python3 to builtins ( https://docs.python.org/3/library/builtins.html ),
we have to use six.
2015-04-14 16:47:58 -04:00
37b4b68e83 Use six.moves to find configparser instead of our compat code 2015-04-14 13:40:50 -07:00
996bd05823 Revert "Rather than moving connection option setting, fix defaults"
This reverts commit 0345b675f8.
2015-04-14 13:40:50 -07:00
1566a90fcd Fix the exception name ( AnsibleParserError, not AnsibleParsingError ) 2015-04-14 16:36:39 -04:00
131ce117a9 Updated the tox.ini file to run multiple ansible versions.
Purpose: so that devs can use tox to run v1 or v2 of ansible with various versions of python.
For example `tox -e py27-v2 will run python2.7 on v2. Currently, only py26 and py27 are run on v1 when
running just `tox` so that we aren't breaking builds.
2015-04-14 16:30:52 -04:00
53177a9bd9 Merge pull request #10708 from mscherer/fix_hashing_error
Missing import for ansible.errors (pylint)
2015-04-14 16:15:16 -04:00
65f6f76323 Missing import for ansible.errors (pylint) 2015-04-14 16:13:33 -04:00
76eef1a48f Merge pull request #10704 from mscherer/fix_wrong_var_v2
Do not import all ansible errors and fix the exception raised
2015-04-14 13:12:20 -07:00
566399422f Merge pull request #10707 from mscherer/fix_deprecation_warning
Pylint warning, the method _warning is called warning
2015-04-14 16:11:56 -04:00
cec42eac47 Merge pull request #10706 from mscherer/fix_deprecate_v2
Pylint show a error "no deprecations variable"
2015-04-14 16:11:24 -04:00
de57459dd4 Pylint warning, the method _warning is called warning 2015-04-14 16:10:19 -04:00
f641b91594 Pylint show a error "no deprecations variable" 2015-04-14 16:03:54 -04:00
79e8e26412 Merge pull request #10705 from mscherer/add_another_missing_error
Add another error, who seems to be all over the place
2015-04-14 16:02:40 -04:00
28f51233c8 Add another error, who seems to be all over the place 2015-04-14 15:50:31 -04:00
6957d66a26 Do not import all ansible errors and fix the exception raised 2015-04-14 15:43:02 -04:00
b69f57d8a4 Merge pull request #10703 from mscherer/fix_missing_errors_v2
Add back AnsibleFileNotFound ( used in connection plugins )
2015-04-14 12:40:35 -07:00
46beaf8a47 Submodule update 2015-04-14 14:38:56 -05:00
8592ffb573 Add back AnsibleFileNotFound ( used in connection plugins ) 2015-04-14 15:23:59 -04:00
8d871f9650 Merge pull request #7444 from carsongee/cg/nova_inventory_improvements
Improvements to OpenStack inventory script
2015-04-14 14:59:41 -04:00
09efba2a7c fixed indent when looking at delegate_to vars 2015-04-14 14:41:31 -04:00
0345b675f8 Rather than moving connection option setting, fix defaults
This reverts the previous commit (d71834d) and instead fixes the problem
by making sure that options used by ConnectionInformation do not have
defaults set in the playbook objects so they're properly inherited from
the CLI options object if not otherwise specified in the play
2015-04-14 12:06:19 -05:00
d5a7cd0efc bad hack to maybe fix some corner cases with pbrun custom prompts 2015-04-14 12:44:28 -04:00
d71834d1d2 Moving setting of options values to after play again
Moving this above the play setting means that any default values set
in play (like connection) override any corresponding CLI option, which
is wrong. Generally CLI options should override things set in playbooks
2015-04-14 10:56:10 -05:00
ed601f964d Merge pull request #10683 from timsutton/remove-old-git-integration-test
Git integration test: remove test for ambiguous .git/branches dir
2015-04-13 15:14:32 -07:00
c14f072a3b Merge pull request #10693 from momandine/import_fixes
Import fixes
2015-04-13 14:39:01 -07:00
164cfdfda4 Fix typo 2015-04-13 14:28:00 -07:00
c486b6773a Merge pull request #10692 from ianzd/python3
Import queue from six.moves for python3 compatibility.
2015-04-13 14:26:40 -07:00
08feaea077 Fix plugin imports with six 2015-04-13 14:04:31 -07:00
6e12117b04 Import queue from six.moves for python3 compatibility. 2015-04-13 17:01:00 -04:00
4b889bbe3d Add six to the v2 test-requirements 2015-04-13 13:43:25 -07:00
056f646bda Merge pull request #10681 from dorianpula/test_requirements_for_v2
Add test requirements for working with v2.
2015-04-13 13:42:23 -07:00
bd4c30b807 Merge remote-tracking branch 'upstream/devel' into devel 2015-04-13 13:40:44 -07:00
7133d6361f Merge pull request #10691 from ianzd/python3
Change how we're calling StringIO
2015-04-13 13:36:22 -07:00
5dce745868 Merge pull request #10690 from momandine/print_function
Print function
2015-04-13 13:35:04 -07:00
d85f97ccfd Change how we're calling StringIO since we're now importing the class rather than a module. 2015-04-13 16:31:16 -04:00
683c2913c5 Use print function 2015-04-13 13:28:27 -07:00
3d2a056ad4 Import futures including print 2015-04-13 13:28:01 -07:00
b0479c425b Merge pull request #10688 from ianzd/devel
Import StringIO from six in a couple more places.
2015-04-13 13:05:36 -07:00
ian
3bb7b0eef3 Import StringIO from six in a couple more places. 2015-04-13 16:03:02 -04:00
3a8088fe30 _available_vars in v1 == _available_variables in v2 2015-04-13 12:58:21 -07:00
4bbca9211a Merge pull request #10687 from ianzd/devel
Several more changes to support python3 syntax.
2015-04-13 12:42:57 -07:00
483c8d338f Merge pull request #10684 from eroldan/patch-1
Fixed wrong example of 'environment' for setting PATH
2015-04-13 15:38:52 -04:00
ian
1bdf0bb0d6 Several more changes to suport python3 syntax. 2015-04-13 15:37:25 -04:00
87dde862bd Fixed wrong example of 'environment' for setting PATH 2015-04-13 16:21:08 -03:00
3504f1cad9 Add test requirements for working with v2. 2015-04-13 13:44:58 -04:00
5f1ba589a5 Git integration test: remove test for ambiguous .git/branches dir
- '.git/branches' does not always exist, but the git integration
  tests always checks for this directory's existence so it always
  fails
- more info:
  - http://stackoverflow.com/questions/10398225/what-is-the-git-branches-folder-used-for
2015-04-13 13:38:11 -04:00
bad554d517 Merge pull request #9268 from kustodian/docs_advance_conditions
Added an example for paretheses
2015-04-13 10:13:41 -07:00
a444a7f363 Merge pull request #10680 from ianzd/devel
Change exceptions to python3 syntax.
2015-04-13 09:43:02 -07:00
5f03638d2c Merge pull request #10679 from dorianpula/setup_py_for_v2
Add setup.py for v2 to allow for pip editable installs.
2015-04-13 09:35:56 -07:00
b407dd8b58 Add setup.py for v2 to allow for pip editable installs. 2015-04-13 13:34:48 -04:00
ian
6747f82547 Change exceptions to python3 syntax. 2015-04-13 12:35:20 -04:00
557cd15c25 Merge pull request #10677 from dorianpula/fix_re_import_test_failure
Fix re import failure in templates module when running unit tests.
2015-04-13 09:23:06 -07:00
b193d327b6 Fix re import failure in templates module when running unit tests. 2015-04-13 12:17:07 -04:00
1121928f50 Merge pull request #10318 from dmahler/devel
Some grammatical updates
2015-04-13 08:43:31 -07:00
62c08d96e5 fixed another typo 2015-04-13 10:58:17 -04:00
89cc54cc16 typo fix 2015-04-13 10:50:24 -04:00
b509de6c84 Merge pull request #10643 from bcoca/aix_facts_fix
fix for when calling bootinfo throws permmission errors (AIX)
2015-04-13 10:22:38 -04:00
67512aeeb6 Merge pull request #10618 from jder/force-handlers
Fix --force-handlers, and allow it in plays and ansible.cfg
2015-04-13 10:16:45 -04:00
224fd0adfe added fleetctl entry for new inventory script to changelog 2015-04-13 10:10:32 -04:00
af960fe8d5 Merge pull request #9624 from andrewrothstein/devel
an ansible inventory garnered from fleetctl
2015-04-13 10:06:27 -04:00
080b395d9f Merge pull request #10676 from radarhere/patch-1
Fixed changelog typos
2015-04-13 09:49:33 -04:00
e6b7b9206d Fixed changelog typos 2015-04-13 23:45:09 +10:00
de52cfb5d7 Merge pull request #10465 from feanil/feanil/fix_templates_for_ints_bools
Don't convert numbers and booleans to strings.
2015-04-11 09:08:24 -07:00
0abcebf1e4 Don't convert numbers and booleans to strings.
Before this change if a variable was of type int or bool and the variable was referenced
by another variable, the type would change to string.

eg. defaults/main.yml
```
PORT: 4567
OTHER_CONFIG:
  secret1: "so_secret"
  secret2: "even_more_secret"

CONFIG:
  hostname: "some_hostname"
  port: "{{ PORT }}"
  secrets: "{{ OTHER_CONFIG }}"
```

If you output `CONFIG` to json or yaml, the port would get represented in the output as a
string instead of as a number, but secrets would get represented as a dictionary.  This is
a mis-match in behaviour where some "types" are retained and others are not.  This change
should fix the issue.

Update template test to also test var retainment.

Make the template changes in v2.
Update to only short-circuit for booleans and numbers.

Added an entry to the changelog.
2015-04-11 12:03:42 -04:00
a6084f9fd8 Merge pull request #9222 from cchurch/win_user_tests
Tests for win_user module
2015-04-11 02:11:32 -04:00
42bd640d14 Update win_user tests to set a group on user creation. 2015-04-11 01:55:56 -04:00
56f4bf44f5 Add integration tests for win_user module. 2015-04-11 01:55:56 -04:00
652cd6cd5e Fix --force-handlers, and allow it in plays and ansible.cfg
The --force-handlers command line argument was not correctly running
handlers on hosts which had tasks that later failed. This corrects that,
and also allows you to specify force_handlers in ansible.cfg or in a
play.
2015-04-10 19:38:59 -04:00
e6fa169a05 Merge pull request #10629 from bcoca/backup_local_exists
backup_local now only tries to back up exising files, returns '' otherwise
2015-04-10 19:12:48 -04:00
2af6314f57 Comment to clarify why we add one to the line and column recording 2015-04-10 04:09:50 -07:00
79f9fbd50e Reverse the error messages from jsonfile get and set 2015-04-10 04:09:50 -07:00
c225290436 Merge pull request #10665 from cchurch/doc_updates_for_winrm_fixes
Update windows documentation to indicate how to specify kerberos auth.
2015-04-09 16:00:27 -04:00
944690118f Update windows documentation to indicate how to specify kerberos vs. basic auth. 2015-04-09 15:51:43 -04:00
a90bb89b93 Merge pull request #10664 from cchurch/winrm_fixes
WinRM Connection Fixes
2015-04-09 15:32:05 -04:00
7ba2950c5a Remove winrm connection cache (only useful when running against one host). Also fixes #10391. 2015-04-09 13:45:21 -04:00
5675982b0f Only try kerberos auth when username contains @ and pass realm to pywinrm. Alternative to #10644, fixes #10577. 2015-04-09 13:37:11 -04:00
c75baaa140 Merge pull request #10630 from viesti/viesti-master
Use codecs module while reading & writing json cache file
2015-04-09 10:36:43 -07:00
7f034a74d1 Add -ExecutionPolicy Unrestricted back, was removed by #9602. 2015-04-09 13:29:38 -04:00
fe2cc6dd02 Merge pull request #10658 from erinn/freeipa_compat
Changes to api in FreeIPA > 4.0 compatibility fix.
2015-04-09 10:05:21 -04:00
cd852225f8 Merge pull request #10662 from jlaska/debian_changelog
Improve generation of debian changelog
2015-04-09 09:42:43 -04:00
bbc05a2cf5 Improve generation of debian changelog 2015-04-09 09:30:56 -04:00
a3b35ed1a6 Small change for FreeIPA < 4.0 compatibility. 2015-04-08 20:33:38 -06:00
1e7f7bfc12 Merge pull request #10642 from gaomd/patch-1
Remove redundant whitespace.
2015-04-08 11:21:22 -04:00
9e5c65babd Merge pull request #10649 from ndonegan/devel
Updated outdated link to module directory.
2015-04-08 09:30:50 -04:00
3ae4ee9c52 Updated outdated link to module directory.
Core modules link updated and Extras link added.
2015-04-08 14:24:21 +01:00
1c796543c9 fix for when calling bootinfo throws permmission errors (AIX)
fixes https://github.com/ansible/ansible-modules-core/issues/1108
2015-04-08 03:30:21 -04:00
e122236f55 updated submodule refs 2015-04-08 03:18:13 -04:00
3c9890a358 now in v2 everything passes a single passwords hash 2015-04-08 03:17:32 -04:00
665babdaab Remove redundant whitespace. 2015-04-08 14:19:45 +08:00
640a2b811f Merge pull request #10633 from centromere/patch-1
Fixed typo
2015-04-07 18:03:00 -04:00
72457e4326 Fixed typo 2015-04-07 12:19:37 -04:00
1cf911d524 Back-porting Makefile changes for version/release 2015-04-07 09:54:19 -05:00
b8a9d87f30 Fixing the VERSION file to match the expected "version release" format 2015-04-07 08:22:56 -05:00
9409cc7443 Use codecs module while reading & writing json cache file 2015-04-07 14:26:42 +03:00
faadb68308 backup_local now only tries to back up exising files, returns '' otherwise 2015-04-06 23:37:32 -04:00
7076298dc1 Adding FIXME note to playbook executor code regarding password params 2015-04-06 22:27:14 -05:00
d732c94ac2 a bunch of updates to connection info and related, to pass down passwords
also now options populate required fields in required order allowing play to override
added capture of debug in action plugins when stdout is not json
2015-04-06 22:35:02 -04:00
bdd838f876 Merge pull request #10625 from discordianfish/patch-1
Replace - in ec2 inventory as well
2015-04-06 21:12:43 -04:00
a6778fdff0 Merge pull request #10623 from CVirus/patch-1
Replaced --start-at with --start-at-task
2015-04-06 20:54:08 -04:00
f82b1f12e8 Merge pull request #10628 from detiber/module_utils_facts
Fix indentation
2015-04-06 19:52:11 -04:00
f6c116a81f Updating version to contain the full major/release 2015-04-06 18:30:38 -05:00
43775daa4b Fix indentation 2015-04-06 16:47:52 -04:00
2244178c6d Updating debian packaging changelog for devel 2.0 version 2015-04-06 14:09:49 -05:00
5150d83d01 Fixing the version in lib/ 2015-04-06 12:15:07 -05:00
c7f3362795 Replace - in ec2 inventory as well
Dash (-) is not a variable ansible group name, so it needs to be replaced as well.
2015-04-06 14:43:39 +02:00
e79c920260 Add support for Arch to module_utils.basic.py
Fixes ansible/ansible#8653
2015-04-06 11:02:40 +02:00
bb3f50361e Replaced --start-at with --start-at-task 2015-04-05 20:47:22 +03:00
e82ba723e2 Fixing multiple v2 bugs 2015-04-05 01:07:47 -05:00
4bc79a746a more fine tunnign on verbosity 2015-04-04 16:26:05 -04:00
b1e6aaa790 implemented verbosity, added 5th level and now can see how many plays per playbooko if -vvvvv 2015-04-04 15:54:54 -04:00
5531b84360 moved ad-hoc to use display 2015-04-04 15:21:42 -04:00
af97e732a0 updated ansible-playbook to use display, fixed issues breaking display class 2015-04-04 15:14:40 -04:00
e6e69c0894 finished implementing list-hosts, started adding list-tasks/list-tags
but getting just task names and have to adjust for having blocks.
2015-04-04 10:25:55 -04:00
2eb2a41d05 renamed get_entries to get_plays 2015-04-04 10:24:03 -04:00
349ecf6efe Add a vault test to data_loader test and some additional yaml tests to parsing/yaml/test_loader 2015-04-03 11:39:56 -07:00
c5fdabdb26 Merge pull request #10614 from wenottingham/patch-4
Update intro_windows.rst
2015-04-03 14:27:41 -04:00
7e3b3b6ebe Update intro_windows.rst
Add a bit about what Windows versions PS3 is actually available for.
2015-04-03 14:26:45 -04:00
30b5af30d5 Merge pull request #10613 from wenottingham/patch-3
Update intro_windows.rst
2015-04-03 14:24:42 -04:00
22608939eb Update intro_windows.rst
Refer to PowerShell consistently.
2015-04-03 14:23:04 -04:00
3c6fdebfe3 made listhosts play output name more consistent internally 2015-04-03 13:49:00 -04:00
a811c8841e now listhosts shows the same info as v1 2015-04-03 13:42:05 -04:00
41d9bfde07 Moving the Display() instantiation outside of v2 classes 2015-04-03 12:17:01 -05:00
ada86dafaf added listhosts draft
fixed assert from list to new yaml ansible object
taskqueue is now None when just listing
2015-04-03 13:02:42 -04:00
d5eb4df23e Add ability to specify using ssh_args in synchronize 2015-04-03 09:42:20 -05:00
e719bf765d switched to use cross platform os.sep, added diff output to copy 2015-04-03 09:20:19 -04:00
20b4492704 started implementing 'list options' 2015-04-03 04:51:16 -04:00
2ade17e2f5 v2 changed empty inventory to warning that only localhost is available 2015-04-03 04:50:44 -04:00
0f8bc038ec changed to use display as utils.warning doesnt exist in v2 2015-04-03 00:25:09 -04:00
25f071b64c fixed called to find plugin, transport is not needed as suffixes are passed 2015-04-03 00:01:32 -04:00
7a81167b06 brought v2 find plugins up 2 date with v1, also added exception handling for whne there is a permissions issue 2015-04-02 23:59:48 -04:00
92e400eb6d fixed minor issues with openstack docs not being valid yaml 2015-04-02 21:08:17 -04:00
469a1250b6 Moving new patch action plugin over to v2 2015-04-02 16:22:07 -05:00
cd81666e3e Merge pull request #10607 from sivel/no-install-via-homebrew
Don't recommend installing ansible via homebrew
2015-04-02 16:35:45 -04:00
fa076591c9 Don't recommend installing ansible via homebrew 2015-04-02 15:30:37 -05:00
02b03cfdf5 Merge pull request #10593 from bcoca/backup_ioerror
capture IOErrors on backup_local (happens on non posix filesystems)
2015-04-02 15:55:20 -04:00
ee1af1b14e Merge pull request #10559 from bcoca/become_constants_fix
removed folding sudo/su to become logic from constants
2015-04-02 15:51:58 -04:00
278c1e6514 Merge pull request #10514 from bcoca/fix_password_template_error
now ansible ignores tempate errors on passwords
2015-04-02 15:50:58 -04:00
42b7321d4b Merge pull request #10587 from bcoca/fix_unrelated_lookup_fail
dont break everything when one of the vars in inject does not template
2015-04-02 15:49:18 -04:00
5808b68d35 Update module pointers 2015-04-02 12:41:30 -07:00
2cddb093f5 Add AnsibleList for keeping track of line numbers in lists parsed from yaml 2015-04-02 12:37:02 -07:00
369bf0d214 No longer need AnsibleComposer 2015-04-02 12:35:50 -07:00
b4f16a5e2a Merge pull request #10605 from ansible/v2-pyyaml-c-2
Port v2 to use the C version of pyyaml instead of pure python
2015-04-02 11:45:40 -07:00
d277c6b821 Few more py3 cleanups 2015-04-02 11:41:18 -07:00
ac6b7045db A little py3 compat, side effect of making this work under profile 2015-04-02 11:41:13 -07:00
bfae708bbf Port v2 to the PyYAML C extension 2015-04-02 11:21:55 -07:00
811a906332 Fixing the synchronize action plugin for v2 2015-04-02 11:54:45 -05:00
34aba2dd9a Fixing dupe option for -u in v2 2015-04-02 11:26:42 -05:00
0603b9c62c Merge branch 'v2_fixing' into devel
Conflicts:
	v2/ansible/playbook/helpers.py
2015-04-02 01:25:53 -05:00
785c0c0c8c V2 fixing bugs 2015-04-02 01:19:21 -05:00
06c837cd87 Merge pull request #7487 from nirvinehh/devel
Clean non-printable chars from stdout instead of dropping the whole thin...
2015-04-01 21:36:03 -04:00
69cf95bd0e Add __init__ to the yaml test dir 2015-04-01 15:00:50 -07:00
e697de6076 Move AnsibleBaseBaseYAMLObject's position_info into a property 2015-04-01 14:54:22 -07:00
05f1bed12b Use the node's start_mark to determine line and column.
* Elminates a lot of logic in the AnsibleComposer class.
* Update tests with new column offsets.  The rule should now be
  consistently: Column is the start of the entry's value (so for
  strings, the first non-space after the entry beginning, for dicts, the
  first character of the first key)
2015-04-01 13:51:01 -07:00
b152275a36 Test line numbers and "fix" a bug in the scalar line counting 2015-04-01 12:18:53 -07:00
4a5b37542d Merge pull request #10579 from ansible/v2-unicode-yaml
Change AnsibleConstructor for yaml to only return unicode strings
2015-04-01 09:39:53 -07:00
c41b917162 Add a yaml constructor for unicode strings:
* Changes AnsibleConstructor so that only unicode strings are returned
  (no str type)
* Tracks line, column numbers for strings
* Adds unittests for AnsibleLoader (generic for all the yaml parsing)
2015-04-01 09:37:54 -07:00
4dd233b0dd Merge pull request #10237 from emonty/remove-auth-token
Remove auth token and port openstack module_utils changes to v2 tree
2015-04-01 12:20:59 -04:00
1fa3dbb7d2 capture IOErrors on backup_local (happens on non posix filesystems)
fixes #10591
2015-04-01 12:12:34 -04:00
b1ccb5989c Merge pull request #10590 from lowwalker/patch-1
note added to source section
2015-04-01 10:30:18 -04:00
f6714ac051 Merge pull request #10507 from renard/fix-patch-action-plugin
Fix patch action plugin
2015-04-01 09:57:34 -04:00
132c0e794d note added to source section
Added reminder to not use source install method if you're going to be installing ansible for a Tower system
2015-04-01 08:29:56 -04:00
87c99b4675 Align verify parameter with validate_certs
The rest of ansible uses validate_certs, so make that the main
documented parameter. However, leave verify as an alias since that's the
passthrough value to the underlying libraries.
2015-04-01 07:54:02 -04:00
0d1e2e74a1 converted error on play var initialization into warning with more information 2015-03-31 23:07:03 -04:00
17e086fe8c dont break everything when one of the vars in inject does not template correctly, wait till its used 2015-03-31 21:36:18 -04:00
90ca386555 Add api timeout now that shade spports it everywhere 2015-03-31 20:29:06 -04:00
eb788dd8f6 Just move things around so that new_inventory doesn't interfere with testing 2015-03-31 12:58:00 -07:00
57ed994766 updated version 2015-03-31 13:44:21 -04:00
70ff7f1b98 Merge pull request #10580 from ansible/v2-parse_kv-newline
Possible fix for the first newline and triple newline problems
2015-03-31 07:53:06 -07:00
f337707ef1 updated ref to pickup latest docfixes 2015-03-31 09:43:09 -04:00
4919c225e6 updated ref so docs can build 2015-03-31 09:22:19 -04:00
fd7bf51c14 updated changelog with new cloudstack modules 2015-03-31 08:59:40 -04:00
f812582d9c updated submodule refs 2015-03-31 08:47:30 -04:00
378dc561cb Possible fix for the first newline and triple newline problems 2015-03-30 22:47:56 -07:00
43c1a97447 Various unicode and backslash escape cleanups
* Do backslash escape parsing in parse_kv() [was being done in the copy
  module purely for newlines in the copy module's content param before]
* Make parse_kv always return unicode
* Add bandaid to transform args to unicode until we can fix things
  calling parse_kv to always send it unicode.
* Make split_args deal with unicode internally.  Warning, no bandaid for
  things calling split_args without giving it unicode (shouldn't matter
  as dealt with str internally before)
* Fix copy and unarchive action plugins to not use setdefaultencoding
* Remove escaping from copy (it was broken and made content into latin-1
  sometimes). escaping is now in parse_kv.
* Expect that content is now a unicode string so transform to bytes just
  before writing to the file.
* Add initial unittests for split_args and parse_kv.  4 failing
  tests.because split_args is injecting extra newlines.
2015-03-30 19:19:34 -07:00
1cc2135a0d Fix no closed parens 2015-03-30 19:15:41 -07:00
4aa3ac41a1 Port sivel's fix for egg_info (#10563) to v2 2015-03-30 19:15:41 -07:00
ce512e18f0 Remove fireball connection plugin. v2 will have accelerate but not fireball 2015-03-30 19:15:41 -07:00
dc9b36ccb0 Some notes on optimizing module_replacer 2015-03-30 19:15:41 -07:00
68880a797d Update core to fix cloudformation problem 2015-03-30 19:15:41 -07:00
299314c6b6 Merge pull request #10545 from resmo/feature/cloudstack-utils
cloudstack: common code used in cloudstack modules
2015-03-30 22:03:45 -04:00
2a8a302e7e fixed corner case when counting backwards, added test cases for count=0 and backwards counts 2015-03-30 20:34:17 -04:00
3a70affb9a Vagrant inventory: exit 0 on success
Current code has sys.exit(1) at the end of the codepath for the
options --help, --list and --host. These are not error conditions
so should be returning 0 for success, not 1 which is EPERM i.e.
"Operation not permitted". Newer Vagrant versions examine the exit
codes from subprocesses and interpret this as a failure.
2015-03-30 16:39:09 +01:00
1ae5b9292c Merge pull request #10571 from bcoca/community_docs
small updates to community and contribution page
2015-03-30 09:00:01 -04:00
3afc54d298 added zabbix modules to changelog 2015-03-29 16:51:11 -04:00
c90e3f0d16 small updates to community and contribution page 2015-03-29 15:58:56 -04:00
7fdfb130bb Merge pull request #10566 from bcoca/role_sudo
readded sudo/su vars to allow role/includes to work with passed sudo/su
2015-03-29 10:14:26 -04:00
662b35cbce readded sudo/su vars to allow role/includes to work with passed sudo/su 2015-03-27 18:30:42 -04:00
35a2ca8a5d made sequence more flexible, can handle descending and negative sequences and is skipped if start==end 2015-03-27 15:41:02 -04:00
d628f3f591 Merge pull request #10563 from sivel/fix-gen-egg-info
egg_info is now written directly to lib
2015-03-27 13:37:01 -04:00
104b2036f7 egg_info is now written directly to lib 2015-03-27 12:03:20 -05:00
5ec1f3bd6e removed folding sudo/su to become logic from constants as it is already present downstream in playbook/play/tasks 2015-03-27 08:45:04 -04:00
1f2e60f251 Merge pull request #10558 from hagbarddenstore/devel
Always define error before using it
2015-03-27 08:30:38 -04:00
35a8f94b52 Merge pull request #10557 from kristous/patch-2
Update README.md
2015-03-27 08:24:26 -04:00
76e3a9c93a Merge pull request #9894 from 47lining/cloud_modules_sts_support_redux_ansible
Cloud Modules STS Support Redux
2015-03-27 08:20:43 -04:00
ecae993ead Merge pull request #10554 from jxn/changelog-spellcheck
Fix a few spelling errors in the changelog
2015-03-27 07:56:24 -04:00
576832e4c9 Always define error before using it
When the error reason is "Forbidden", the code throws a Python exception
rather than simply outputting the exception reason.

It's not nice to throw a Python exception when all the info to display
a proper message is available.
2015-03-27 10:46:01 +01:00
e964439b99 Update README.md
to get debuild you need to install devscripts
2015-03-27 07:47:20 +01:00
jxn
bc2e6d4d0e Fix a few spelling errors in the changelog 2015-03-26 20:00:52 -05:00
75f933cf64 Merge pull request #10551 from deimosfr/devel
fix consul inventory issue (missing method param)

merging as this does not seem to have worked before
2015-03-26 17:58:50 -04:00
7b63a57993 fix consul inventory issue (missing method param) 2015-03-26 21:40:36 +01:00
b7936009c2 Correct typo 2015-03-26 12:09:36 -07:00
0ec1b025a9 Update the module pointers 2015-03-26 11:59:53 -07:00
ea2d00c558 v2 equivalent for https://github.com/ansible/ansible/pull/8564
Looks like there's currently no code for the ansible_*_interpreter but
modified the note abouot adding it
2015-03-26 11:57:27 -07:00
5bf9ea6298 make sure the shebang we inject into the module is a str
Fixes #8564
2015-03-26 11:52:19 -07:00
3e7d959c9d cloudstack: module utils are BSD licensed 2015-03-26 15:39:02 +01:00
c066a60b7c cloudstack: fail_json() if library cs is not found 2015-03-26 15:32:58 +01:00
1ba05dd3a2 cloudstack: add doc fragment 2015-03-26 14:18:23 +01:00
bb6d983290 cloudstack: add utils for common functionality 2015-03-26 14:18:13 +01:00
e9c8e89c77 added cloudtrail to changelog 2015-03-26 01:16:32 -04:00
3615171651 added maven artifact to changelog 2015-03-25 23:56:26 -04:00
74ef30cec1 added pushover module to changelog 2015-03-25 23:16:05 -04:00
51d6db136c updated changelog 2015-03-25 22:06:54 -04:00
ff71f06b3f Merge pull request #10538 from tobarja/patch-1
Fix some typos in CHANGELOG.md
2015-03-25 22:03:43 -04:00
c697bc2546 Fix some typos in CHANGELOG.md 2015-03-25 21:58:24 -04:00
60f972dfe4 Fix the command module handling of non-ascii values.
We can't depend on the args being unicode text because we're in module
land, not in the ansible controller land
2015-03-25 13:57:48 -07:00
38892e986e Convert exceptions to unicode using to_unicode rather than str. that stops unicode errors if the string has non-ascii text 2015-03-25 13:56:46 -07:00
aaa25eb75c Make run_command() work when we get byte str with non-ascii characters (instead of unicode type like we were expecting)
Fix and test.

Fixes #10536
2015-03-25 12:24:49 -07:00
c024057e97 Fix assert to work with unicode values 2015-03-25 12:24:49 -07:00
1eed3edc2f tweaking the CHANGELOG 2015-03-25 14:17:16 -05:00
d3d343c751 Merge pull request #10534 from matthieucan/patch-1
doc: building debian package: 'asciidoc' is a required dependency
2015-03-25 14:54:29 -04:00
2c3e58ad59 And all of core module changes added 2015-03-25 10:15:19 -07:00
9b20ca31d6 Add a unch of changelog entries for 1.9 2015-03-25 09:24:48 -07:00
1aaf444943 Put all module changes in the same location 2015-03-25 08:51:35 -07:00
1b11e45f3c doc: building debian package: 'asciidoc' is a required dependency 2015-03-25 16:34:07 +01:00
00b9364699 added modules from extras 2015-03-25 10:57:13 -04:00
34cd6deb9f Spelling 2015-03-25 07:41:13 -07:00
699f6b16db a few more updates 2015-03-25 10:36:20 -04:00
aca4e292fa some updates of what 1.9 includes 2015-03-25 09:55:39 -04:00
b6ec502983 added missing element to make google groups link a actual link 2015-03-24 21:09:45 -04:00
ff8ef048e0 Merge pull request #10529 from famousgarkin/patch-1
rst.j2 template better core module source wording
2015-03-24 15:01:51 -04:00
cf6155f1c2 rst.j2 template better core module source wording 2015-03-24 20:00:51 +01:00
19ba26e9a5 makes raw module have quiet ssh so as to avoid extra output when not requried 2015-03-24 14:48:50 -04:00
c6942578bf Added installation instructions for Arch Linux. 2015-03-24 12:00:58 +01:00
131683523b Add some comments to explain how the property code for Attributes works 2015-03-23 23:16:06 -07:00
8a0b8629e8 readded -u option 2015-03-24 00:18:04 -04:00
bc69ad8147 Rename munge methods to preprocess_data.
Remove the call to preprocess_loop data from playbook_include as
includes can't be used with loops.
2015-03-23 18:42:28 -07:00
6ba24e9fa1 Remove comment on changing Base.munge => it's used by become.py 2015-03-23 17:41:02 -07:00
63c54035de Get rid of iteritems usage when we only care about the keys 2015-03-23 16:38:51 -07:00
fdf51e9a96 Use class.mro() instead of custom base_class finder code 2015-03-23 16:14:34 -07:00
ede94dd7f8 Merge pull request #10522 from ciupicri/doc-quotes
Doc: use literal code blocks for YAML examples
2015-03-23 17:22:58 -04:00
577cdcadb3 Doc: use literal code blocks for YAML examples
Without this, the straight double quotes (") are displayed as curved
quotes (“ and ”).
2015-03-23 22:52:42 +02:00
79cf7e7292 Modifying sample for test_become to show more test cases 2015-03-23 15:22:34 -05:00
095990b4d8 Moving from getattr to properties for the v2 base class 2015-03-23 15:19:13 -05:00
317728f649 Allow ansible-galaxy to install symlinks 2015-03-23 09:21:12 -05:00
7115d37933 Merge pull request #10518 from pilou-/file_mode_v2
Port #10258 to v2
2015-03-22 19:56:03 -07:00
5942144868 Port #10258 to v2 2015-03-23 01:25:18 +01:00
bda83fdf84 Fixing bug in v2 dynamic include code, pointed out by apollo13 2015-03-22 19:17:25 -05:00
c5d5ed17ea added tag resolution mirroring updated v1 2015-03-22 02:05:27 -04:00
49ba9d4bc2 Merge pull request #10516 from caphrim007/fixing-small-spelling-error
Fixes a brief spelling error
2015-03-21 23:39:00 -04:00
9a680472f8 Fixes a brief spelling error
Fixes a simple spelling mistake that was bugging me when I read the online
docs. Trying to make the docs as great as possible.
2015-03-21 19:22:12 -07:00
ec8118ec41 now ansible ignores tempate errors on passwords
they could be caused by random character combinations, fixes #10468
2015-03-21 02:02:59 -04:00
e5edce8e5d Merge pull request #10513 from hjst/patch-1
Update add_host example in AWS Guide
2015-03-21 01:35:44 -04:00
ca540ef9f8 added vault password to dataloder creation 2015-03-21 01:33:10 -04:00
08896e2cfd enabled vault password file and fixed prompting for connection password on local 2015-03-21 01:23:28 -04:00
10e14d0e0a Update add_host example in AWS Guide
The add_host module now uses "groups" instead of "groupname" to allow for specifying more than one group.
2015-03-21 13:21:55 +08:00
edb1bd25dd added password prompting and become/sudo/su collapsing 2015-03-21 01:19:07 -04:00
9d3a63945d moved pipeline check to class var that was previouslly added 2015-03-21 00:48:38 -04:00
b370728439 several fixes to cli tools
- fixed issue with previous commit with bad constants vs C ref on become
- added list-tags
- rearranged common options to utils/cli.py
- added generic validate for both vault and become conflicts
- removed dupes and conflicting options
2015-03-21 00:40:24 -04:00
93c9803818 Removing some leftover debug prints and cleaning up test sample 2015-03-20 23:25:21 -05:00
cf96c7719e added become_method list and pipeline support to connection class methods
added generic method to check supported become methods for the connection plugin
2015-03-20 23:48:52 -04:00
cd26aead17 Merge pull request #10511 from bcoca/v2_become_fix_cli
fixed command line PE options to be the same as in 1.9
2015-03-20 23:44:40 -04:00
c7c8425856 fixed command line PE options to be the same as in 1.9 2015-03-20 23:12:16 -04:00
3109e7ec68 Merge pull request #10457 from bcoca/docsite_returnval_docs
Docsite returnval docs
2015-03-20 17:27:22 -04:00
72586d0df5 updated to latest core/devel 2015-03-20 17:27:00 -04:00
c3076b8478 added module returnval documentation to web docs 2015-03-20 16:55:03 -04:00
64b447f01b grammer correction 2015-03-20 16:55:03 -04:00
2cacac4b23 minor adjustments to formatting 2015-03-20 16:55:03 -04:00
690d227034 extended return value explanation 2015-03-20 16:55:03 -04:00
94909bd4a2 Added return values documentation to modules 2015-03-20 16:55:03 -04:00
393246fdd3 Make v2 playbook class attributes inheritable
Also fixing some other become-related things
2015-03-20 14:15:12 -05:00
8d8c4c0615 Update modules for asg tag fix 2015-03-20 11:39:58 -07:00
b186676e38 Clean up jsonify and make json_dict_*to* more flexible at the same time. 2015-03-20 11:35:19 -07:00
f976d47fa3 Merge pull request #10508 from ebastos/devel
correctly identifies oracle linux
2015-03-20 13:52:07 -04:00
d4eddabb2a Patch for bug #10485 - ansible_distribution fact populates as 'RedHat' on Oracle Linux systems 2015-03-20 14:40:44 -03:00
6888f1ccd9 [patch] Use _make_tmp_path to prevent from copying full patch file path. 2015-03-20 17:13:50 +01:00
8a5f162e29 [patch] fix "remote_src" behavior according patch module documentation.
Patch documentation says "remote_src" us False by default. That was not
the case in the action plugin.
2015-03-20 16:45:54 +01:00
d4ebe77502 now use combine vars to preserve existing cached host vars 2015-03-20 11:34:18 -04:00
c49685b753 removed debug play from tests 2015-03-20 11:25:48 -04:00
a53cf9d6fa now correctly aplies add_host passed variables last to override existing vars. 2015-03-20 11:22:07 -04:00
7aab5d6828 Merge pull request #10503 from bcoca/addhost_addhostvars
now add_host loads hostvars
2015-03-20 10:31:45 -04:00
0c57bed728 now add_host loads hostvars 2015-03-20 10:14:53 -04:00
6264eb4e02 Pull in ec2_asg fixes from core modules 2015-03-19 22:45:47 -07:00
e73b945900 Merge pull request #10112 from jsmartin/ec2_asg_rolling_integration_tests
Adds integration tests for new ec2_asg features
2015-03-19 22:41:00 -07:00
d1641f2925 Remove the multiline string for arguments not. 2015-03-19 16:10:01 -07:00
86dc83b76d Merge pull request #10163 from maxamillion/docs_yaml_dict_playbook
Add intro to playbook docs using YAML dictionaries
2015-03-19 16:08:36 -07:00
ac1c49302d Update core modules pointer 2015-03-19 12:50:46 -07:00
c576b440c6 Merge pull request #10502 from bcoca/checksums_only_sudo
ignore PE methods that are not sudo for checksums
2015-03-19 14:42:56 -04:00
456f83962d ignore PE methods that are not sudo for checksums until we get them working universally 2015-03-19 14:31:00 -04:00
85cfe1bd52 added google addwords tag 2015-03-19 11:17:16 -04:00
73f5a1fcdd Update the extras module pointer 2015-03-18 20:25:53 -07:00
b8efd3f777 Update core module pointer 2015-03-18 19:55:13 -07:00
98db6a232d Have selinux allow docker<=>nginx communication 2015-03-18 18:56:46 -07:00
9dd5f8c758 Update core module pointer 2015-03-18 18:30:10 -07:00
3c52c36629 Okay, let's see if these pauses are enough to get this passing 2015-03-18 17:58:29 -07:00
fd2d7fe447 Merge pull request #10290 from bcoca/remove_bare_warning
removed bare variable detection as this confuses people
2015-03-18 20:43:56 -04:00
2a967879fb Fix the removal of busybox image 2015-03-18 14:05:27 -07:00
c2fb0b8f9d Some debugging for why docker tests are failing in jenkins 2015-03-18 13:40:19 -07:00
f4c1260d03 Add more tests for private docker registries 2015-03-18 12:16:18 -07:00
ba4e9a4c82 added missing become method inventory override 2015-03-17 19:19:48 -04:00
259744d5f4 Remove debug statements 2015-03-17 14:41:06 -07:00
2cfeec3683 Add tests using a docker private registry 2015-03-17 14:41:06 -07:00
fe6a2d644d Merge pull request #10487 from sgargan/cron-pull-path-issue
avoid path issues by determining the path of ansible-pull and using its ...
2015-03-17 17:37:42 -04:00
4ce791fe84 avoid path issues by determining the path of ansible-pull and using its path to run ansible and ansible-playbook 2015-03-17 21:25:45 +00:00
9e14471471 And ran into a different problem with centos6. Sigh. 2015-03-17 14:14:26 -07:00
85e137bbad Attempt to enable docker tests for rhel/centos6 as well 2015-03-17 13:52:44 -07:00
f8ec1451ea Would help if I added these files in the right directory 2015-03-17 13:31:54 -07:00
23291e8d8c Ugh, looks like very few distros have the proper packages to run the docker module.
break up the tests so that we can maybe  run this on at least one
platform
2015-03-17 13:18:42 -07:00
a64de2e000 Initial test of the docker module 2015-03-17 12:32:07 -07:00
f9a66a7ff7 Update core module pointer 2015-03-17 11:03:15 -07:00
e42848e0fe Better comment for why we have get_checksum call itself sometimes 2015-03-17 11:02:07 -07:00
3473a3bbec Changes to become cmd formatting, per a47c132 2015-03-17 10:50:41 -05:00
316284c56b Making blocks support become, and cleaning up sudo/su references 2015-03-17 10:35:46 -05:00
b11be68249 updated module ref 2015-03-16 19:40:37 -04:00
bbdcba53da fixed bug on using su on play level not setting become method correctly 2015-03-16 19:37:03 -04:00
a47c132695 slight changes to allow for checksum and other commands to work correctly with quoting 2015-03-16 19:09:03 -04:00
23f7538016 Merge pull request #10467 from sgargan/ec2_creds_error
Fix for issue #10422.
2015-03-16 14:51:08 -07:00
ada2567dfb log errors and explicitly exit rather than raising exceptions 2015-03-16 20:00:18 +00:00
37ab61c542 Update core pointer to make use of DOCKER_TLS_VERIFY env var:
https://github.com/ansible/ansible-modules-core/issues/946
2015-03-16 11:46:44 -07:00
1bf0e60646 Update core module pointer 2015-03-16 11:34:55 -07:00
b783ea94bb fixed raw return check for privilege escalation 2015-03-16 14:00:07 -04:00
5eae435357 removed Darwin get_uptime_facts as it seems to crash on OS X, will waiy for a
patch tested by someone that has access to the platform
2015-03-16 13:41:36 -04:00
3312a76987 Merge pull request #10461 from cblument/fact_ansible_uptime
Adding uptime_seconds fact for linux and darwin platforms
2015-03-16 09:11:23 -04:00
caf2a96ef9 Merge pdksh fix to v2 2015-03-15 13:22:07 -07:00
27be0421c0 Merge pull request #10466 from eest/env-setup_pdksh
env-setup: Don't use ${.sh.file} if shell is pdksh
2015-03-15 12:59:42 -07:00
fbff0449ce fix for issue #10422. outputs informative error message when AWS credentials are not available 2015-03-15 12:24:42 +00:00
731b268cd6 env-setup: Don't use ${.sh.file} if shell is pdksh
The default ksh in OpenBSD throws the following error:
===
$ . hacking/env-setup
ksh: hacking/env-setup[23]: ${.sh.file}": bad substitution
[...]
===

The same error can be seen on Linux if pdksh is used.
2015-03-15 10:46:21 +01:00
7813ffd719 Adding uptime_seconds fact for linux and darwin platforms
Adds ansible_uptime_seconds facts for linux and darwin platforms.  BSD
platforms may also work.
2015-03-13 15:52:16 -05:00
22304afd1d More fixing of become stuff in v2 2015-03-13 15:31:20 -05:00
70f56c135c Port #10357 to v2 2015-03-13 11:44:58 -07:00
8c3b5690e5 Merge pull request #10357 from htgoebel/devel
Fix detect of docker as virtualization_type.
2015-03-13 11:40:15 -07:00
c2a87a20ee Merge pull request #10459 from mrcrilly/patch-1
Correct version number.
2015-03-13 14:37:11 -04:00
8e346186b2 Correct version number.
1.8.4 is the latest stable now, I believe.
2015-03-13 18:07:18 +00:00
070c7c319f Started implementing become in v2 2015-03-13 11:58:00 -05:00
f451974efe Use correct URL for travis status badge
This uses the `devel` branch when displaying the travis-ci status badge.
2015-03-13 10:56:30 -04:00
d65e1ee2cb Merge pull request #10455 from jlaska/tox_and_travis
Add tox and travis-ci support
2015-03-13 10:15:59 -04:00
60acdee0dc Enable assert_raises_regexp on py26 2015-03-13 08:21:14 -04:00
3d67e9e0c0 Add tox and travis-ci support
Add tox integration to run unittests in supported python releases.
Travis-CI is used for test execution.

Additionally, the unittest TestQuotePgIdentifier was updated to support
using assert_raises_regexp on python-2.6.

Sample travis-ci output available at
https://travis-ci.org/ansible/ansible/builds/54189977
2015-03-13 08:20:24 -04:00
c8de03d516 Merge pull request #10448 from jhermann/add-test-requirements
added test requirements for pip
2015-03-12 13:57:10 -07:00
f05cda6ffc Comma is also dependent on position within the hash 2015-03-12 13:20:51 -07:00
90886594fa added test requirements for pip 2015-03-12 21:04:38 +01:00
c94c3d134e Merge pull request #10447 from bcoca/sync_test_fix
fixed and reintroduced syncronize test
2015-03-12 14:47:08 -04:00
74bf59082d fixed and reintroduced syncronize test, fakerunner object needed become_method to be it's default 'sudo' 2015-03-12 14:48:06 -04:00
644e50fe34 Hash randomization makes one of the heuristic_log_sanitize checks not work.
Nothing we can do, when it sanitizes ssh_urls it's simply overzealous.
2015-03-12 11:39:47 -07:00
b5d23543f0 fixed and reintroduced syncronize test, fakerunner object needed become_method to be it's default 'sudo' 2015-03-12 14:22:24 -04:00
b1d78a61fc Initial support for vault in v2
TODO:
* password prompting needs to be implemented, but is being worked on
  as part of the become privilege escalation changes
2015-03-12 12:14:57 -05:00
eb850bf81a Fix issue with unarchive disabling pipelining mode
Was using persist_files=True when specifying the create paramater,
which breaks pipelining. Switched to use delete_remote_tmp=False instead,
which is the proper way to preserve the remove tmp dir when running
other modules from the action plugin.
2015-03-12 10:22:06 -05:00
a675b10b3b Merge pull request #10329 from bcoca/var_merge_combined
changed from hash_merge to combine vars which resets default to
2015-03-12 10:58:12 -04:00
ac1493faae fixed missed conversion of su to become 2015-03-12 10:01:31 -04:00
ee831e1071 Fix v2 for #10426
Note: In v1 we fix this by transforming into unicode just before we use
it (when we send it to jinja2) because jinja2 cannot handle non-ascii
characters in str.

In v2 our model is that all text values need to be stored as unicode
type internally.  So we transform this to unicode when we read it from
the inventory file and save it into the internal dict instead.
2015-03-11 21:28:45 -07:00
4710a07fb0 Test case for #10426 2015-03-11 20:58:21 -07:00
f5264414db Merge pull request #10426 from shirou/fix-hostvar-unicode-error
use to_unicode() in _jinja2_vars if type is str.
2015-03-11 20:39:50 -07:00
d92e8edf6e set 'nonstring' arg to passthru. 2015-03-12 12:36:50 +09:00
d633ad1022 Merge pull request #10438 from jhermann/patch-1
Generic package_dir mapping in setup.py (closes #10437)
2015-03-11 19:15:59 -07:00
e413dba3a6 Update the module pointers 2015-03-11 19:10:38 -07:00
597c0f48f5 Generic package_dir mapping in setup.py (closes #10437) 2015-03-12 02:28:33 +01:00
f229b770b2 fixed missed su to become conversion 2015-03-11 19:23:02 -04:00
eb69eb4108 Merge pull request #10435 from bcoca/ssh_password_become_fix
fixes password error detection for ssh connection plugin
2015-03-11 19:04:56 -04:00
f803c1e1f8 fix tag test that broke with new tag info displayed in list tasks 2015-03-11 16:28:37 -04:00
587ab17f10 fixes password error detection for ssh connection plugin
removes sycnronize test that does not work with current sudo setup
Fixes #10434
2015-03-11 16:11:27 -04:00
5f0ed76f1c Merge branch 'bcoca-become_fixes' into devel 2015-03-11 11:54:12 -05:00
747c7aaffa removed uneeded reference to su_user 2015-03-11 12:33:05 -04:00
de5eae2007 fixed traceback when x_user implicitly sets the become method
Fixes #10430

Also removed redundant resolution of sudo/su for backwards compatibility which
confused the conflict detection code.
2015-03-11 12:18:53 -04:00
1fd0a78b0e fix issue with ask pass signature 2015-03-11 10:28:27 -04:00
57aa40420f Merge pull request #10427 from jeffwidman/patch-1
Typo: lead --> led
2015-03-11 09:47:00 -04:00
a5f533e25d fixed bad paren in connection plugin 2015-03-11 09:30:07 -04:00
f6d8e457ab Typo: lead --> led 2015-03-11 01:20:17 -07:00
2d73892acf use to_unicode() in _jinja2_vars if type is str. 2015-03-11 14:50:27 +09:00
ab45e5ee59 Merge pull request #10411 from bcoca/add_pbrun
preliminary privlege escalation unification  + pbrun
2015-03-10 18:42:15 -04:00
5f6db0e164 preliminary privlege escalation unification + pbrun
- become constants inherit existing sudo/su ones
- become command line options, marked sudo/su as deprecated and moved sudo/su passwords to runas group
- changed method signatures as privlege escalation is collapsed to become
- added tests for su and become, diabled su for lack of support in local.py
- updated playbook,play and task objects to become
- added become to runner
- added whoami test for become/sudo/su
- added home override dir for plugins
- removed useless method from ask pass
- forced become pass to always be string also uses to_bytes
- fixed fakerunner for tests
- corrected reference in synchronize action plugin
- added pfexec (needs testing)
- removed unused sudo/su in runner init
- removed deprecated info
- updated pe tests to allow to run under sudo and not need root
- normalized become options into a funciton to avoid duplication and inconsistencies
- pushed suppored list to connection classs property
- updated all connection plugins to latest 'become' pe

- includes fixes from feedback (including typos)
- added draft docs
- stub of become_exe, leaving for future v2 fixes
2015-03-10 18:42:36 -04:00
d244390064 correclty added inventory this time 2015-03-09 12:15:41 -04:00
642d9d6b56 readded inventory vars to runner's vars 2015-03-09 12:12:37 -04:00
5453e2cbb8 removed redundant inventory call, moved grousp to proper priority 2015-03-09 10:27:59 -04:00
8758ba08bd Update common OpenStack requests-related parameters
Also, update docs related to earlier changes in this stack.
2015-03-06 18:20:45 -05:00
8027a8a0b5 Change to auth_type to match python-openstackclient 2015-03-06 18:11:12 -05:00
8758ae201d Fix detect of docker as virtualization_type.
Not only match`/docker/`, but also `docker-` followed by a hex-id.

Example (shortened):
```
$ cat /proc/1/cgroup
8:blkio:/system.slice/docker-de73f4d207861cf8757b69213ee67bb234b897a18bea7385964b6ed2d515da94.scope
7:net_cls:/
```
2015-02-28 14:13:58 +01:00
0b8773fc99 Remove state from central argument list
There is an old PR that shows a great use case for having a different
set of states for the server module. Before the other modules start
being in real use, pull this out so that we don't get ourselves into a
pickle.
2015-02-26 11:35:29 -05:00
4fa51652b4 fixed typoe in combined_Vars 2015-02-24 05:26:41 -05:00
ce764063f1 corrected merge vs combined in all pertinent sections 2015-02-24 05:14:22 -05:00
e59b364641 changed from hash_merge to combine vars which resets default to
overwrite and not merge hashing
2015-02-24 05:05:27 -05:00
c4144b1391 Some grammatical updates 2015-02-22 19:28:16 +00:00
7044b5a8d1 removed bare variable detection as this confuses people and forced us to allow for bare expressions 2015-02-19 08:29:53 -05:00
d06a277b50 Port openstack module_utils changes to v2 branch 2015-02-13 10:42:21 -05:00
4e4bdaad8d Remove auth_token parameter
It turns out that this can actually already be handled by the existing
auth plugin framework and does not need its own parameter. Remove before
it sees usage and causes confusion.
2015-02-13 10:42:20 -05:00
4c661e2b93 Update facts.py
Added support for HPUX network fact
2015-02-10 17:33:29 +01:00
1e787bd91e Add intro to playbook docs using YAML dictionaries 2015-02-04 09:56:44 -06:00
440df12f2c added retry configs to v2, pending is actual functionality 2015-01-30 15:25:04 -05:00
e2ce673b1a Properly empties ASG before terminating it, and waits for ASG to be deleted.
Updated to support wait_for_instances and replace_all_instances.
2015-01-27 15:39:26 -05:00
e213fdb15d to replace running with started 2015-01-09 01:24:41 +09:00
64e61197f9 Revert accidental changes 2015-01-05 20:57:05 +00:00
dc6e8bff34 Fix some mistakes in CHANELOG.md 2015-01-03 11:42:44 +00:00
54f1eebde8 Strip formatting from lists of modules 2015-01-01 14:13:59 +00:00
64141dd789 Correct URL to github so links work when testing locally 2014-12-31 22:06:15 +00:00
17498b58bb Add support for AWS Security Token Service (temporary credentials) to all AWS cloud modules. 2014-12-25 13:31:34 -07:00
9639f1d8e7 Make issue rypes as an enumeration
Easier to copy&paste, and delete all except the correct line.
2014-12-18 12:52:15 +01:00
91a73cff81 Add tests for globbing support 2014-12-14 22:40:04 +00:00
fce04b1eba Use command= when we intended to
While here sort register variables and add a comment to signal multiline
testing.
2014-12-14 22:39:17 +00:00
19d40cc54c Add tags for inventory 2014-12-10 11:29:12 -05:00
8146d1fff3 /sys/block/sdX/queue/physical_block_size does not correlate with /sys/block/sdX/size for advanced drives larger than 2TB, /sys/block/sdX/queue/logical_block_size correlates with both see #9549 2014-12-01 17:17:54 +02:00
4ecaa78c79 incorporated code review feedback 2014-11-28 00:00:35 -05:00
a1adff4ff0 Setting LC_MESSAGES: prevent unparseable messages
This locale variable defines how tools should display their messages.
This is for example gonna change the yum message from "Nothing to do" to
"Rien a faire" in my case (french).

As the yum module parses that string in err, if the message is not
enforced in english this is gonna fail.

So this commits just enriches a bit more the code that's already written
for that enforcement.

This commit fixes issue #9635.
2014-11-26 11:02:25 +01:00
3b7280b364 guide_rax.rst: fix add_host invocations
change `groupname` to `groups`, as per add_host documentation
2014-11-09 22:40:29 +01:00
e5f651c458 export ANSIBLE_HOME so it can be used in scripts
In order that scripts like this can work 
```
#!/bin/bash
ansible -vvvv tag_instance_type_foo-training -i "${ANSIBLE_HOME}/plugins/inventory/ec2.py" --private-key=~/Downloads/foo-training.pem -u ec2-user -m ping
```
2014-10-28 20:19:15 +00:00
61ae3c732f Add required_if to AnsibleModule
There is a common pattern in modules where some parameters are required
only if another parameter is present AND set to a particular value. For
instance, if a cloud server state is "present" it's important to
indicate the image to be used, but if it's "absent", the image that was
used to launch it is not necessary. Provide a check that takes as an
input a list of 3-element tuples containing parameter to depend on, the
value it should be set to, and a list of parameters which are required
if the required parameter is set to the required value.
2014-10-26 10:52:40 -07:00
fbc1cd553c an ansible inventory garnered from fleetctl 2014-10-14 07:29:21 -04:00
d20ef3a10a add --pretty for debuging purpose 2014-10-07 17:45:49 +02:00
7c094c9379 add _meta in the list json 2014-10-07 17:45:48 +02:00
3d62e55abe add host variables (proxmox_vmid, proxmox_uptime, proxmox_maxmem, ...) 2014-10-07 17:45:48 +02:00
76f473cd5d add a proxmox inventory plugin 2014-10-07 17:45:48 +02:00
3ca654ad9a Added an example for paretheses 2014-10-05 19:54:31 +02:00
7cc5ecae52 nova.ini: Distinguish between required and optional settings
Put them in separate sections of config to make it more clear what is
essential and what is not. Also comment out the optional settings.
And remove duplicate mention of `service_type`.
2014-10-01 15:19:05 -04:00
1560b963aa nova.py: Support OS_AUTH_SYSTEM and OS_REGION_NAME 2014-10-01 15:19:05 -04:00
cd5edc416c nova.py: Set defaults for OpenStack settings
- auth_system
- region_name
- service_type

These are config settings that could be left out in many scenarios, but
the current code is requiring them. In particular, "service_type" is a
new one in PR #7444 so if we add that and don't set a default, then
existing .ini files won't work:

```
  File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ConfigParser.py",
line 618, in get
    raise NoOptionError(option, section)
ConfigParser.NoOptionError: No option 'service_type' in section:
'openstack'
```
2014-10-01 15:19:04 -04:00
eccb48c8da Improvements to OpenStack inventory script 2014-10-01 15:19:04 -04:00
0ff2936626 Updated per Revision Request 2014-08-13 10:28:43 -07:00
df8dfdce06 packaging: add short has and branch name in package version for unofficial builds 2014-08-06 15:08:55 +02:00
3d61f077ec Added OpenVZ Inventory python script 2014-07-30 10:08:22 -07:00
6b70ee23ab Clean non-printable chars from stdout instead of dropping the whole thing 2014-05-21 19:24:28 -07:00
1086 changed files with 53345 additions and 48406 deletions

6
.gitignore vendored
View File

@ -19,6 +19,12 @@ rpm-build
# Mac OS X stuff...
.DS_Store
# manpage build stuff...
docs/man/man1/ansible.1
docs/man/man1/ansible-doc.1
docs/man/man1/ansible-galaxy.1
docs/man/man1/ansible-playbook.1
docs/man/man1/ansible-pull.1
docs/man/man1/ansible-vault.1
docs/man/man3/*
# Sublime stuff
*.sublime-project

14
.gitmodules vendored
View File

@ -1,16 +1,6 @@
[submodule "lib/ansible/modules/core"]
path = lib/ansible/modules/core
url = https://github.com/ansible/ansible-modules-core.git
branch = stable-1.9
url = https://github.com/ansible/ansible-modules-core
[submodule "lib/ansible/modules/extras"]
path = lib/ansible/modules/extras
url = https://github.com/ansible/ansible-modules-extras.git
branch = stable-1.9
[submodule "v2/ansible/modules/core"]
path = v2/ansible/modules/core
url = https://github.com/ansible/ansible-modules-core.git
branch = stable-1.9
[submodule "v2/ansible/modules/extras"]
path = v2/ansible/modules/extras
url = https://github.com/ansible/ansible-modules-extras.git
branch = stable-1.9
url = https://github.com/ansible/ansible-modules-extras

View File

@ -1,11 +1,33 @@
sudo: false
language: python
env:
- TOXENV=py26
- TOXENV=py27
matrix:
include:
- env: TOXENV=py24 INTEGRATION=no
- env: TOXENV=py26 INTEGRATION=yes
python: 2.6
- env: TOXENV=py27 INTEGRATION=yes
python: 2.7
- env: TOXENV=py34 INTEGRATION=no
python: 3.4
- env: TOXENV=py35 INTEGRATION=no
python: 3.5
addons:
apt:
sources:
- deadsnakes
packages:
- python2.4
install:
- pip install tox
- pip install tox PyYAML Jinja2 sphinx
script:
- tox
# urllib2's defaults are not secure enough for us
- ./test/code-smell/replace-urlopen.sh .
- ./test/code-smell/use-compat-six.sh lib
- ./test/code-smell/boilerplate.sh
- ./test/code-smell/required-and-default-attributes.sh
- if test x"$TOXENV" != x'py24' ; then tox ; fi
- if test x"$TOXENV" = x'py24' ; then python2.4 -V && python2.4 -m compileall -fq -x 'module_utils/(a10|rax|openstack|ec2|gce).py' lib/ansible/module_utils ; fi
#- make -C docsite all
- if test x"$INTEGRATION" = x'yes' ; then source ./hacking/env-setup && cd test/integration/ && make parsing && make test_var_precedence && make unicode ; fi
after_success:
- coveralls

View File

@ -1,15 +1,481 @@
Ansible Changes By Release
==========================
## 2.0 "TBD" - ACTIVE DEVELOPMENT
## 2.1 TBD - ACTIVE DEVELOPMENT
Major Changes:
####New Modules:
* cloudstack: cs_volume
New Modules:
####New Filters:
* extract
Other Notable Changes:
## 2.0.1 "Over the Hills and Far Away"
## 1.9.2 "Dancing In the Street" - TBD
* Fixes a major compatibility break in the synchronize module shipped with
2.0.0.x. That version of synchronize ran sudo on the controller prior to
running rsync. In 1.9.x and previous, sudo was run on the host that rsync
connected to. 2.0.1 restores the 1.9.x behaviour.
* Additionally, several other problems with where synchronize chose to run when
combined with delegate_to were fixed. In particular, if a playbook targetted
localhost and then delegated_to a remote host the prior behavior (in 1.9.x
and 2.0.0.x) was to copy files between the src and destination directories on
the delegated host. This has now been fixed to copy between localhost and
the delegated host.
* Fix a regression where synchronize was unable to deal with unicode paths.
* Fix a regression where synchronize deals with inventory hosts that use
localhost but with an alternate port.
* Fixes a regression where the retry files feature was not implemented.
* Fixes a regression where the any_errors_fatal option was implemented in 2.0
incorrectly, and also adds a feature where any_errors_fatal can be set at
the block level.
* Fix tracebacks when playbooks or ansible itself were located in directories
with unicode characters.
* Fix bug when sending unicode characters to an external pager for display.
* Fix a bug with squashing loops for special modules (mostly package managers).
The optimization was squashing when the loop did not apply to the selection
of packages. This has now been fixed.
* Temp files created when using vault are now "shredded" using the unix shred
program which overwrites the file with random data.
* Some fixes to cloudstack modules for case sensitivity
* Fix non-newstyle modules (non-python modules and old-style modules) to
disabled pipelining.
* Fix fetch module failing even if fail_on_missing is set to False
* Fix for cornercase when local connections, sudo, and raw were used together.
* Fix dnf module to remove dependent packages when state=absent is specified.
This was a feature of the 1.9.x version that was left out by mistake when the
module was rewritten for 2.0.
* Fix bugs with non-english locales in yum, git, and apt modules
* Fix a bug with the dnf module where state=latest could only upgrade, not install.
## 2.0 "Over the Hills and Far Away" - Jan 12, 2016
###Major Changes:
* Releases are now named after Led Zeppelin songs, 1.9 will be the last Van Halen named release.
* The new block/rescue/always directives allow for making task blocks and exception-like semantics
* New strategy plugins (e.g. `free`) allow control over the flow of task execution per play. The default (`linear`) will be the same as before.
* Improved error handling, with more detailed parser messages. General exception handling and display has been revamped.
* Task includes are now evaluated during execution, allowing more dynamic includes and options. Play includes are unchanged both still use the `include` directive.
* "with\_<lookup>" loops can now be used with task includes since they are dynamic.
* Callback, connection, cache and lookup plugin APIs have changed. Existing plugins might require modification to work with the new versions.
* Callbacks are now shipped in the active directory and don't need to be copied, just whitelisted in ansible.cfg.
* Many API changes. Those integrating directly with Ansible's API will encounter breaking changes, but the new API is much easier to use and test.
* Settings are now more inheritable; what you set at play, block or role will be automatically inherited by the contained tasks.
This allows for new features to automatically be settable at all levels, previously we had to manually code this.
* Vars are now settable at play, block, role and task level with the `vars` directive and scoped to the tasks contained.
* Template code now retains types for bools and numbers instead of turning them into strings.
If you need the old behaviour, quote the value and it will get passed around as a string
* Empty variables and variables set to null in yaml will no longer be converted to empty strings. They will retain the value of `None`.
To go back to the old behaviour, you can override the `null_representation` setting to an empty string in your config file or
by setting the `ANSIBLE_NULL_REPRESENTATION` environment variable.
* Added `meta: refresh_inventory` to force rereading the inventory in a play.
This re-executes inventory scripts, but does not force them to ignore any cache they might use.
* New delegate_facts directive, a boolean that allows you to apply facts to the delegated host (true/yes) instead of the inventory_hostname (no/false) which is the default and previous behaviour.
* local connections now work with 'su' as a privilege escalation method
* Ansible 2.0 has deprecated the “ssh” from ansible_ssh_user, ansible_ssh_host, and ansible_ssh_port to become ansible_user, ansible_host, and ansible_port.
* New ssh configuration variables(`ansible_ssh_common_args`, `ansible_ssh_extra_args`) can be used to configure a
per-group or per-host ssh ProxyCommand or set any other ssh options.
`ansible_ssh_extra_args` is used to set options that are accepted only by ssh (not sftp or scp, which have their own analogous settings).
* ansible-pull can now verify the code it runs when using git as a source repository, using git's code signing and verification features.
* Backslashes used when specifying parameters in jinja2 expressions in YAML dicts sometimes needed to be escaped twice.
This has been fixed so that escaping once works. Here's an example of how playbooks need to be modified:
```
# Syntax in 1.9.x
- debug:
msg: "{{ 'test1_junk 1\\\\3' | regex_replace('(.*)_junk (.*)', '\\\\1 \\\\2') }}"
# Syntax in 2.0.x
- debug:
msg: "{{ 'test1_junk 1\\3' | regex_replace('(.*)_junk (.*)', '\\1 \\2') }}"
# Output:
"msg": "test1 1\\3"
```
* When a string with a trailing newline was specified in the playbook via yaml
dict format, the trailing newline was stripped. When specified in key=value
format the trailing newlines were kept. In v2, both methods of specifying the
string will keep the trailing newlines. If you relied on the trailing
newline being stripped you can change your playbook like this:
```
# Syntax in 1.9.2
vars:
message: >
Testing
some things
tasks:
- debug:
msg: "{{ message }}"
# Syntax in 2.0.x
vars:
old_message: >
Testing
some things
message: "{{ old_messsage[:-1] }}"
- debug:
msg: "{{ message }}"
# Output
"msg": "Testing some things"
```
* In 1.9.x, newlines in templates were converted to Unix EOL conventions. If
someone wanted a templated file to end up with Windows or Mac EOL
conventions, this could cause problems for them. In 2.x newlines now remain
as specified in the template file.
* When specifying complex args as a variable, the variable must use the full jinja2
variable syntax ('{{var_name}}') - bare variable names there are no longer accepted.
In fact, even specifying args with variables has been deprecated, and will not be
allowed in future versions:
```
---
- hosts: localhost
connection: local
gather_facts: false
vars:
my_dirs:
- { path: /tmp/3a, state: directory, mode: 0755 }
- { path: /tmp/3b, state: directory, mode: 0700 }
tasks:
- file:
args: "{{item}}"
with_items: my_dirs
```
* The bigip\* networking modules have a new parameter, validate_certs. When
True (the default) the module will validate any hosts it connects to against
the TLS certificates it presents when run on new enough python versions. If
the python version is too old to validate certificates or you used certificates
that cannot be validated against available CAs you will need to add
validate_certs=no to your playbook for those tasks.
###Plugins
* Rewritten dnf module that should be faster and less prone to encountering bugs in cornercases
* WinRM connection plugin passes all vars named `ansible_winrm_*` to the underlying pywinrm client. This allows, for instance, `ansible_winrm_server_cert_validation=ignore` to be used with newer versions of pywinrm to disable certificate validation on Python 2.7.9+.
* WinRM connection plugin put_file is significantly faster and no longer has file size limitations.
####Deprecated Modules (new ones in parens):
* ec2_ami_search (ec2_ami_find)
* quantum_network (os_network)
* glance_image
* nova_compute (os_server)
* quantum_floating_ip (os_floating_ip)
* quantum_router (os_router)
* quantum_router_gateway (os_router)
* quantum_router_interface (os_router)
####New Modules:
* amazon: ec2_ami_copy
* amazon: ec2_ami_find
* amazon: ec2_elb_facts
* amazon: ec2_eni
* amazon: ec2_eni_facts
* amazon: ec2_remote_facts
* amazon: ec2_vpc_igw
* amazon: ec2_vpc_net
* amazon: ec2_vpc_net_facts
* amazon: ec2_vpc_route_table
* amazon: ec2_vpc_route_table_facts
* amazon: ec2_vpc_subnet
* amazon: ec2_vpc_subnet_facts
* amazon: ec2_win_password
* amazon: ecs_cluster
* amazon: ecs_task
* amazon: ecs_taskdefinition
* amazon: elasticache_subnet_group_facts
* amazon: iam
* amazon: iam_cert
* amazon: iam_policy
* amazon: route53_facts
* amazon: route53_health_check
* amazon: route53_zone
* amazon: sts_assume_role
* amazon: s3_bucket
* amazon: s3_lifecycle
* amazon: s3_logging
* amazon: sqs_queue
* amazon: sns_topic
* amazon: sts_assume_role
* apk
* bigip_gtm_wide_ip
* bundler
* centurylink: clc_aa_policy
* centurylink: clc_alert_policy
* centurylink: clc_blueprint_package
* centurylink: clc_firewall_policy
* centurylink: clc_group
* centurylink: clc_loadbalancer
* centurylink: clc_modify_server
* centurylink: clc_publicip
* centurylink: clc_server
* centurylink: clc_server_snapshot
* circonus_annotation
* consul
* consul_acl
* consul_kv
* consul_session
* cloudtrail
* cloudstack: cs_account
* cloudstack: cs_affinitygroup
* cloudstack: cs_domain
* cloudstack: cs_facts
* cloudstack: cs_firewall
* cloudstack: cs_iso
* cloudstack: cs_instance
* cloudstack: cs_instancegroup
* cloudstack: cs_ip_address
* cloudstack: cs_loadbalancer_rule
* cloudstack: cs_loadbalancer_rule_member
* cloudstack: cs_network
* cloudstack: cs_portforward
* cloudstack: cs_project
* cloudstack: cs_sshkeypair
* cloudstack: cs_securitygroup
* cloudstack: cs_securitygroup_rule
* cloudstack: cs_staticnat
* cloudstack: cs_template
* cloudstack: cs_user
* cloudstack: cs_vmsnapshot
* cronvar
* datadog_monitor
* deploy_helper
* docker: docker_login
* dpkg_selections
* elasticsearch_plugin
* expect
* find
* google: gce_tag
* hall
* ipify_facts
* iptables
* libvirt: virt_net
* libvirt: virt_pool
* maven_artifact
* openstack: os_auth
* openstack: os_client_config
* openstack: os_image
* openstack: os_image_facts
* openstack: os_floating_ip
* openstack: os_ironic
* openstack: os_ironic_node
* openstack: os_keypair
* openstack: os_network
* openstack: os_network_facts
* openstack: os_nova_flavor
* openstack: os_object
* openstack: os_port
* openstack: os_project
* openstack: os_router
* openstack: os_security_group
* openstack: os_security_group_rule
* openstack: os_server
* openstack: os_server_actions
* openstack: os_server_facts
* openstack: os_server_volume
* openstack: os_subnet
* openstack: os_subnet_facts
* openstack: os_user
* openstack: os_user_group
* openstack: os_volume
* openvswitch_db.
* osx_defaults
* pagerduty_alert
* pam_limits
* pear
* profitbricks: profitbricks
* profitbricks: profitbricks_datacenter
* profitbricks: profitbricks_nic
* profitbricks: profitbricks_volume
* profitbricks: profitbricks_volume_attachments
* profitbricks: profitbricks_snapshot
* proxmox: proxmox
* proxmox: proxmox_template
* puppet
* pushover
* pushbullet
* rax: rax_clb_ssl
* rax: rax_mon_alarm
* rax: rax_mon_check
* rax: rax_mon_entity
* rax: rax_mon_notification
* rax: rax_mon_notification_plan
* rabbitmq_binding
* rabbitmq_exchange
* rabbitmq_queue
* selinux_permissive
* sendgrid
* sensu_check
* sensu_subscription
* seport
* slackpkg
* solaris_zone
* taiga_issue
* vertica_configuration
* vertica_facts
* vertica_role
* vertica_schema
* vertica_user
* vmware: vca_fw
* vmware: vca_nat
* vmware: vmware_cluster
* vmware: vmware_datacenter
* vmware: vmware_dns_config
* vmware: vmware_dvs_host
* vmware: vmware_dvs_portgroup
* vmware: vmware_dvswitch
* vmware: vmware_host
* vmware: vmware_migrate_vmk
* vmware: vmware_portgroup
* vmware: vmware_target_canonical_facts
* vmware: vmware_vm_facts
* vmware: vmware_vm_vss_dvs_migrate
* vmware: vmware_vmkernel
* vmware: vmware_vmkernel_ip_config
* vmware: vmware_vsan_cluster
* vmware: vmware_vswitch
* vmware: vsphere_copy
* webfaction_app
* webfaction_db
* webfaction_domain
* webfaction_mailbox
* webfaction_site
* win_acl
* win_dotnet_ngen
* win_environment
* win_firewall_rule
* win_iis_virtualdirectory
* win_iis_webapplication
* win_iis_webapppool
* win_iis_webbinding
* win_iis_website
* win_lineinfile
* win_nssm
* win_package
* win_regedit
* win_scheduled_task
* win_unzip
* win_updates
* win_webpicmd
* xenserver_facts
* zabbix_host
* zabbix_hostmacro
* zabbix_screen
* znode
####New Inventory scripts:
* cloudstack
* fleetctl
* openvz
* nagios_ndo
* nsot
* proxmox
* rudder
* serf
####New Lookups:
* credstash
* hashi_vault
* ini
* shelvefile
####New Filters:
* combine
####New Connection:
* docker: for talking to docker containers on the ansible controller machine without using ssh.
####New Callbacks:
* logentries: plugin to send play data to logentries service
* skippy: same as default but does not display skip messages
###Minor changes:
* Many more tests. The new API makes things more testable and we took advantage of it.
* big_ip modules now support turning off ssl certificate validation (use only for self-signed certificates).
* Consolidated code from modules using urllib2 to normalize features, TLS and SNI support.
* synchronize module's dest_port parameter now takes precedence over the ansible_ssh_port inventory setting.
* Play output is now dynamically sized to terminal with a minimum of 80 coluumns (old default).
* vars_prompt and pause are now skipped with a warning if the play is called non interactively (i.e. pull from cron).
* Support for OpenBSD's 'doas' privilege escalation method.
* Most vault operations can now be done over multilple files.
* ansible-vault encrypt/decrypt read from stdin if no other input file is given, and can write to a given ``--output file`` (including stdout, '-').
This lets you avoid ever writing sensitive plaintext to disk.
* ansible-vault rekey accepts the --new-vault-password-file option.
* ansible-vault now preserves file permissions on edit and rekey and defaults to restrictive permissions for other options.
* Configuration items defined as paths (local only) now all support shell style interpolations.
* Many fixes and new options added to modules, too many to list here.
* Now you can see task file and line number when using verbosity of 3 or above.
* The ``[x-y]`` host range syntax is no longer supported. Note that ``[0:1]`` matches two hosts, i.e. the range is inclusive of its endpoints.
* We now recommend the Use `pattern1,pattern2` to combine host matching patterns.
* The use of ':' as a separator conflicts with IPv6 addresses and host ranges. It will be deprecated in the future.
* The undocumented use of ';' as a separator is now deprecated.
* modules and callbacks have been extended to support no_log to avoid data disclosure.
* new managed_syslog option has been added to control output to syslog on managed machines, no_log supercsedes this settings.
* Lookup, vars and action plugin pathing has been normalized, all now follow the same sequence to find relative files.
* We do not ignore the explicitly set login user for ssh when it matches the 'current user' anymore, this allows overriding .ssh/config when it is set
explicitly. Leaving it unset will still use the same user and respect .ssh/config. This also means ansible_ssh_user can now return a None value.
* environment variables passed to remote shells now default to 'controller' settings, with fallback to en_us.UTF8 which was the previous default.
* add_hosts is much stricter about host name and will prevent invalid names from being added.
* ansible-pull now defaults to doing shallow checkouts with git, use `--full` to return to previous behaviour.
* random cows are more random
* when: now gets the registered var after the first iteration, making it possible to break out of item loops
* Handling of undefined variables has changed. In most places they will now raise an error instead of silently injecting an empty string. Use the default filter if you want to approximate the old behaviour:
```
- debug: msg="The error message was: {{error_code |default('') }}"
```
* The yum module's detection of installed packages has been made more robust by
using /usr/bin/rpm in cases where it woud have used repoquery before.
* The pip module now properly reports changes when packages are coming from a VCS.
* Fixes for retrieving files over https when a CONNECT-only proxy is in the middle.
## 1.9.4 "Dancing In the Street" - Oct 9, 2015
* Fixes a bug where yum state=latest would error if there were no updates to install.
* Fixes a bug where yum state=latest did not work with wildcard package names.
* Fixes a bug in lineinfile relating to escape sequences.
* Fixes a bug where vars_prompt was not keeping passwords private by default.
* Fix ansible-galaxy and the hipchat callback plugin to check that the host it
is contacting matches its TLS Certificate.
## 1.9.3 "Dancing In the Street" - Sep 3, 2015
* Fixes a bug related to keyczar messing up encodings internally, resulting in decrypted
messages coming out as empty strings.
* AES Keys generated for use in accelerated mode are now 256-bit by default instead of 128.
* Fix url fetching for SNI with python-2.7.9 or greater. SNI does not work
with python < 2.7.9. The best workaround is probably to use the command
module with curl or wget.
* Fix url fetching to allow tls-1.1 and tls-1.2 if the system's openssl library
supports those protocols
* Fix ec2_ami_search module to check TLS Certificates
* Fix the following extras modules to check TLS Certificates:
* campfire
* layman
* librarto_annotate
* twilio
* typetalk
* Fix docker module's parsing of docker-py version for dev checkouts
* Fix docker module to work with docker server api 1.19
* Change yum module's state=latest feature to update all packages specified in
a single transaction. This is the same type of fix as was made for yum's
state=installed in 1.9.2 and both solves the same problems and with the same caveats.
* Fixed a bug where stdout from a module might be blank when there were were non-printable
ASCII characters contained within it
## 1.9.2 "Dancing In the Street" - Jun 26, 2015
* Security fixes to check that hostnames match certificates with https urls (CVE-2015-3908)
- get_url and uri modules
@ -59,7 +525,6 @@ Major changes:
* Privilege Escalation generalization, new 'Become' system and variables now will
handle existing and new methods. Sudo and su have been kept for backwards compatibility.
New methods pbrun and pfexec in 'alpha' state, planned adding 'runas' for winrm connection plugin.
Existing custom connection plugins will need to be updated.
* Improved ssh connection error reporting, now you get back the specific message from ssh.
* Added facility to document task module return values for registered vars, both for
ansible-doc and the docsite. Documented copy, stats and acl modules, the rest must be
@ -68,11 +533,11 @@ Major changes:
For some use cases this can lead to dramatic improvements in startup time.
* Overhaul of the checksum system, now supports more systems and more cases more reliably and uniformly.
* Fix skipped tasks to not display their parameters if no_log is specified.
* Many fixes to unicode support, standarized functions to make it easier to add to input/output boundries.
* Many fixes to unicode support, standarized functions to make it easier to add to input/output boundaries.
* Added travis integration to github for basic tests, this should speed up ticket triage and merging.
* environment: directive now can also be applied to play and is inhertited by tasks, which can still overridde it.
* environment: directive now can also be applied to play and is inhertited by tasks, which can still override it.
* expanded facts and OS/distribution support for existing facts and improved performance with pypy.
* new 'wantlist' option to lookups allows for selecting a list typed variable vs a commad delimited string as the return.
* new 'wantlist' option to lookups allows for selecting a list typed variable vs a comma delimited string as the return.
* the shared module code for file backups now uses a timestamp resolution of seconds (previouslly minutes).
* allow for empty inventories, this is now a warning and not an error (for those using localhost and cloud modules).
* sped up YAML parsing in ansible by up to 25% by switching to CParser loader.
@ -95,8 +560,8 @@ New Modules:
New Filters:
* ternary: allows for trueval/falseval assignement dependint on conditional
* cartesian: returns the cartesian product of 2 lists
* ternary: allows for trueval/falseval assignment dependent on conditional
* cartesian: returns the Cartesian product of 2 lists
* to_uuid: given a string it will return an ansible domain specific UUID
* checksum: uses the ansible internal checksum to return a hash from a string
* hash: get a hash from a string (md5, sha1, etc)
@ -108,8 +573,10 @@ Other Notable Changes:
* New lookup plugins:
* dig: does dns resolution and returns IPs.
* url: allows pulling data from a url.
* New callback plugins:
* syslog_json: allows logging play output to a syslog network server using json format
* Many new enhancements to the amazon web service modules:
* ec2 now applies all specified security groups when creating a new instance. Previously it was only applying one
* ec2_vol gained the ability to specify the EBS volume type
@ -125,14 +592,14 @@ Other Notable Changes:
* restart_policy parameters to configure when the container automatically restarts
* If the docker client or server doesn't support an option, the task will now fail instead of silently ignoring the option
* Add insecure_registry parameter for connecting to registries via http
* New parameter to set a container's domainname
* New parameter to set a container's domain name
* Undeprecated docker_image module until there's replacement functionality
* Allow setting the container's pid namespace
* Add a pull parameter that chooses when ansible will look for more recent images in the registry
* docker module states have been greatly enhanced. The reworked and new states are:
* present now creates but does not start containers
* restarted always restarts a container
* reloaded restarts a container if ansible detects that the configuration is different than what is spcified
* reloaded restarts a container if ansible detects that the configuration is different than what is specified
* reloaded accounts for exposed ports, env vars, and volumes
* Can now connect to the docker server using TLS
* Several source control modules had force parameters that defaulted to true.
@ -145,7 +612,7 @@ Other Notable Changes:
Operations that depend on a clean working tree may fail unless force=yes is
added.
* git: When local modifications exist in a checkout, the git module will now
fail unless force is explictly specified. Specifying force=yes will allow
fail unless force is explicitly specified. Specifying force=yes will allow
the module to revert and overwrite local modifications to make git actions
succeed.
* hg: When local modifications exist in a checkout, the hg module used to
@ -167,7 +634,7 @@ Other Notable Changes:
* Many fixes for hardlink and softlink handling in file-related modules
* Implement user, group, mode, and selinux parameters for the unarchive module
* authorized_keys can now use url as a key source
* authorized_keys has a new exclusive paameter that determines if keys that weren't specified in the task
* authorized_keys has a new exclusive parameter that determines if keys that weren't specified in the task
* The selinux module now sets the current running state to permissive if state='disabled'
* Can now set accounts to expire via the user module
* Overhaul of the service module to make code simpler and behave better for systems running several popular init systems
@ -185,7 +652,7 @@ Other Notable Changes:
## 1.8.3 "You Really Got Me" - Feb 17, 2015
* Fixing a security bug related to the default permissions set on a tempoary file created when using "ansible-vault view <filename>".
* Fixing a security bug related to the default permissions set on a temporary file created when using "ansible-vault view <filename>".
* Many bug fixes, for both core code and core modules.
## 1.8.2 "You Really Got Me" - Dec 04, 2014
@ -286,7 +753,7 @@ And various other bug fixes and improvements ...
- Fixes a bug in vault where the password file option was not being used correctly internally.
- Improved multi-line parsing when using YAML literal blocks (using > or |).
- Fixed a bug with the file module and the creation of relative symlinks.
- Fixed a bug where checkmode was not being honored during the templating of files.
- Fixed a bug where checkmode was not being honoured during the templating of files.
- Other various bug fixes.
## 1.7.1 "Summer Nights" - Aug 14, 2014
@ -329,7 +796,7 @@ New Modules:
Other notable changes:
* Security fixes
- Prevent the use of lookups when using legaxy "{{ }}" syntax around variables and with_* loops.
- Prevent the use of lookups when using legacy "{{ }}" syntax around variables and with_* loops.
- Remove relative paths in TAR-archived file names used by ansible-galaxy.
* Inventory speed improvements for very large inventories.
* Vault password files can now be executable, to support scripts that fetch the vault password.
@ -473,7 +940,7 @@ Other notable changes:
## 1.5.4 "Love Walks In" - April 1, 2014
- Security fix for safe_eval, which further hardens the checking of the evaluation function.
- Changing order of variable precendence for system facts, to ensure that inventory variables take precedence over any facts that may be set on a host.
- Changing order of variable precedence for system facts, to ensure that inventory variables take precedence over any facts that may be set on a host.
## 1.5.3 "Love Walks In" - March 13, 2014
@ -508,7 +975,7 @@ Major features/changes:
* ec2 module now accepts 'exact_count' and 'count_tag' as a way to enforce a running number of nodes by tags.
* all ec2 modules that work with Eucalyptus also now support a 'validate_certs' option, which can be set to 'off' for installations using self-signed certs.
* Start of new integration test infrastructure (WIP, more details TBD)
* if repoquery is unavailble, the yum module will automatically attempt to install yum-utils
* if repoquery is unavailable, the yum module will automatically attempt to install yum-utils
* ansible-vault: a framework for encrypting your playbooks and variable files
* added support for privilege escalation via 'su' into bin/ansible and bin/ansible-playbook and associated keywords 'su', 'su_user', 'su_pass' for tasks/plays
@ -971,7 +1438,7 @@ Bugfixes and Misc Changes:
* misc fixes to the Riak module
* make template module slightly more efficient
* base64encode / decode filters are now available to templates
* libvirt module can now work with multiple different libvirt connecton URIs
* libvirt module can now work with multiple different libvirt connection URIs
* fix for postgresql password escaping
* unicode fix for shlex.split in some cases
* apt module upgrade logic improved
@ -1006,7 +1473,7 @@ the variable is still registered for the host, with the attribute skipped: True.
* service pattern argument now correctly read for BSD services
* fetch location can now be controlled more directly via the 'flat' parameter.
* added basename and dirname as Jinja2 filters available to all templates
* pip works better when sudoing from unpriveledged users
* pip works better when sudoing from unprivileged users
* fix for user creation with groups specification reporting 'changed' incorrectly in some cases
* fix for some unicode encoding errors in outputing some data in verbose mode
* improved FreeBSD, NetBSD and Solaris facts
@ -1176,7 +1643,7 @@ New playbook/language features:
* task includes can now be of infinite depth
* when_set and when_unset can take more than one var (when_set: $a and $b and $c)
* added the with_sequence lookup plugin
* can override "connection:" on an indvidual task
* can override "connection:" on an individual task
* parameterized playbook includes can now define complex variables (not just all on one line)
* making inventory variables available for use in vars_files paths
* messages when skipping plays are now more clear

View File

@ -1,11 +1,22 @@
##### Issue Type:
Can you help us out in labelling this by telling us what kind of ticket this this? You can say “Bug Report”, “Feature Idea”, “Feature Pull Request”, “New Module Pull Request”, “Bugfix Pull Request”, “Documentation Report”, or “Docs Pull Request”.
Can you help us out in labelling this by telling us what kind of ticket this this? You can say:
- Bug Report
- Feature Idea
- Feature Pull Request
- New Module Pull Request
- Bugfix Pull Request
- Documentation Report
- Docs Pull Request
##### Ansible Version:
Let us know what version of Ansible you are using. Please supply the verbatim output from running “ansible --version”. If you're filing a ticket on a version of Ansible which is not the latest, we'd greatly appreciate it if you could retest on the latest version first. We don't expect you to test against the development branch most of the time, but we may ask for that if you have cycles. Thanks!
##### Ansible Configuration:
What have you changed about your Ansible installation? What configuration settings have you changed/added/removed? Compare your /etc/ansible/ansible.cfg against a clean version from Github and let us know what's different.
##### Environment:
What OS are you running Ansible from and what OS are you managing? Examples include RHEL 5/6, Centos 5/6, Ubuntu 12.04/13.10, *BSD, Solaris. If this is a generic feature request or it doesn’t apply, just say “N/A”. Not all tickets may be about operating system related things and we understand that.

View File

@ -4,15 +4,21 @@ prune ticket_stubs
prune packaging
prune test
prune hacking
include README.md packaging/rpm/ansible.spec COPYING
include README.md COPYING
include examples/hosts
include examples/ansible.cfg
include lib/ansible/module_utils/powershell.ps1
recursive-include lib/ansible/modules *
recursive-include lib/ansible/galaxy/data *
recursive-include docs *
recursive-include plugins *
recursive-include packaging *
include Makefile
include VERSION
include MANIFEST.in
include CHANGELOG.md
include contrib/README.md
recursive-include contrib/inventory *
exclude lib/ansible/modules/core/.git*
exclude lib/ansible/modules/extras/.git*
prune lib/ansible/modules/core/.git
prune lib/ansible/modules/extras/.git

View File

@ -40,6 +40,11 @@ RELEASE := $(shell cat VERSION | cut -f2 -d' ')
# Get the branch information from git
ifneq ($(shell which git),)
GIT_DATE := $(shell git log -n 1 --format="%ai")
GIT_HASH := $(shell git log -n 1 --format="%h")
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD | sed 's/[-_.\/]//g')
GITINFO = .$(GIT_HASH).$(GIT_BRANCH)
else
GITINFO = ""
endif
ifeq ($(shell echo $(OS) | egrep -c 'Darwin|FreeBSD|OpenBSD'),1)
@ -53,7 +58,7 @@ DEBUILD_BIN ?= debuild
DEBUILD_OPTS = --source-option="-I"
DPUT_BIN ?= dput
DPUT_OPTS ?=
DEB_DATE := $(shell date +"%a, %d %b %Y %T %z")
DEB_DATE := $(shell LC_TIME=C date +"%a, %d %b %Y %T %z")
ifeq ($(OFFICIAL),yes)
DEB_RELEASE = $(RELEASE)ppa
# Sign OFFICIAL builds using 'DEBSIGN_KEYID'
@ -62,7 +67,7 @@ ifeq ($(OFFICIAL),yes)
DEBUILD_OPTS += -k$(DEBSIGN_KEYID)
endif
else
DEB_RELEASE = 0.git$(DATE)
DEB_RELEASE = 0.git$(DATE)$(GITINFO)
# Do not sign unofficial builds
DEBUILD_OPTS += -uc -us
DPUT_OPTS += -u
@ -78,7 +83,7 @@ RPMSPEC = $(RPMSPECDIR)/ansible.spec
RPMDIST = $(shell rpm --eval '%{?dist}')
RPMRELEASE = $(RELEASE)
ifneq ($(OFFICIAL),yes)
RPMRELEASE = 0.git$(DATE)
RPMRELEASE = 0.git$(DATE)$(GITINFO)
endif
RPMNVR = "$(NAME)-$(VERSION)-$(RPMRELEASE)$(RPMDIST)"
@ -88,7 +93,7 @@ MOCK_CFG ?=
NOSETESTS ?= nosetests
NOSETESTS3 ?= nosetests-3.3
NOSETESTS3 ?= nosetests-3.4
########################################################
@ -97,11 +102,8 @@ all: clean python
tests:
PYTHONPATH=./lib $(NOSETESTS) -d -w test/units -v --with-coverage --cover-package=ansible --cover-branches
newtests:
PYTHONPATH=./v2:./lib $(NOSETESTS) -d -w v2/test -v --with-coverage --cover-package=ansible --cover-branches
newtests-py3:
PYTHONPATH=./v2:./lib $(NOSETESTS3) -d -w v2/test -v --with-coverage --cover-package=ansible --cover-branches
tests-py3:
PYTHONPATH=./lib $(NOSETESTS3) -d -w test/units -v --with-coverage --cover-package=ansible --cover-branches
authors:
sh hacking/authors.sh
@ -133,10 +135,11 @@ clean:
@echo "Cleaning up distutils stuff"
rm -rf build
rm -rf dist
rm -rf lib/ansible.egg-info/
@echo "Cleaning up byte compiled python stuff"
find . -type f -regex ".*\.py[co]$$" -delete
@echo "Cleaning up editor backup files"
find . -type f \( -name "*~" -or -name "#*" \) -delete
find . -type f -not -path ./test/units/inventory_test_data/group_vars/noparse/all.yml~ \( -name "*~" -or -name "#*" \) -delete
find . -type f \( -name "*.swp" \) -delete
@echo "Cleaning up manpage stuff"
find ./docs/man -type f -name "*.xml" -delete
@ -164,6 +167,9 @@ install:
sdist: clean docs
$(PYTHON) setup.py sdist
sdist_upload: clean docs
$(PYTHON) setup.py sdist upload 2>&1 |tee upload.log
rpmcommon: $(MANPAGES) sdist
@mkdir -p rpm-build
@cp dist/*.gz rpm-build/

View File

@ -1,6 +1,6 @@
[![PyPI version](https://badge.fury.io/py/ansible.png)](http://badge.fury.io/py/ansible)
[![PyPI downloads](https://pypip.in/d/ansible/badge.png)](https://pypi.python.org/pypi/ansible)
[![Build Status](https://travis-ci.org/ansible/ansible.svg?branch=tox_and_travis)](https://travis-ci.org/ansible/ansible)
[![PyPI version](https://img.shields.io/pypi/v/ansible.svg)](https://pypi.python.org/pypi/ansible)
[![PyPI downloads](https://img.shields.io/pypi/dm/ansible.svg)](https://pypi.python.org/pypi/ansible)
[![Build Status](https://travis-ci.org/ansible/ansible.svg?branch=devel)](https://travis-ci.org/ansible/ansible)
Ansible
@ -12,9 +12,9 @@ Read the documentation and more at http://ansible.com/
Many users run straight from the development branch (it's generally fine to do so), but you might also wish to consume a release.
You can find instructions [here](http://docs.ansible.com/intro_getting_started.html) for a variety of platforms. If you decide to go with the development branch, be sure to run "git submodule update --init --recursive" after doing a checkout.
You can find instructions [here](http://docs.ansible.com/intro_getting_started.html) for a variety of platforms. If you decide to go with the development branch, be sure to run `git submodule update --init --recursive` after doing a checkout.
If you want to download a tarball of a release, go to [releases.ansible.com](http://releases.ansible.com/ansible), though most users use yum (using the EPEL instructions linked above), apt (using the PPA instructions linked above), or "pip install ansible".
If you want to download a tarball of a release, go to [releases.ansible.com](http://releases.ansible.com/ansible), though most users use `yum` (using the EPEL instructions linked above), `apt` (using the PPA instructions linked above), or `pip install ansible`.
Design Principles
=================
@ -33,7 +33,7 @@ Get Involved
============
* Read [Community Information](http://docs.ansible.com/community.html) for all kinds of ways to contribute to and interact with the project, including mailing list information and how to submit bug reports and code to Ansible.
* All code submissions are done through pull requests. Take care to make sure no merge commits are in the submission, and use "git rebase" vs "git merge" for this reason. If submitting a large code change (other than modules), it's probably a good idea to join ansible-devel and talk about what you would like to do or add first and to avoid duplicate efforts. This not only helps everyone know what's going on, it also helps save time and effort if we decide some changes are needed.
* All code submissions are done through pull requests. Take care to make sure no merge commits are in the submission, and use `git rebase` vs `git merge` for this reason. If submitting a large code change (other than modules), it's probably a good idea to join ansible-devel and talk about what you would like to do or add first and to avoid duplicate efforts. This not only helps everyone know what's going on, it also helps save time and effort if we decide some changes are needed.
* Users list: [ansible-project](http://groups.google.com/group/ansible-project)
* Development list: [ansible-devel](http://groups.google.com/group/ansible-devel)
* Announcement list: [ansible-announce](http://groups.google.com/group/ansible-announce) - read only
@ -42,7 +42,7 @@ Get Involved
Branch Info
===========
* Releases are named after Van Halen songs.
* Releases are named after Led Zeppelin songs. (Releases prior to 2.0 were named after Van Halen songs.)
* The devel branch corresponds to the release actively under development.
* As of 1.8, modules are kept in different repos, you'll want to follow [core](https://github.com/ansible/ansible-modules-core) and [extras](https://github.com/ansible/ansible-modules-extras)
* Various release-X.Y branches exist for previous releases.
@ -51,7 +51,8 @@ Branch Info
Authors
=======
Ansible was created by [Michael DeHaan](https://github.com/mpdehaan) (michael.dehaan/gmail/com) and has contributions from over 900 users (and growing). Thanks everyone!
Ansible was created by [Michael DeHaan](https://github.com/mpdehaan) (michael.dehaan/gmail/com) and has contributions from over 1000 users (and growing). Thanks everyone!
Ansible is sponsored by [Ansible, Inc](http://ansible.com)

View File

@ -4,11 +4,15 @@ Ansible Releases at a Glance
Active Development
++++++++++++++++++
2.0 "TBD" - in progress
2.1 "TBD" - in progress
Released
++++++++
2.0.1 "Over the Hills and Far Away" TBD
2.0.0 "Over the Hills and Far Away" 01-12-2015
1.9.4 "Dancing In the Streets" 10-09-2015
1.9.3 "Dancing In the Streets" 09-03-2015
1.9.2 "Dancing In the Streets" 06-24-2015
1.9.1 "Dancing In the Streets" 04-27-2015
1.9.0 "Dancing In the Streets" 03-25-2015
@ -16,7 +20,6 @@ Released
1.8.3 "You Really Got Me" ---- 02-17-2015
1.8.2 "You Really Got Me" ---- 12-04-2014
1.8.1 "You Really Got Me" ---- 11-26-2014
1.8 "You Really Got Me" ---- 11-25-2014
1.7.2 "Summer Nights" -------- 09-24-2014
1.7.1 "Summer Nights" -------- 08-14-2014
1.7 "Summer Nights" -------- 08-06-2014

View File

@ -1 +1 @@
1.9.2 1
2.0.1.0 0.2.network

View File

@ -18,6 +18,8 @@
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
########################################################
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
__requires__ = ['ansible']
try:
@ -32,176 +34,82 @@ except Exception:
import os
import sys
import traceback
from ansible.runner import Runner
import ansible.constants as C
from ansible import utils
from ansible import errors
from ansible import callbacks
from ansible import inventory
########################################################
class Cli(object):
''' code behind bin/ansible '''
# ----------------------------------------------
def __init__(self):
self.stats = callbacks.AggregateStats()
self.callbacks = callbacks.CliRunnerCallbacks()
if C.DEFAULT_LOAD_CALLBACK_PLUGINS:
callbacks.load_callback_plugins()
# ----------------------------------------------
def parse(self):
''' create an options parser for bin/ansible '''
parser = utils.base_parser(
constants=C,
runas_opts=True,
subset_opts=True,
async_opts=True,
output_opts=True,
connect_opts=True,
check_opts=True,
diff_opts=False,
usage='%prog <host-pattern> [options]'
)
parser.add_option('-a', '--args', dest='module_args',
help="module arguments", default=C.DEFAULT_MODULE_ARGS)
parser.add_option('-m', '--module-name', dest='module_name',
help="module name to execute (default=%s)" % C.DEFAULT_MODULE_NAME,
default=C.DEFAULT_MODULE_NAME)
options, args = parser.parse_args()
self.callbacks.options = options
if len(args) == 0 or len(args) > 1:
parser.print_help()
sys.exit(1)
# privlege escalation command line arguments need to be mutually exclusive
utils.check_mutually_exclusive_privilege(options, parser)
if (options.ask_vault_pass and options.vault_password_file):
parser.error("--ask-vault-pass and --vault-password-file are mutually exclusive")
return (options, args)
# ----------------------------------------------
def run(self, options, args):
''' use Runner lib to do SSH things '''
pattern = args[0]
sshpass = becomepass = vault_pass = become_method = None
# Never ask for an SSH password when we run with local connection
if options.connection == "local":
options.ask_pass = False
else:
options.ask_pass = options.ask_pass or C.DEFAULT_ASK_PASS
options.ask_vault_pass = options.ask_vault_pass or C.DEFAULT_ASK_VAULT_PASS
# become
utils.normalize_become_options(options)
prompt_method = utils.choose_pass_prompt(options)
(sshpass, becomepass, vault_pass) = utils.ask_passwords(ask_pass=options.ask_pass, become_ask_pass=options.become_ask_pass, ask_vault_pass=options.ask_vault_pass, become_method=prompt_method)
# read vault_pass from a file
if not options.ask_vault_pass and options.vault_password_file:
vault_pass = utils.read_vault_file(options.vault_password_file)
extra_vars = utils.parse_extra_vars(options.extra_vars, vault_pass)
inventory_manager = inventory.Inventory(options.inventory, vault_password=vault_pass)
if options.subset:
inventory_manager.subset(options.subset)
hosts = inventory_manager.list_hosts(pattern)
if len(hosts) == 0:
callbacks.display("No hosts matched", stderr=True)
sys.exit(0)
if options.listhosts:
for host in hosts:
callbacks.display(' %s' % host)
sys.exit(0)
if options.module_name in ['command','shell'] and not options.module_args:
callbacks.display("No argument passed to %s module" % options.module_name, color='red', stderr=True)
sys.exit(1)
if options.tree:
utils.prepare_writeable_dir(options.tree)
runner = Runner(
module_name=options.module_name,
module_path=options.module_path,
module_args=options.module_args,
remote_user=options.remote_user,
remote_pass=sshpass,
inventory=inventory_manager,
timeout=options.timeout,
private_key_file=options.private_key_file,
forks=options.forks,
pattern=pattern,
callbacks=self.callbacks,
transport=options.connection,
subset=options.subset,
check=options.check,
diff=options.check,
vault_pass=vault_pass,
become=options.become,
become_method=options.become_method,
become_pass=becomepass,
become_user=options.become_user,
extra_vars=extra_vars,
)
if options.seconds:
callbacks.display("background launch...\n\n", color='cyan')
results, poller = runner.run_async(options.seconds)
results = self.poll_while_needed(poller, options)
else:
results = runner.run()
return (runner, results)
# ----------------------------------------------
def poll_while_needed(self, poller, options):
''' summarize results from Runner '''
# BACKGROUND POLL LOGIC when -B and -P are specified
if options.seconds and options.poll_interval > 0:
poller.wait(options.seconds, options.poll_interval)
return poller.results
from ansible.errors import AnsibleError, AnsibleOptionsError, AnsibleParserError
from ansible.utils.display import Display
from ansible.utils.unicode import to_unicode
########################################################
########################################
### OUTPUT OF LAST RESORT ###
class LastResort(object):
def display(self, msg):
print(msg, file=sys.stderr)
def error(self, msg, wrap_text=None):
print(msg, file=sys.stderr)
########################################
if __name__ == '__main__':
callbacks.display("", log_only=True)
callbacks.display(" ".join(sys.argv), log_only=True)
callbacks.display("", log_only=True)
cli = Cli()
(options, args) = cli.parse()
display = LastResort()
cli = None
me = os.path.basename(sys.argv[0])
try:
(runner, results) = cli.run(options, args)
for result in results['contacted'].values():
if 'failed' in result or result.get('rc', 0) != 0:
sys.exit(2)
if results['dark']:
sys.exit(3)
except errors.AnsibleError, e:
# Generic handler for ansible specific errors
callbacks.display("ERROR: %s" % str(e), stderr=True, color='red')
sys.exit(1)
display = Display()
display.debug("starting run")
sub = None
try:
if me.find('-') != -1:
target = me.split('-')
if len(target) > 1:
sub = target[1]
myclass = "%sCLI" % sub.capitalize()
mycli = getattr(__import__("ansible.cli.%s" % sub, fromlist=[myclass]), myclass)
elif me == 'ansible':
from ansible.cli.adhoc import AdHocCLI as mycli
else:
raise AnsibleError("Unknown Ansible alias: %s" % me)
except ImportError as e:
if e.message.endswith(' %s' % sub):
raise AnsibleError("Ansible sub-program not implemented: %s" % me)
else:
raise
cli = mycli(sys.argv)
cli.parse()
sys.exit(cli.run())
except AnsibleOptionsError as e:
cli.parser.print_help()
display.error(to_unicode(e), wrap_text=False)
sys.exit(5)
except AnsibleParserError as e:
display.error(to_unicode(e), wrap_text=False)
sys.exit(4)
# TQM takes care of these, but leaving comment to reserve the exit codes
# except AnsibleHostUnreachable as e:
# display.error(str(e))
# sys.exit(3)
# except AnsibleHostFailed as e:
# display.error(str(e))
# sys.exit(2)
except AnsibleError as e:
display.error(to_unicode(e), wrap_text=False)
sys.exit(1)
except KeyboardInterrupt:
display.error("User interrupted execution")
sys.exit(99)
except Exception as e:
have_cli_options = cli is not None and cli.options is not None
display.error("Unexpected Exception: %s" % to_unicode(e), wrap_text=False)
if not have_cli_options or have_cli_options and cli.options.verbosity > 2:
display.display(u"the full traceback was:\n\n%s" % to_unicode(traceback.format_exc()))
else:
display.display("to see the full traceback, use -vvv")
sys.exit(250)

View File

@ -1,337 +0,0 @@
#!/usr/bin/env python
# (c) 2012, Jan-Piet Mens <jpmens () gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
#
import os
import sys
import textwrap
import re
import optparse
import datetime
import subprocess
import fcntl
import termios
import struct
from ansible import utils
from ansible.utils import module_docs
import ansible.constants as C
from ansible.utils import version
import traceback
MODULEDIR = C.DEFAULT_MODULE_PATH
BLACKLIST_EXTS = ('.pyc', '.swp', '.bak', '~', '.rpm')
IGNORE_FILES = [ "COPYING", "CONTRIBUTING", "LICENSE", "README", "VERSION"]
_ITALIC = re.compile(r"I\(([^)]+)\)")
_BOLD = re.compile(r"B\(([^)]+)\)")
_MODULE = re.compile(r"M\(([^)]+)\)")
_URL = re.compile(r"U\(([^)]+)\)")
_CONST = re.compile(r"C\(([^)]+)\)")
PAGER = 'less'
LESS_OPTS = 'FRSX' # -F (quit-if-one-screen) -R (allow raw ansi control chars)
# -S (chop long lines) -X (disable termcap init and de-init)
def pager_print(text):
''' just print text '''
print text
def pager_pipe(text, cmd):
''' pipe text through a pager '''
if 'LESS' not in os.environ:
os.environ['LESS'] = LESS_OPTS
try:
cmd = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, stdout=sys.stdout)
cmd.communicate(input=text)
except IOError:
pass
except KeyboardInterrupt:
pass
def pager(text):
''' find reasonable way to display text '''
# this is a much simpler form of what is in pydoc.py
if not sys.stdout.isatty():
pager_print(text)
elif 'PAGER' in os.environ:
if sys.platform == 'win32':
pager_print(text)
else:
pager_pipe(text, os.environ['PAGER'])
elif subprocess.call('(less --version) 2> /dev/null', shell = True) == 0:
pager_pipe(text, 'less')
else:
pager_print(text)
def tty_ify(text):
t = _ITALIC.sub("`" + r"\1" + "'", text) # I(word) => `word'
t = _BOLD.sub("*" + r"\1" + "*", t) # B(word) => *word*
t = _MODULE.sub("[" + r"\1" + "]", t) # M(word) => [word]
t = _URL.sub(r"\1", t) # U(word) => word
t = _CONST.sub("`" + r"\1" + "'", t) # C(word) => `word'
return t
def get_man_text(doc):
opt_indent=" "
text = []
text.append("> %s\n" % doc['module'].upper())
desc = " ".join(doc['description'])
text.append("%s\n" % textwrap.fill(tty_ify(desc), initial_indent=" ", subsequent_indent=" "))
if 'option_keys' in doc and len(doc['option_keys']) > 0:
text.append("Options (= is mandatory):\n")
for o in sorted(doc['option_keys']):
opt = doc['options'][o]
if opt.get('required', False):
opt_leadin = "="
else:
opt_leadin = "-"
text.append("%s %s" % (opt_leadin, o))
desc = " ".join(opt['description'])
if 'choices' in opt:
choices = ", ".join(str(i) for i in opt['choices'])
desc = desc + " (Choices: " + choices + ")"
if 'default' in opt:
default = str(opt['default'])
desc = desc + " [Default: " + default + "]"
text.append("%s\n" % textwrap.fill(tty_ify(desc), initial_indent=opt_indent,
subsequent_indent=opt_indent))
if 'notes' in doc and len(doc['notes']) > 0:
notes = " ".join(doc['notes'])
text.append("Notes:%s\n" % textwrap.fill(tty_ify(notes), initial_indent=" ",
subsequent_indent=opt_indent))
if 'requirements' in doc and doc['requirements'] is not None and len(doc['requirements']) > 0:
req = ", ".join(doc['requirements'])
text.append("Requirements:%s\n" % textwrap.fill(tty_ify(req), initial_indent=" ",
subsequent_indent=opt_indent))
if 'examples' in doc and len(doc['examples']) > 0:
text.append("Example%s:\n" % ('' if len(doc['examples']) < 2 else 's'))
for ex in doc['examples']:
text.append("%s\n" % (ex['code']))
if 'plainexamples' in doc and doc['plainexamples'] is not None:
text.append("EXAMPLES:")
text.append(doc['plainexamples'])
if 'returndocs' in doc and doc['returndocs'] is not None:
text.append("RETURN VALUES:")
text.append(doc['returndocs'])
text.append('')
return "\n".join(text)
def get_snippet_text(doc):
text = []
desc = tty_ify(" ".join(doc['short_description']))
text.append("- name: %s" % (desc))
text.append(" action: %s" % (doc['module']))
for o in sorted(doc['options'].keys()):
opt = doc['options'][o]
desc = tty_ify(" ".join(opt['description']))
if opt.get('required', False):
s = o + "="
else:
s = o
text.append(" %-20s # %s" % (s, desc))
text.append('')
return "\n".join(text)
def get_module_list_text(module_list):
tty_size = 0
if os.isatty(0):
tty_size = struct.unpack('HHHH',
fcntl.ioctl(0, termios.TIOCGWINSZ, struct.pack('HHHH', 0, 0, 0, 0)))[1]
columns = max(60, tty_size)
displace = max(len(x) for x in module_list)
linelimit = columns - displace - 5
text = []
deprecated = []
for module in sorted(set(module_list)):
if module in module_docs.BLACKLIST_MODULES:
continue
filename = utils.plugins.module_finder.find_plugin(module)
if filename is None:
continue
if filename.endswith(".ps1"):
continue
if os.path.isdir(filename):
continue
try:
doc, plainexamples, returndocs = module_docs.get_docstring(filename)
desc = tty_ify(doc.get('short_description', '?')).strip()
if len(desc) > linelimit:
desc = desc[:linelimit] + '...'
if module.startswith('_'): # Handle deprecated
deprecated.append("%-*s %-*.*s" % (displace, module[1:], linelimit, len(desc), desc))
else:
text.append("%-*s %-*.*s" % (displace, module, linelimit, len(desc), desc))
except:
traceback.print_exc()
sys.stderr.write("ERROR: module %s has a documentation error formatting or is missing documentation\n" % module)
if len(deprecated) > 0:
text.append("\nDEPRECATED:")
text.extend(deprecated)
return "\n".join(text)
def find_modules(path, module_list):
if os.path.isdir(path):
for module in os.listdir(path):
if module.startswith('.'):
continue
elif os.path.isdir(module):
find_modules(module, module_list)
elif any(module.endswith(x) for x in BLACKLIST_EXTS):
continue
elif module.startswith('__'):
continue
elif module in IGNORE_FILES:
continue
elif module.startswith('_'):
fullpath = '/'.join([path,module])
if os.path.islink(fullpath): # avoids aliases
continue
module = os.path.splitext(module)[0] # removes the extension
module_list.append(module)
def main():
p = optparse.OptionParser(
version=version("%prog"),
usage='usage: %prog [options] [module...]',
description='Show Ansible module documentation',
)
p.add_option("-M", "--module-path",
action="store",
dest="module_path",
default=MODULEDIR,
help="Ansible modules/ directory")
p.add_option("-l", "--list",
action="store_true",
default=False,
dest='list_dir',
help='List available modules')
p.add_option("-s", "--snippet",
action="store_true",
default=False,
dest='show_snippet',
help='Show playbook snippet for specified module(s)')
p.add_option('-v', action='version', help='Show version number and exit')
(options, args) = p.parse_args()
if options.module_path is not None:
for i in options.module_path.split(os.pathsep):
utils.plugins.module_finder.add_directory(i)
if options.list_dir:
# list modules
paths = utils.plugins.module_finder._get_paths()
module_list = []
for path in paths:
find_modules(path, module_list)
pager(get_module_list_text(module_list))
sys.exit()
if len(args) == 0:
p.print_help()
def print_paths(finder):
''' Returns a string suitable for printing of the search path '''
# Uses a list to get the order right
ret = []
for i in finder._get_paths():
if i not in ret:
ret.append(i)
return os.pathsep.join(ret)
text = ''
for module in args:
filename = utils.plugins.module_finder.find_plugin(module)
if filename is None:
sys.stderr.write("module %s not found in %s\n" % (module, print_paths(utils.plugins.module_finder)))
continue
if any(filename.endswith(x) for x in BLACKLIST_EXTS):
continue
try:
doc, plainexamples, returndocs = module_docs.get_docstring(filename)
except:
traceback.print_exc()
sys.stderr.write("ERROR: module %s has a documentation error formatting or is missing documentation\n" % module)
continue
if doc is not None:
all_keys = []
for (k,v) in doc['options'].iteritems():
all_keys.append(k)
all_keys = sorted(all_keys)
doc['option_keys'] = all_keys
doc['filename'] = filename
doc['docuri'] = doc['module'].replace('_', '-')
doc['now_date'] = datetime.date.today().strftime('%Y-%m-%d')
doc['plainexamples'] = plainexamples
doc['returndocs'] = returndocs
if options.show_snippet:
text += get_snippet_text(doc)
else:
text += get_man_text(doc)
else:
# this typically means we couldn't even parse the docstring, not just that the YAML is busted,
# probably a quoting issue.
sys.stderr.write("ERROR: module %s missing documentation (or could not parse documentation)\n" % module)
pager(text)
if __name__ == '__main__':
main()

1
bin/ansible-doc Symbolic link
View File

@ -0,0 +1 @@
ansible

View File

@ -1,959 +0,0 @@
#!/usr/bin/env python
########################################################################
#
# (C) 2013, James Cammarata <jcammarata@ansible.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
#
########################################################################
import datetime
import json
import os
import os.path
import shutil
import subprocess
import sys
import tarfile
import tempfile
import urllib
import urllib2
import yaml
from collections import defaultdict
from distutils.version import LooseVersion
from jinja2 import Environment
from optparse import OptionParser
import ansible.constants as C
import ansible.utils
from ansible.errors import AnsibleError
default_meta_template = """---
galaxy_info:
author: {{ author }}
description: {{description}}
company: {{ company }}
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: {{ issue_tracker_url }}
# Some suggested licenses:
# - BSD (default)
# - MIT
# - GPLv2
# - GPLv3
# - Apache
# - CC-BY
license: {{ license }}
min_ansible_version: {{ min_ansible_version }}
#
# Below are all platforms currently available. Just uncomment
# the ones that apply to your role. If you don't see your
# platform on this list, let us know and we'll get it added!
#
#platforms:
{%- for platform,versions in platforms.iteritems() %}
#- name: {{ platform }}
# versions:
# - all
{%- for version in versions %}
# - {{ version }}
{%- endfor %}
{%- endfor %}
#
# Below are all categories currently available. Just as with
# the platforms above, uncomment those that apply to your role.
#
#categories:
{%- for category in categories %}
#- {{ category.name }}
{%- endfor %}
dependencies: []
# List your role dependencies here, one per line.
# Be sure to remove the '[]' above if you add dependencies
# to this list.
{% for dependency in dependencies %}
#- {{ dependency }}
{% endfor %}
"""
default_readme_template = """Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
"""
#-------------------------------------------------------------------------------------
# Utility functions for parsing actions/options
#-------------------------------------------------------------------------------------
VALID_ACTIONS = ("init", "info", "install", "list", "remove")
SKIP_INFO_KEYS = ("platforms","readme_html", "related", "summary_fields", "average_aw_composite", "average_aw_score", "url" )
def get_action(args):
"""
Get the action the user wants to execute from the
sys argv list.
"""
for i in range(0,len(args)):
arg = args[i]
if arg in VALID_ACTIONS:
del args[i]
return arg
return None
def build_option_parser(action):
"""
Builds an option parser object based on the action
the user wants to execute.
"""
usage = "usage: %%prog [%s] [--help] [options] ..." % "|".join(VALID_ACTIONS)
epilog = "\nSee '%s <command> --help' for more information on a specific command.\n\n" % os.path.basename(sys.argv[0])
OptionParser.format_epilog = lambda self, formatter: self.epilog
parser = OptionParser(usage=usage, epilog=epilog)
if not action:
parser.print_help()
sys.exit()
# options for all actions
# - none yet
# options specific to actions
if action == "info":
parser.set_usage("usage: %prog info [options] role_name[,version]")
elif action == "init":
parser.set_usage("usage: %prog init [options] role_name")
parser.add_option(
'-p', '--init-path', dest='init_path', default="./",
help='The path in which the skeleton role will be created. '
'The default is the current working directory.')
parser.add_option(
'--offline', dest='offline', default=False, action='store_true',
help="Don't query the galaxy API when creating roles")
elif action == "install":
parser.set_usage("usage: %prog install [options] [-r FILE | role_name(s)[,version] | scm+role_repo_url[,version] | tar_file(s)]")
parser.add_option(
'-i', '--ignore-errors', dest='ignore_errors', action='store_true', default=False,
help='Ignore errors and continue with the next specified role.')
parser.add_option(
'-n', '--no-deps', dest='no_deps', action='store_true', default=False,
help='Don\'t download roles listed as dependencies')
parser.add_option(
'-r', '--role-file', dest='role_file',
help='A file containing a list of roles to be imported')
elif action == "remove":
parser.set_usage("usage: %prog remove role1 role2 ...")
elif action == "list":
parser.set_usage("usage: %prog list [role_name]")
# options that apply to more than one action
if action != "init":
parser.add_option(
'-p', '--roles-path', dest='roles_path', default=C.DEFAULT_ROLES_PATH,
help='The path to the directory containing your roles. '
'The default is the roles_path configured in your '
'ansible.cfg file (/etc/ansible/roles if not configured)')
if action in ("info","init","install"):
parser.add_option(
'-s', '--server', dest='api_server', default="galaxy.ansible.com",
help='The API server destination')
if action in ("init","install"):
parser.add_option(
'-f', '--force', dest='force', action='store_true', default=False,
help='Force overwriting an existing role')
# done, return the parser
return parser
def get_opt(options, k, defval=""):
"""
Returns an option from an Optparse values instance.
"""
try:
data = getattr(options, k)
except:
return defval
if k == "roles_path":
if os.pathsep in data:
data = data.split(os.pathsep)[0]
return data
def exit_without_ignore(options, rc=1):
"""
Exits with the specified return code unless the
option --ignore-errors was specified
"""
if not get_opt(options, "ignore_errors", False):
print '- you can use --ignore-errors to skip failed roles.'
sys.exit(rc)
#-------------------------------------------------------------------------------------
# Galaxy API functions
#-------------------------------------------------------------------------------------
def api_get_config(api_server):
"""
Fetches the Galaxy API current version to ensure
the API server is up and reachable.
"""
try:
url = 'https://%s/api/' % api_server
data = json.load(urllib2.urlopen(url))
if not data.get("current_version",None):
return None
else:
return data
except:
return None
def api_lookup_role_by_name(api_server, role_name, notify=True):
"""
Uses the Galaxy API to do a lookup on the role owner/name.
"""
role_name = urllib.quote(role_name)
try:
parts = role_name.split(".")
user_name = ".".join(parts[0:-1])
role_name = parts[-1]
if notify:
print "- downloading role '%s', owned by %s" % (role_name, user_name)
except:
parser.print_help()
print "- invalid role name (%s). Specify role as format: username.rolename" % role_name
sys.exit(1)
url = 'https://%s/api/v1/roles/?owner__username=%s&name=%s' % (api_server,user_name,role_name)
try:
data = json.load(urllib2.urlopen(url))
if len(data["results"]) == 0:
return None
else:
return data["results"][0]
except:
return None
def api_fetch_role_related(api_server, related, role_id):
"""
Uses the Galaxy API to fetch the list of related items for
the given role. The url comes from the 'related' field of
the role.
"""
try:
url = 'https://%s/api/v1/roles/%d/%s/?page_size=50' % (api_server, int(role_id), related)
data = json.load(urllib2.urlopen(url))
results = data['results']
done = (data.get('next', None) == None)
while not done:
url = 'https://%s%s' % (api_server, data['next'])
print url
data = json.load(urllib2.urlopen(url))
results += data['results']
done = (data.get('next', None) == None)
return results
except:
return None
def api_get_list(api_server, what):
"""
Uses the Galaxy API to fetch the list of items specified.
"""
try:
url = 'https://%s/api/v1/%s/?page_size' % (api_server, what)
data = json.load(urllib2.urlopen(url))
if "results" in data:
results = data['results']
else:
results = data
done = True
if "next" in data:
done = (data.get('next', None) == None)
while not done:
url = 'https://%s%s' % (api_server, data['next'])
print url
data = json.load(urllib2.urlopen(url))
results += data['results']
done = (data.get('next', None) == None)
return results
except:
print "- failed to download the %s list" % what
return None
#-------------------------------------------------------------------------------------
# scm repo utility functions
#-------------------------------------------------------------------------------------
def scm_archive_role(scm, role_url, role_version, role_name):
if scm not in ['hg', 'git']:
print "- scm %s is not currently supported" % scm
return False
tempdir = tempfile.mkdtemp()
clone_cmd = [scm, 'clone', role_url, role_name]
with open('/dev/null', 'w') as devnull:
try:
print "- executing: %s" % " ".join(clone_cmd)
popen = subprocess.Popen(clone_cmd, cwd=tempdir, stdout=devnull, stderr=devnull)
except:
raise AnsibleError("error executing: %s" % " ".join(clone_cmd))
rc = popen.wait()
if rc != 0:
print "- command %s failed" % ' '.join(clone_cmd)
print " in directory %s" % tempdir
return False
temp_file = tempfile.NamedTemporaryFile(delete=False, suffix='.tar')
if scm == 'hg':
archive_cmd = ['hg', 'archive', '--prefix', "%s/" % role_name]
if role_version:
archive_cmd.extend(['-r', role_version])
archive_cmd.append(temp_file.name)
if scm == 'git':
archive_cmd = ['git', 'archive', '--prefix=%s/' % role_name, '--output=%s' % temp_file.name]
if role_version:
archive_cmd.append(role_version)
else:
archive_cmd.append('HEAD')
with open('/dev/null', 'w') as devnull:
print "- executing: %s" % " ".join(archive_cmd)
popen = subprocess.Popen(archive_cmd, cwd=os.path.join(tempdir, role_name),
stderr=devnull, stdout=devnull)
rc = popen.wait()
if rc != 0:
print "- command %s failed" % ' '.join(archive_cmd)
print " in directory %s" % tempdir
return False
shutil.rmtree(tempdir, ignore_errors=True)
return temp_file.name
#-------------------------------------------------------------------------------------
# Role utility functions
#-------------------------------------------------------------------------------------
def get_role_path(role_name, options):
"""
Returns the role path based on the roles_path option
and the role name.
"""
roles_path = get_opt(options,'roles_path')
roles_path = os.path.join(roles_path, role_name)
roles_path = os.path.expanduser(roles_path)
return roles_path
def get_role_metadata(role_name, options):
"""
Returns the metadata as YAML, if the file 'meta/main.yml'
exists in the specified role_path
"""
role_path = os.path.join(get_role_path(role_name, options), 'meta/main.yml')
try:
if os.path.isfile(role_path):
f = open(role_path, 'r')
meta_data = yaml.safe_load(f)
f.close()
return meta_data
else:
return None
except:
return None
def get_galaxy_install_info(role_name, options):
"""
Returns the YAML data contained in 'meta/.galaxy_install_info',
if it exists.
"""
try:
info_path = os.path.join(get_role_path(role_name, options), 'meta/.galaxy_install_info')
if os.path.isfile(info_path):
f = open(info_path, 'r')
info_data = yaml.safe_load(f)
f.close()
return info_data
else:
return None
except:
return None
def write_galaxy_install_info(role_name, role_version, options):
"""
Writes a YAML-formatted file to the role's meta/ directory
(named .galaxy_install_info) which contains some information
we can use later for commands like 'list' and 'info'.
"""
info = dict(
version = role_version,
install_date = datetime.datetime.utcnow().strftime("%c"),
)
try:
info_path = os.path.join(get_role_path(role_name, options), 'meta/.galaxy_install_info')
f = open(info_path, 'w+')
info_data = yaml.safe_dump(info, f)
f.close()
except:
return False
return True
def remove_role(role_name, options):
"""
Removes the specified role from the roles path. There is a
sanity check to make sure there's a meta/main.yml file at this
path so the user doesn't blow away random directories
"""
if get_role_metadata(role_name, options):
role_path = get_role_path(role_name, options)
shutil.rmtree(role_path)
return True
else:
return False
def fetch_role(role_name, target, role_data, options):
"""
Downloads the archived role from github to a temp location, extracts
it, and then copies the extracted role to the role library path.
"""
# first grab the file and save it to a temp location
if '://' in role_name:
archive_url = role_name
else:
archive_url = 'https://github.com/%s/%s/archive/%s.tar.gz' % (role_data["github_user"], role_data["github_repo"], target)
print "- downloading role from %s" % archive_url
try:
url_file = urllib2.urlopen(archive_url)
temp_file = tempfile.NamedTemporaryFile(delete=False)
data = url_file.read()
while data:
temp_file.write(data)
data = url_file.read()
temp_file.close()
return temp_file.name
except Exception, e:
# TODO: better urllib2 error handling for error
# messages that are more exact
print "- error: failed to download the file."
return False
def install_role(role_name, role_version, role_filename, options):
# the file is a tar, so open it that way and extract it
# to the specified (or default) roles directory
if not tarfile.is_tarfile(role_filename):
print "- error: the file downloaded was not a tar.gz"
return False
else:
if role_filename.endswith('.gz'):
role_tar_file = tarfile.open(role_filename, "r:gz")
else:
role_tar_file = tarfile.open(role_filename, "r")
# verify the role's meta file
meta_file = None
members = role_tar_file.getmembers()
# next find the metadata file
for member in members:
if "/meta/main.yml" in member.name:
meta_file = member
break
if not meta_file:
print "- error: this role does not appear to have a meta/main.yml file."
return False
else:
try:
meta_file_data = yaml.safe_load(role_tar_file.extractfile(meta_file))
except:
print "- error: this role does not appear to have a valid meta/main.yml file."
return False
# we strip off the top-level directory for all of the files contained within
# the tar file here, since the default is 'github_repo-target', and change it
# to the specified role's name
role_path = os.path.join(get_opt(options, 'roles_path'), role_name)
role_path = os.path.expanduser(role_path)
print "- extracting %s to %s" % (role_name, role_path)
try:
if os.path.exists(role_path):
if not os.path.isdir(role_path):
print "- error: the specified roles path exists and is not a directory."
return False
elif not get_opt(options, "force", False):
print "- error: the specified role %s appears to already exist. Use --force to replace it." % role_name
return False
else:
# using --force, remove the old path
if not remove_role(role_name, options):
print "- error: %s doesn't appear to contain a role." % role_path
print " please remove this directory manually if you really want to put the role here."
return False
else:
os.makedirs(role_path)
# now we do the actual extraction to the role_path
for member in members:
# we only extract files, and remove any relative path
# bits that might be in the file for security purposes
# and drop the leading directory, as mentioned above
if member.isreg():
parts = member.name.split("/")[1:]
final_parts = []
for part in parts:
if part != '..' and '~' not in part and '$' not in part:
final_parts.append(part)
member.name = os.path.join(*final_parts)
role_tar_file.extract(member, role_path)
# write out the install info file for later use
write_galaxy_install_info(role_name, role_version, options)
except OSError, e:
print "- error: you do not have permission to modify files in %s" % role_path
return False
# return the parsed yaml metadata
print "- %s was installed successfully" % role_name
return meta_file_data
#-------------------------------------------------------------------------------------
# Action functions
#-------------------------------------------------------------------------------------
def execute_init(args, options, parser):
"""
Executes the init action, which creates the skeleton framework
of a role that complies with the galaxy metadata format.
"""
init_path = get_opt(options, 'init_path', './')
api_server = get_opt(options, "api_server", "galaxy.ansible.com")
force = get_opt(options, 'force', False)
offline = get_opt(options, 'offline', False)
if not offline:
api_config = api_get_config(api_server)
if not api_config:
print "- the API server (%s) is not responding, please try again later." % api_server
sys.exit(1)
try:
role_name = args.pop(0).strip()
if role_name == "":
raise Exception("")
role_path = os.path.join(init_path, role_name)
if os.path.exists(role_path):
if os.path.isfile(role_path):
print "- the path %s already exists, but is a file - aborting" % role_path
sys.exit(1)
elif not force:
print "- the directory %s already exists." % role_path
print " you can use --force to re-initialize this directory,\n" + \
" however it will reset any main.yml files that may have\n" + \
" been modified there already."
sys.exit(1)
except Exception, e:
parser.print_help()
print "- no role name specified for init"
sys.exit(1)
ROLE_DIRS = ('defaults','files','handlers','meta','tasks','templates','vars')
# create the default README.md
if not os.path.exists(role_path):
os.makedirs(role_path)
readme_path = os.path.join(role_path, "README.md")
f = open(readme_path, "wb")
f.write(default_readme_template)
f.close
for dir in ROLE_DIRS:
dir_path = os.path.join(init_path, role_name, dir)
main_yml_path = os.path.join(dir_path, 'main.yml')
# create the directory if it doesn't exist already
if not os.path.exists(dir_path):
os.makedirs(dir_path)
# now create the main.yml file for that directory
if dir == "meta":
# create a skeleton meta/main.yml with a valid galaxy_info
# datastructure in place, plus with all of the available
# tags/platforms included (but commented out) and the
# dependencies section
platforms = []
if not offline:
platforms = api_get_list(api_server, "platforms") or []
categories = []
if not offline:
categories = api_get_list(api_server, "categories") or []
# group the list of platforms from the api based
# on their names, with the release field being
# appended to a list of versions
platform_groups = defaultdict(list)
for platform in platforms:
platform_groups[platform['name']].append(platform['release'])
platform_groups[platform['name']].sort()
inject = dict(
author = 'your name',
company = 'your company (optional)',
license = 'license (GPLv2, CC-BY, etc)',
issue_tracker_url = 'http://example.com/issue/tracker',
min_ansible_version = '1.2',
platforms = platform_groups,
categories = categories,
)
rendered_meta = Environment().from_string(default_meta_template).render(inject)
f = open(main_yml_path, 'w')
f.write(rendered_meta)
f.close()
pass
elif dir not in ('files','templates'):
# just write a (mostly) empty YAML file for main.yml
f = open(main_yml_path, 'w')
f.write('---\n# %s file for %s\n' % (dir,role_name))
f.close()
print "- %s was created successfully" % role_name
def execute_info(args, options, parser):
"""
Executes the info action. This action prints out detailed
information about an installed role as well as info available
from the galaxy API.
"""
if len(args) == 0:
# the user needs to specify a role
parser.print_help()
print "- you must specify a user/role name"
sys.exit(1)
api_server = get_opt(options, "api_server", "galaxy.ansible.com")
api_config = api_get_config(api_server)
roles_path = get_opt(options, "roles_path")
for role in args:
role_info = {}
install_info = get_galaxy_install_info(role, options)
if install_info:
if 'version' in install_info:
install_info['intalled_version'] = install_info['version']
del install_info['version']
role_info.update(install_info)
remote_data = api_lookup_role_by_name(api_server, role, False)
if remote_data:
role_info.update(remote_data)
metadata = get_role_metadata(role, options)
if metadata:
role_info.update(metadata)
role_spec = ansible.utils.role_spec_parse(role)
if role_spec:
role_info.update(role_spec)
if role_info:
print "- %s:" % (role)
for k in sorted(role_info.keys()):
if k in SKIP_INFO_KEYS:
continue
if isinstance(role_info[k], dict):
print "\t%s: " % (k)
for key in sorted(role_info[k].keys()):
if key in SKIP_INFO_KEYS:
continue
print "\t\t%s: %s" % (key, role_info[k][key])
else:
print "\t%s: %s" % (k, role_info[k])
else:
print "- the role %s was not found" % role
def execute_install(args, options, parser):
"""
Executes the installation action. The args list contains the
roles to be installed, unless -f was specified. The list of roles
can be a name (which will be downloaded via the galaxy API and github),
or it can be a local .tar.gz file.
"""
role_file = get_opt(options, "role_file", None)
if len(args) == 0 and role_file is None:
# the user needs to specify one of either --role-file
# or specify a single user/role name
parser.print_help()
print "- you must specify a user/role name or a roles file"
sys.exit()
elif len(args) == 1 and not role_file is None:
# using a role file is mutually exclusive of specifying
# the role name on the command line
parser.print_help()
print "- please specify a user/role name, or a roles file, but not both"
sys.exit(1)
api_server = get_opt(options, "api_server", "galaxy.ansible.com")
no_deps = get_opt(options, "no_deps", False)
roles_path = get_opt(options, "roles_path")
roles_done = []
if role_file:
f = open(role_file, 'r')
if role_file.endswith('.yaml') or role_file.endswith('.yml'):
roles_left = map(ansible.utils.role_yaml_parse, yaml.safe_load(f))
else:
# roles listed in a file, one per line
roles_left = map(ansible.utils.role_spec_parse, f.readlines())
f.close()
else:
# roles were specified directly, so we'll just go out grab them
# (and their dependencies, unless the user doesn't want us to).
roles_left = map(ansible.utils.role_spec_parse, args)
while len(roles_left) > 0:
# query the galaxy API for the role data
role_data = None
role = roles_left.pop(0)
role_src = role.get("src")
role_scm = role.get("scm")
role_path = role.get("path")
if role_path:
options.roles_path = role_path
else:
options.roles_path = roles_path
if os.path.isfile(role_src):
# installing a local tar.gz
tmp_file = role_src
else:
if role_scm:
# create tar file from scm url
tmp_file = scm_archive_role(role_scm, role_src, role.get("version"), role.get("name"))
elif '://' in role_src:
# just download a URL - version will probably be in the URL
tmp_file = fetch_role(role_src, None, None, options)
else:
# installing from galaxy
api_config = api_get_config(api_server)
if not api_config:
print "- the API server (%s) is not responding, please try again later." % api_server
sys.exit(1)
role_data = api_lookup_role_by_name(api_server, role_src)
if not role_data:
print "- sorry, %s was not found on %s." % (role_src, api_server)
exit_without_ignore(options)
continue
role_versions = api_fetch_role_related(api_server, 'versions', role_data['id'])
if "version" not in role or role['version'] == '':
# convert the version names to LooseVersion objects
# and sort them to get the latest version. If there
# are no versions in the list, we'll grab the head
# of the master branch
if len(role_versions) > 0:
loose_versions = [LooseVersion(a.get('name',None)) for a in role_versions]
loose_versions.sort()
role["version"] = str(loose_versions[-1])
else:
role["version"] = 'master'
elif role['version'] != 'master':
if role_versions and role["version"] not in [a.get('name', None) for a in role_versions]:
print 'role is %s' % role
print "- the specified version (%s) was not found in the list of available versions (%s)." % (role['version'], role_versions)
exit_without_ignore(options)
continue
# download the role. if --no-deps was specified, we stop here,
# otherwise we recursively grab roles and all of their deps.
tmp_file = fetch_role(role_src, role["version"], role_data, options)
installed = False
if tmp_file:
installed = install_role(role.get("name"), role.get("version"), tmp_file, options)
# we're done with the temp file, clean it up
if tmp_file != role_src:
os.unlink(tmp_file)
# install dependencies, if we want them
if not no_deps and installed:
if not role_data:
role_data = get_role_metadata(role.get("name"), options)
role_dependencies = role_data['dependencies']
else:
role_dependencies = role_data['summary_fields']['dependencies'] # api_fetch_role_related(api_server, 'dependencies', role_data['id'])
if not role_dependencies:
role_dependencies = []
for dep in role_dependencies:
if isinstance(dep, basestring):
dep = ansible.utils.role_spec_parse(dep)
else:
dep = ansible.utils.role_yaml_parse(dep)
if not get_role_metadata(dep["name"], options):
if dep not in roles_left:
print '- adding dependency: %s' % dep["name"]
roles_left.append(dep)
else:
print '- dependency %s already pending installation.' % dep["name"]
else:
print '- dependency %s is already installed, skipping.' % dep["name"]
if not tmp_file or not installed:
print "- %s was NOT installed successfully." % role.get("name")
exit_without_ignore(options)
sys.exit(0)
def execute_remove(args, options, parser):
"""
Executes the remove action. The args list contains the list
of roles to be removed. This list can contain more than one role.
"""
if len(args) == 0:
parser.print_help()
print '- you must specify at least one role to remove.'
sys.exit()
for role in args:
if get_role_metadata(role, options):
if remove_role(role, options):
print '- successfully removed %s' % role
else:
print "- failed to remove role: %s" % role
else:
print '- %s is not installed, skipping.' % role
sys.exit(0)
def execute_list(args, options, parser):
"""
Executes the list action. The args list can contain zero
or one role. If one is specified, only that role will be
shown, otherwise all roles in the specified directory will
be shown.
"""
if len(args) > 1:
print "- please specify only one role to list, or specify no roles to see a full list"
sys.exit(1)
if len(args) == 1:
# show only the request role, if it exists
role_name = args[0]
metadata = get_role_metadata(role_name, options)
if metadata:
install_info = get_galaxy_install_info(role_name, options)
version = None
if install_info:
version = install_info.get("version", None)
if not version:
version = "(unknown version)"
# show some more info about single roles here
print "- %s, %s" % (role_name, version)
else:
print "- the role %s was not found" % role_name
else:
# show all valid roles in the roles_path directory
roles_path = get_opt(options, 'roles_path')
roles_path = os.path.expanduser(roles_path)
if not os.path.exists(roles_path):
parser.print_help()
print "- the path %s does not exist. Please specify a valid path with --roles-path" % roles_path
sys.exit(1)
elif not os.path.isdir(roles_path):
print "- %s exists, but it is not a directory. Please specify a valid path with --roles-path" % roles_path
parser.print_help()
sys.exit(1)
path_files = os.listdir(roles_path)
for path_file in path_files:
if get_role_metadata(path_file, options):
install_info = get_galaxy_install_info(path_file, options)
version = None
if install_info:
version = install_info.get("version", None)
if not version:
version = "(unknown version)"
print "- %s, %s" % (path_file, version)
sys.exit(0)
#-------------------------------------------------------------------------------------
# The main entry point
#-------------------------------------------------------------------------------------
def main():
# parse the CLI options
action = get_action(sys.argv)
parser = build_option_parser(action)
(options, args) = parser.parse_args()
# execute the desired action
if 1: #try:
fn = globals()["execute_%s" % action]
fn(args, options, parser)
#except KeyError, e:
# print "- error: %s is not a valid action. Valid actions are: %s" % (action, ", ".join(VALID_ACTIONS))
# sys.exit(1)
if __name__ == "__main__":
main()

1
bin/ansible-galaxy Symbolic link
View File

@ -0,0 +1 @@
ansible

View File

@ -1,330 +0,0 @@
#!/usr/bin/env python
# (C) 2012, Michael DeHaan, <michael.dehaan@gmail.com>
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
#######################################################
__requires__ = ['ansible']
try:
import pkg_resources
except Exception:
# Use pkg_resources to find the correct versions of libraries and set
# sys.path appropriately when there are multiversion installs. But we
# have code that better expresses the errors in the places where the code
# is actually used (the deps are optional for many code paths) so we don't
# want to fail here.
pass
import sys
import os
import stat
# Augment PYTHONPATH to find Python modules relative to this file path
# This is so that we can find the modules when running from a local checkout
# installed as editable with `pip install -e ...` or `python setup.py develop`
local_module_path = os.path.abspath(
os.path.join(os.path.dirname(__file__), '..', 'lib')
)
sys.path.append(local_module_path)
import ansible.playbook
import ansible.constants as C
import ansible.utils.template
from ansible import errors
from ansible import callbacks
from ansible import utils
from ansible.color import ANSIBLE_COLOR, stringc
from ansible.callbacks import display
def colorize(lead, num, color):
""" Print 'lead' = 'num' in 'color' """
if num != 0 and ANSIBLE_COLOR and color is not None:
return "%s%s%-15s" % (stringc(lead, color), stringc("=", color), stringc(str(num), color))
else:
return "%s=%-4s" % (lead, str(num))
def hostcolor(host, stats, color=True):
if ANSIBLE_COLOR and color:
if stats['failures'] != 0 or stats['unreachable'] != 0:
return "%-37s" % stringc(host, 'red')
elif stats['changed'] != 0:
return "%-37s" % stringc(host, 'yellow')
else:
return "%-37s" % stringc(host, 'green')
return "%-26s" % host
def main(args):
''' run ansible-playbook operations '''
# create parser for CLI options
parser = utils.base_parser(
constants=C,
usage = "%prog playbook.yml",
connect_opts=True,
runas_opts=True,
subset_opts=True,
check_opts=True,
diff_opts=True
)
#parser.add_option('--vault-password', dest="vault_password",
# help="password for vault encrypted files")
parser.add_option('-t', '--tags', dest='tags', default='all',
help="only run plays and tasks tagged with these values")
parser.add_option('--skip-tags', dest='skip_tags',
help="only run plays and tasks whose tags do not match these values")
parser.add_option('--syntax-check', dest='syntax', action='store_true',
help="perform a syntax check on the playbook, but do not execute it")
parser.add_option('--list-tasks', dest='listtasks', action='store_true',
help="list all tasks that would be executed")
parser.add_option('--list-tags', dest='listtags', action='store_true',
help="list all available tags")
parser.add_option('--step', dest='step', action='store_true',
help="one-step-at-a-time: confirm each task before running")
parser.add_option('--start-at-task', dest='start_at',
help="start the playbook at the task matching this name")
parser.add_option('--force-handlers', dest='force_handlers',
default=C.DEFAULT_FORCE_HANDLERS, action='store_true',
help="run handlers even if a task fails")
parser.add_option('--flush-cache', dest='flush_cache', action='store_true',
help="clear the fact cache")
options, args = parser.parse_args(args)
if len(args) == 0:
parser.print_help(file=sys.stderr)
return 1
# privlege escalation command line arguments need to be mutually exclusive
utils.check_mutually_exclusive_privilege(options, parser)
if (options.ask_vault_pass and options.vault_password_file):
parser.error("--ask-vault-pass and --vault-password-file are mutually exclusive")
sshpass = None
becomepass = None
vault_pass = None
options.ask_vault_pass = options.ask_vault_pass or C.DEFAULT_ASK_VAULT_PASS
if options.listhosts or options.syntax or options.listtasks or options.listtags:
(_, _, vault_pass) = utils.ask_passwords(ask_vault_pass=options.ask_vault_pass)
else:
options.ask_pass = options.ask_pass or C.DEFAULT_ASK_PASS
# Never ask for an SSH password when we run with local connection
if options.connection == "local":
options.ask_pass = False
# set pe options
utils.normalize_become_options(options)
prompt_method = utils.choose_pass_prompt(options)
(sshpass, becomepass, vault_pass) = utils.ask_passwords(ask_pass=options.ask_pass,
become_ask_pass=options.become_ask_pass,
ask_vault_pass=options.ask_vault_pass,
become_method=prompt_method)
# read vault_pass from a file
if not options.ask_vault_pass and options.vault_password_file:
vault_pass = utils.read_vault_file(options.vault_password_file)
extra_vars = utils.parse_extra_vars(options.extra_vars, vault_pass)
only_tags = options.tags.split(",")
skip_tags = options.skip_tags
if options.skip_tags is not None:
skip_tags = options.skip_tags.split(",")
for playbook in args:
if not os.path.exists(playbook):
raise errors.AnsibleError("the playbook: %s could not be found" % playbook)
if not (os.path.isfile(playbook) or stat.S_ISFIFO(os.stat(playbook).st_mode)):
raise errors.AnsibleError("the playbook: %s does not appear to be a file" % playbook)
inventory = ansible.inventory.Inventory(options.inventory, vault_password=vault_pass)
# Note: slightly wrong, this is written so that implicit localhost
# (which is not returned in list_hosts()) is taken into account for
# warning if inventory is empty. But it can't be taken into account for
# checking if limit doesn't match any hosts. Instead we don't worry about
# limit if only implicit localhost was in inventory to start with.
#
# Fix this in v2
no_hosts = False
if len(inventory.list_hosts()) == 0:
# Empty inventory
utils.warning("provided hosts list is empty, only localhost is available")
no_hosts = True
inventory.subset(options.subset)
if len(inventory.list_hosts()) == 0 and no_hosts is False:
# Invalid limit
raise errors.AnsibleError("Specified --limit does not match any hosts")
# run all playbooks specified on the command line
for playbook in args:
stats = callbacks.AggregateStats()
playbook_cb = callbacks.PlaybookCallbacks(verbose=utils.VERBOSITY)
if options.step:
playbook_cb.step = options.step
if options.start_at:
playbook_cb.start_at = options.start_at
runner_cb = callbacks.PlaybookRunnerCallbacks(stats, verbose=utils.VERBOSITY)
pb = ansible.playbook.PlayBook(
playbook=playbook,
module_path=options.module_path,
inventory=inventory,
forks=options.forks,
remote_user=options.remote_user,
remote_pass=sshpass,
callbacks=playbook_cb,
runner_callbacks=runner_cb,
stats=stats,
timeout=options.timeout,
transport=options.connection,
become=options.become,
become_method=options.become_method,
become_user=options.become_user,
become_pass=becomepass,
extra_vars=extra_vars,
private_key_file=options.private_key_file,
only_tags=only_tags,
skip_tags=skip_tags,
check=options.check,
diff=options.diff,
vault_password=vault_pass,
force_handlers=options.force_handlers,
)
if options.flush_cache:
display(callbacks.banner("FLUSHING FACT CACHE"))
pb.SETUP_CACHE.flush()
if options.listhosts or options.listtasks or options.syntax or options.listtags:
print ''
print 'playbook: %s' % playbook
print ''
playnum = 0
for (play_ds, play_basedir) in zip(pb.playbook, pb.play_basedirs):
playnum += 1
play = ansible.playbook.Play(pb, play_ds, play_basedir,
vault_password=pb.vault_password)
label = play.name
hosts = pb.inventory.list_hosts(play.hosts)
if options.listhosts:
print ' play #%d (%s): host count=%d' % (playnum, label, len(hosts))
for host in hosts:
print ' %s' % host
if options.listtags or options.listtasks:
print ' play #%d (%s):\tTAGS: [%s]' % (playnum, label,','.join(sorted(set(play.tags))))
if options.listtags:
tags = []
for task in pb.tasks_to_run_in_play(play):
tags.extend(task.tags)
print ' TASK TAGS: [%s]' % (', '.join(sorted(set(tags).difference(['untagged']))))
if options.listtasks:
for task in pb.tasks_to_run_in_play(play):
if getattr(task, 'name', None) is not None:
# meta tasks have no names
print ' %s\tTAGS: [%s]' % (task.name, ', '.join(sorted(set(task.tags).difference(['untagged']))))
if options.listhosts or options.listtasks or options.listtags:
print ''
continue
if options.syntax:
# if we've not exited by now then we are fine.
print 'Playbook Syntax is fine'
return 0
failed_hosts = []
unreachable_hosts = []
try:
pb.run()
hosts = sorted(pb.stats.processed.keys())
display(callbacks.banner("PLAY RECAP"))
playbook_cb.on_stats(pb.stats)
for h in hosts:
t = pb.stats.summarize(h)
if t['failures'] > 0:
failed_hosts.append(h)
if t['unreachable'] > 0:
unreachable_hosts.append(h)
retries = failed_hosts + unreachable_hosts
if C.RETRY_FILES_ENABLED and len(retries) > 0:
filename = pb.generate_retry_inventory(retries)
if filename:
display(" to retry, use: --limit @%s\n" % filename)
for h in hosts:
t = pb.stats.summarize(h)
display("%s : %s %s %s %s" % (
hostcolor(h, t),
colorize('ok', t['ok'], 'green'),
colorize('changed', t['changed'], 'yellow'),
colorize('unreachable', t['unreachable'], 'red'),
colorize('failed', t['failures'], 'red')),
screen_only=True
)
display("%s : %s %s %s %s" % (
hostcolor(h, t, False),
colorize('ok', t['ok'], None),
colorize('changed', t['changed'], None),
colorize('unreachable', t['unreachable'], None),
colorize('failed', t['failures'], None)),
log_only=True
)
print ""
if len(failed_hosts) > 0:
return 2
if len(unreachable_hosts) > 0:
return 3
except errors.AnsibleError, e:
display("ERROR: %s" % e, color='red')
return 1
return 0
if __name__ == "__main__":
display(" ", log_only=True)
display(" ".join(sys.argv), log_only=True)
display(" ", log_only=True)
try:
sys.exit(main(sys.argv[1:]))
except errors.AnsibleError, e:
display("ERROR: %s" % e, color='red', stderr=True)
sys.exit(1)
except KeyboardInterrupt, ke:
display("ERROR: interrupted", color='red', stderr=True)
sys.exit(1)

1
bin/ansible-playbook Symbolic link
View File

@ -0,0 +1 @@
ansible

View File

@ -1,257 +0,0 @@
#!/usr/bin/env python
# (c) 2012, Stephen Fromm <sfromm@gmail.com>
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
#
# ansible-pull is a script that runs ansible in local mode
# after checking out a playbooks directory from source repo. There is an
# example playbook to bootstrap this script in the examples/ dir which
# installs ansible and sets it up to run on cron.
# usage:
# ansible-pull -d /var/lib/ansible \
# -U http://example.net/content.git [-C production] \
# [path/playbook.yml]
#
# the -d and -U arguments are required; the -C argument is optional.
#
# ansible-pull accepts an optional argument to specify a playbook
# location underneath the workdir and then searches the source repo
# for playbooks in the following order, stopping at the first match:
#
# 1. $workdir/path/playbook.yml, if specified
# 2. $workdir/$fqdn.yml
# 3. $workdir/$hostname.yml
# 4. $workdir/local.yml
#
# the source repo must contain at least one of these playbooks.
import os
import shutil
import sys
import datetime
import socket
import random
import time
from ansible import utils
from ansible.utils import cmd_functions
from ansible import errors
from ansible import inventory
DEFAULT_REPO_TYPE = 'git'
DEFAULT_PLAYBOOK = 'local.yml'
PLAYBOOK_ERRORS = {1: 'File does not exist',
2: 'File is not readable'}
VERBOSITY=0
def increment_debug(option, opt, value, parser):
global VERBOSITY
VERBOSITY += 1
def try_playbook(path):
if not os.path.exists(path):
return 1
if not os.access(path, os.R_OK):
return 2
return 0
def select_playbook(path, args):
playbook = None
if len(args) > 0 and args[0] is not None:
playbook = "%s/%s" % (path, args[0])
rc = try_playbook(playbook)
if rc != 0:
print >>sys.stderr, "%s: %s" % (playbook, PLAYBOOK_ERRORS[rc])
return None
return playbook
else:
fqdn = socket.getfqdn()
hostpb = "%s/%s.yml" % (path, fqdn)
shorthostpb = "%s/%s.yml" % (path, fqdn.split('.')[0])
localpb = "%s/%s" % (path, DEFAULT_PLAYBOOK)
errors = []
for pb in [hostpb, shorthostpb, localpb]:
rc = try_playbook(pb)
if rc == 0:
playbook = pb
break
else:
errors.append("%s: %s" % (pb, PLAYBOOK_ERRORS[rc]))
if playbook is None:
print >>sys.stderr, "\n".join(errors)
return playbook
def main(args):
""" Set up and run a local playbook """
usage = "%prog [options] [playbook.yml]"
parser = utils.SortedOptParser(usage=usage)
parser.add_option('--purge', default=False, action='store_true',
help='purge checkout after playbook run')
parser.add_option('-o', '--only-if-changed', dest='ifchanged', default=False, action='store_true',
help='only run the playbook if the repository has been updated')
parser.add_option('-s', '--sleep', dest='sleep', default=None,
help='sleep for random interval (between 0 and n number of seconds) before starting. this is a useful way to disperse git requests')
parser.add_option('-f', '--force', dest='force', default=False,
action='store_true',
help='run the playbook even if the repository could '
'not be updated')
parser.add_option('-d', '--directory', dest='dest', default=None,
help='directory to checkout repository to')
#parser.add_option('-l', '--live', default=True, action='store_live',
# help='Print the ansible-playbook output while running')
parser.add_option('-U', '--url', dest='url', default=None,
help='URL of the playbook repository')
parser.add_option('-C', '--checkout', dest='checkout',
help='branch/tag/commit to checkout. '
'Defaults to behavior of repository module.')
parser.add_option('-i', '--inventory-file', dest='inventory',
help="location of the inventory host file")
parser.add_option('-e', '--extra-vars', dest="extra_vars", action="append",
help="set additional variables as key=value or YAML/JSON", default=[])
parser.add_option('-v', '--verbose', default=False, action="callback",
callback=increment_debug,
help='Pass -vvvv to ansible-playbook')
parser.add_option('-m', '--module-name', dest='module_name',
default=DEFAULT_REPO_TYPE,
help='Module name used to check out repository. '
'Default is %s.' % DEFAULT_REPO_TYPE)
parser.add_option('--vault-password-file', dest='vault_password_file',
help="vault password file")
parser.add_option('-K', '--ask-sudo-pass', default=False, dest='ask_sudo_pass', action='store_true',
help='ask for sudo password')
parser.add_option('-t', '--tags', dest='tags', default=False,
help='only run plays and tasks tagged with these values')
parser.add_option('--accept-host-key', default=False, dest='accept_host_key', action='store_true',
help='adds the hostkey for the repo url if not already added')
parser.add_option('--key-file', dest='key_file',
help="Pass '-i <key_file>' to the SSH arguments used by git.")
options, args = parser.parse_args(args)
hostname = socket.getfqdn()
if not options.dest:
# use a hostname dependent directory, in case of $HOME on nfs
options.dest = utils.prepare_writeable_dir('~/.ansible/pull/%s' % hostname)
options.dest = os.path.abspath(options.dest)
if not options.url:
parser.error("URL for repository not specified, use -h for help")
return 1
now = datetime.datetime.now()
print now.strftime("Starting ansible-pull at %F %T")
# Attempt to use the inventory passed in as an argument
# It might not yet have been downloaded so use localhost if note
if not options.inventory or not os.path.exists(options.inventory):
inv_opts = 'localhost,'
else:
inv_opts = options.inventory
limit_opts = 'localhost:%s:127.0.0.1' % hostname
repo_opts = "name=%s dest=%s" % (options.url, options.dest)
if VERBOSITY == 0:
base_opts = '-c local --limit "%s"' % limit_opts
elif VERBOSITY > 0:
debug_level = ''.join([ "v" for x in range(0, VERBOSITY) ])
base_opts = '-%s -c local --limit "%s"' % (debug_level, limit_opts)
if options.checkout:
repo_opts += ' version=%s' % options.checkout
# Only git module is supported
if options.module_name == DEFAULT_REPO_TYPE:
if options.accept_host_key:
repo_opts += ' accept_hostkey=yes'
if options.key_file:
repo_opts += ' key_file=%s' % options.key_file
path = utils.plugins.module_finder.find_plugin(options.module_name)
if path is None:
sys.stderr.write("module '%s' not found.\n" % options.module_name)
return 1
bin_path = os.path.dirname(os.path.abspath(__file__))
cmd = '%s/ansible localhost -i "%s" %s -m %s -a "%s"' % (
bin_path, inv_opts, base_opts, options.module_name, repo_opts
)
for ev in options.extra_vars:
cmd += ' -e "%s"' % ev
if options.sleep:
try:
secs = random.randint(0,int(options.sleep));
except ValueError:
parser.error("%s is not a number." % options.sleep)
return 1
print >>sys.stderr, "Sleeping for %d seconds..." % secs
time.sleep(secs);
# RUN THe CHECKOUT COMMAND
rc, out, err = cmd_functions.run_cmd(cmd, live=True)
if rc != 0:
if options.force:
print >>sys.stderr, "Unable to update repository. Continuing with (forced) run of playbook."
else:
return rc
elif options.ifchanged and '"changed": true' not in out:
print "Repository has not changed, quitting."
return 0
playbook = select_playbook(options.dest, args)
if playbook is None:
print >>sys.stderr, "Could not find a playbook to run."
return 1
cmd = '%s/ansible-playbook %s %s' % (bin_path, base_opts, playbook)
if options.vault_password_file:
cmd += " --vault-password-file=%s" % options.vault_password_file
if options.inventory:
cmd += ' -i "%s"' % options.inventory
for ev in options.extra_vars:
cmd += ' -e "%s"' % ev
if options.ask_sudo_pass:
cmd += ' -K'
if options.tags:
cmd += ' -t "%s"' % options.tags
os.chdir(options.dest)
# RUN THE PLAYBOOK COMMAND
rc, out, err = cmd_functions.run_cmd(cmd, live=True)
if options.purge:
os.chdir('/')
try:
shutil.rmtree(options.dest)
except Exception, e:
print >>sys.stderr, "Failed to remove %s: %s" % (options.dest, str(e))
return rc
if __name__ == '__main__':
try:
sys.exit(main(sys.argv[1:]))
except KeyboardInterrupt, e:
print >>sys.stderr, "Exit on user request.\n"
sys.exit(1)

1
bin/ansible-pull Symbolic link
View File

@ -0,0 +1 @@
ansible

View File

@ -1,241 +0,0 @@
#!/usr/bin/env python
# (c) 2014, James Tanner <tanner.jc@gmail.com>
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
#
# ansible-vault is a script that encrypts/decrypts YAML files. See
# http://docs.ansible.com/playbooks_vault.html for more details.
__requires__ = ['ansible']
try:
import pkg_resources
except Exception:
# Use pkg_resources to find the correct versions of libraries and set
# sys.path appropriately when there are multiversion installs. But we
# have code that better expresses the errors in the places where the code
# is actually used (the deps are optional for many code paths) so we don't
# want to fail here.
pass
import os
import sys
import traceback
import ansible.constants as C
from ansible import utils
from ansible import errors
from ansible.utils.vault import VaultEditor
from optparse import OptionParser
#-------------------------------------------------------------------------------------
# Utility functions for parsing actions/options
#-------------------------------------------------------------------------------------
VALID_ACTIONS = ("create", "decrypt", "edit", "encrypt", "rekey", "view")
def build_option_parser(action):
"""
Builds an option parser object based on the action
the user wants to execute.
"""
usage = "usage: %%prog [%s] [--help] [options] file_name" % "|".join(VALID_ACTIONS)
epilog = "\nSee '%s <command> --help' for more information on a specific command.\n\n" % os.path.basename(sys.argv[0])
OptionParser.format_epilog = lambda self, formatter: self.epilog
parser = OptionParser(usage=usage, epilog=epilog)
if not action:
parser.print_help()
sys.exit()
# options for all actions
#parser.add_option('-c', '--cipher', dest='cipher', default="AES256", help="cipher to use")
parser.add_option('--debug', dest='debug', action="store_true", help="debug")
parser.add_option('--vault-password-file', dest='password_file',
help="vault password file", default=C.DEFAULT_VAULT_PASSWORD_FILE)
# options specific to actions
if action == "create":
parser.set_usage("usage: %prog create [options] file_name")
elif action == "decrypt":
parser.set_usage("usage: %prog decrypt [options] file_name")
elif action == "edit":
parser.set_usage("usage: %prog edit [options] file_name")
elif action == "view":
parser.set_usage("usage: %prog view [options] file_name")
elif action == "encrypt":
parser.set_usage("usage: %prog encrypt [options] file_name")
elif action == "rekey":
parser.set_usage("usage: %prog rekey [options] file_name")
# done, return the parser
return parser
def get_action(args):
"""
Get the action the user wants to execute from the
sys argv list.
"""
for i in range(0,len(args)):
arg = args[i]
if arg in VALID_ACTIONS:
del args[i]
return arg
return None
def get_opt(options, k, defval=""):
"""
Returns an option from an Optparse values instance.
"""
try:
data = getattr(options, k)
except:
return defval
if k == "roles_path":
if os.pathsep in data:
data = data.split(os.pathsep)[0]
return data
#-------------------------------------------------------------------------------------
# Command functions
#-------------------------------------------------------------------------------------
def execute_create(args, options, parser):
if len(args) > 1:
raise errors.AnsibleError("'create' does not accept more than one filename")
if not options.password_file:
password, new_password = utils.ask_vault_passwords(ask_vault_pass=True, confirm_vault=True)
else:
password = utils.read_vault_file(options.password_file)
cipher = 'AES256'
if hasattr(options, 'cipher'):
cipher = options.cipher
this_editor = VaultEditor(cipher, password, args[0])
this_editor.create_file()
def execute_decrypt(args, options, parser):
if not options.password_file:
password, new_password = utils.ask_vault_passwords(ask_vault_pass=True)
else:
password = utils.read_vault_file(options.password_file)
cipher = 'AES256'
if hasattr(options, 'cipher'):
cipher = options.cipher
for f in args:
this_editor = VaultEditor(cipher, password, f)
this_editor.decrypt_file()
print "Decryption successful"
def execute_edit(args, options, parser):
if len(args) > 1:
raise errors.AnsibleError("edit does not accept more than one filename")
if not options.password_file:
password, new_password = utils.ask_vault_passwords(ask_vault_pass=True)
else:
password = utils.read_vault_file(options.password_file)
cipher = None
for f in args:
this_editor = VaultEditor(cipher, password, f)
this_editor.edit_file()
def execute_view(args, options, parser):
if len(args) > 1:
raise errors.AnsibleError("view does not accept more than one filename")
if not options.password_file:
password, new_password = utils.ask_vault_passwords(ask_vault_pass=True)
else:
password = utils.read_vault_file(options.password_file)
cipher = None
for f in args:
this_editor = VaultEditor(cipher, password, f)
this_editor.view_file()
def execute_encrypt(args, options, parser):
if not options.password_file:
password, new_password = utils.ask_vault_passwords(ask_vault_pass=True, confirm_vault=True)
else:
password = utils.read_vault_file(options.password_file)
cipher = 'AES256'
if hasattr(options, 'cipher'):
cipher = options.cipher
for f in args:
this_editor = VaultEditor(cipher, password, f)
this_editor.encrypt_file()
print "Encryption successful"
def execute_rekey(args, options, parser):
if not options.password_file:
password, __ = utils.ask_vault_passwords(ask_vault_pass=True)
else:
password = utils.read_vault_file(options.password_file)
__, new_password = utils.ask_vault_passwords(ask_vault_pass=False, ask_new_vault_pass=True, confirm_new=True)
cipher = None
for f in args:
this_editor = VaultEditor(cipher, password, f)
this_editor.rekey_file(new_password)
print "Rekey successful"
#-------------------------------------------------------------------------------------
# MAIN
#-------------------------------------------------------------------------------------
def main():
action = get_action(sys.argv)
parser = build_option_parser(action)
(options, args) = parser.parse_args()
if not len(args):
raise errors.AnsibleError(
"The '%s' command requires a filename as the first argument" % action
)
# execute the desired action
try:
fn = globals()["execute_%s" % action]
fn(args, options, parser)
except Exception, err:
if options.debug:
print traceback.format_exc()
print "ERROR:",err
sys.exit(1)
if __name__ == "__main__":
main()

1
bin/ansible-vault Symbolic link
View File

@ -0,0 +1 @@
ansible

17
contrib/README.md Normal file
View File

@ -0,0 +1,17 @@
inventory
=========
Inventory scripts allow you to store your hosts, groups, and variables in any way
you like. Examples include discovering inventory from EC2 or pulling it from
Cobbler. These could also be used to interface with LDAP or database.
chmod +x an inventory plugin and either name it /etc/ansible/hosts or use ansible
with -i to designate the path to the script. You might also need to copy a configuration
file with the same name and/or set environment variables, the scripts or configuration
files have more details.
contributions welcome
=====================
Send in pull requests to add plugins of your own. The sky is the limit!

View File

@ -45,26 +45,24 @@ import os
import sys
import time
import ConfigParser
import urllib2
import base64
try:
import json
except ImportError:
import simplejson as json
from ansible.module_utils.urls import open_url
def api_get(link, config):
try:
if link == None:
request = urllib2.Request(config.get('api','uri')+config.get('api','login_path'))
request.add_header("Accept",config.get('api','login_type'))
url = config.get('api','uri') + config.get('api','login_path')
headers = {"Accept": config.get('api','login_type')}
else:
request = urllib2.Request(link['href']+'?limit=0')
request.add_header("Accept",link['type'])
# Auth
base64string = base64.encodestring('%s:%s' % (config.get('auth','apiuser'),config.get('auth','apipass'))).replace('\n', '')
request.add_header("Authorization", "Basic %s" % base64string)
result = urllib2.urlopen(request)
url = link['href'] + '?limit=0'
headers = {"Accept": link['type']}
result = open_url(url, headers=headers, url_username=config.get('auth','apiuser').replace('\n', ''),
url_password=config.get('auth','apipass').replace('\n', ''))
return json.loads(result.read())
except:
return None
@ -76,7 +74,7 @@ def save_cache(data, config):
cache = open('/'.join([dpath,'inventory']), 'w')
cache.write(json.dumps(data))
cache.close()
except IOError, e:
except IOError as e:
pass # not really sure what to do here
@ -88,7 +86,7 @@ def get_cache(cache_item, config):
cache = open('/'.join([dpath,'inventory']), 'r')
inv = cache.read()
cache.close()
except IOError, e:
except IOError as e:
pass # not really sure what to do here
return inv
@ -172,7 +170,7 @@ def generate_inv_from_api(enterprise_entity,config):
else:
vm_metadata = metadata['metadata']['metadata']
inventory['_meta']['hostvars'][vm_nic] = vm_metadata
except Exception, e:
except Exception as e:
pass
inventory[vm_vapp]['children'].append(vmcollection['name'])
@ -183,7 +181,7 @@ def generate_inv_from_api(enterprise_entity,config):
inventory[vmcollection['name']].append(vm_nic)
return inventory
except Exception, e:
except Exception as e:
# Return empty hosts output
return { 'all': {'hosts': []}, '_meta': { 'hostvars': {} } }
@ -214,7 +212,7 @@ if __name__ == '__main__':
try:
login = api_get(None,config)
enterprise = next(link for link in (login['links']) if (link['rel']=='enterprise'))
except Exception, e:
except Exception as e:
enterprise = None
if cache_available(config):

View File

@ -37,6 +37,7 @@ import re
from time import time
import ConfigParser
from six import iteritems, string_types
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
import libcloud.security as sec
@ -79,7 +80,7 @@ class LibcloudInventory(object):
else:
data_to_print = self.json_format_dict(self.inventory, True)
print data_to_print
print(data_to_print)
def is_cache_valid(self):
@ -222,12 +223,17 @@ class LibcloudInventory(object):
self.push(self.inventory, self.to_safe('type_' + node.instance_type), dest)
'''
# Inventory: Group by key pair
if node.extra['keyname']:
self.push(self.inventory, self.to_safe('key_' + node.extra['keyname']), dest)
if node.extra['key_name']:
self.push(self.inventory, self.to_safe('key_' + node.extra['key_name']), dest)
# Inventory: Group by security group, quick thing to handle single sg
if node.extra['securitygroup']:
self.push(self.inventory, self.to_safe('sg_' + node.extra['securitygroup'][0]), dest)
if node.extra['security_group']:
self.push(self.inventory, self.to_safe('sg_' + node.extra['security_group'][0]), dest)
# Inventory: Group by tag
if node.extra['tags']:
for tagkey in node.extra['tags'].keys():
self.push(self.inventory, self.to_safe('tag_' + tagkey + '_' + node.extra['tags'][tagkey]), dest)
def get_host_info(self):
'''
@ -254,16 +260,16 @@ class LibcloudInventory(object):
key = self.to_safe('ec2_' + key)
# Handle complex types
if type(value) in [int, bool]:
if isinstance(value, (int, bool)):
instance_vars[key] = value
elif type(value) in [str, unicode]:
elif isinstance(value, string_types):
instance_vars[key] = value.strip()
elif type(value) == type(None):
elif value is None:
instance_vars[key] = ''
elif key == 'ec2_region':
instance_vars[key] = value.name
elif key == 'ec2_tags':
for k, v in value.iteritems():
for k, v in iteritems(value):
key = self.to_safe('ec2_tag_' + k)
instance_vars[key] = v
elif key == 'ec2_groups':
@ -277,9 +283,9 @@ class LibcloudInventory(object):
else:
pass
# TODO Product codes if someone finds them useful
#print key
#print type(value)
#print value
#print(key)
#print(type(value))
#print(value)
return self.json_format_dict(instance_vars, True)

View File

@ -0,0 +1,5 @@
[cloudstack]
#endpoint = https://api.exoscale.ch/compute
endpoint = https://cloud.example.com/client/api
key = cloudstack api key
secret = cloudstack api secret

236
contrib/inventory/cloudstack.py Executable file
View File

@ -0,0 +1,236 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# (c) 2015, René Moser <mail@renemoser.net>
#
# This file is part of Ansible,
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
######################################################################
"""
Ansible CloudStack external inventory script.
=============================================
Generates Ansible inventory from CloudStack. Configuration is read from
'cloudstack.ini'. If you need to pass the project, write a simple wrapper
script, e.g. project_cloudstack.sh:
#!/bin/bash
cloudstack.py --project <your_project> $@
When run against a specific host, this script returns the following attributes
based on the data obtained from CloudStack API:
"web01": {
"cpu_number": 2,
"nic": [
{
"ip": "10.102.76.98",
"mac": "02:00:50:99:00:01",
"type": "Isolated",
"netmask": "255.255.255.0",
"gateway": "10.102.76.1"
},
{
"ip": "10.102.138.63",
"mac": "06:b7:5a:00:14:84",
"type": "Shared",
"netmask": "255.255.255.0",
"gateway": "10.102.138.1"
}
],
"default_ip": "10.102.76.98",
"zone": "ZUERICH",
"created": "2014-07-02T07:53:50+0200",
"hypervisor": "VMware",
"memory": 2048,
"state": "Running",
"tags": [],
"cpu_speed": 1800,
"affinity_group": [],
"service_offering": "Small",
"cpu_used": "62%"
}
usage: cloudstack.py [--list] [--host HOST] [--project PROJECT]
"""
from __future__ import print_function
import os
import sys
import argparse
try:
import json
except:
import simplejson as json
try:
from cs import CloudStack, CloudStackException, read_config
except ImportError:
print("Error: CloudStack library must be installed: pip install cs.",
file=sys.stderr)
sys.exit(1)
class CloudStackInventory(object):
def __init__(self):
parser = argparse.ArgumentParser()
parser.add_argument('--host')
parser.add_argument('--list', action='store_true')
parser.add_argument('--project')
options = parser.parse_args()
try:
self.cs = CloudStack(**read_config())
except CloudStackException as e:
print("Error: Could not connect to CloudStack API", file=sys.stderr)
project_id = ''
if options.project:
project_id = self.get_project_id(options.project)
if options.host:
data = self.get_host(options.host)
print(json.dumps(data, indent=2))
elif options.list:
data = self.get_list()
print(json.dumps(data, indent=2))
else:
print("usage: --list | --host <hostname> [--project <project>]",
file=sys.stderr)
sys.exit(1)
def get_project_id(self, project):
projects = self.cs.listProjects()
if projects:
for p in projects['project']:
if p['name'] == project or p['id'] == project:
return p['id']
print("Error: Project %s not found." % project, file=sys.stderr)
sys.exit(1)
def get_host(self, name, project_id=''):
hosts = self.cs.listVirtualMachines(projectid=project_id)
data = {}
if not hosts:
return data
for host in hosts['virtualmachine']:
host_name = host['displayname']
if name == host_name:
data['zone'] = host['zonename']
if 'group' in host:
data['group'] = host['group']
data['state'] = host['state']
data['service_offering'] = host['serviceofferingname']
data['affinity_group'] = host['affinitygroup']
data['security_group'] = host['securitygroup']
data['cpu_number'] = host['cpunumber']
data['cpu_speed'] = host['cpuspeed']
if 'cpuused' in host:
data['cpu_used'] = host['cpuused']
data['memory'] = host['memory']
data['tags'] = host['tags']
data['hypervisor'] = host['hypervisor']
data['created'] = host['created']
data['nic'] = []
for nic in host['nic']:
data['nic'].append({
'ip': nic['ipaddress'],
'mac': nic['macaddress'],
'netmask': nic['netmask'],
'gateway': nic['gateway'],
'type': nic['type'],
})
if nic['isdefault']:
data['default_ip'] = nic['ipaddress']
break;
return data
def get_list(self, project_id=''):
data = {
'all': {
'hosts': [],
},
'_meta': {
'hostvars': {},
},
}
groups = self.cs.listInstanceGroups(projectid=project_id)
if groups:
for group in groups['instancegroup']:
group_name = group['name']
if group_name and not group_name in data:
data[group_name] = {
'hosts': []
}
hosts = self.cs.listVirtualMachines(projectid=project_id)
if not hosts:
return data
for host in hosts['virtualmachine']:
host_name = host['displayname']
data['all']['hosts'].append(host_name)
data['_meta']['hostvars'][host_name] = {}
data['_meta']['hostvars'][host_name]['zone'] = host['zonename']
if 'group' in host:
data['_meta']['hostvars'][host_name]['group'] = host['group']
data['_meta']['hostvars'][host_name]['state'] = host['state']
data['_meta']['hostvars'][host_name]['service_offering'] = host['serviceofferingname']
data['_meta']['hostvars'][host_name]['affinity_group'] = host['affinitygroup']
data['_meta']['hostvars'][host_name]['security_group'] = host['securitygroup']
data['_meta']['hostvars'][host_name]['cpu_number'] = host['cpunumber']
data['_meta']['hostvars'][host_name]['cpu_speed'] = host['cpuspeed']
if 'cpuused' in host:
data['_meta']['hostvars'][host_name]['cpu_used'] = host['cpuused']
data['_meta']['hostvars'][host_name]['created'] = host['created']
data['_meta']['hostvars'][host_name]['memory'] = host['memory']
data['_meta']['hostvars'][host_name]['tags'] = host['tags']
data['_meta']['hostvars'][host_name]['hypervisor'] = host['hypervisor']
data['_meta']['hostvars'][host_name]['created'] = host['created']
data['_meta']['hostvars'][host_name]['nic'] = []
for nic in host['nic']:
data['_meta']['hostvars'][host_name]['nic'].append({
'ip': nic['ipaddress'],
'mac': nic['macaddress'],
'netmask': nic['netmask'],
'gateway': nic['gateway'],
'type': nic['type'],
})
if nic['isdefault']:
data['_meta']['hostvars'][host_name]['default_ip'] = nic['ipaddress']
group_name = ''
if 'group' in host:
group_name = host['group']
if group_name and group_name in data:
data[group_name]['hosts'].append(host_name)
return data
if __name__ == '__main__':
CloudStackInventory()

View File

@ -30,9 +30,15 @@ See http://ansible.github.com/api.html for more info
Tested with Cobbler 2.0.11.
Changelog:
- 2015-06-21 dmccue: Modified to support run-once _meta retrieval, results in
higher performance at ansible startup. Groups are determined by owner rather than
default mgmt_classes. DNS name determined from hostname. cobbler values are written
to a 'cobbler' fact namespace
- 2013-09-01 pgehres: Refactored implementation to make use of caching and to
limit the number of connections to external cobbler server for performance.
Added use of cobbler.ini file to configure settings. Tested with Cobbler 2.4.0
"""
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
@ -54,7 +60,6 @@ Changelog:
######################################################################
import argparse
import ConfigParser
import os
@ -67,14 +72,19 @@ try:
except ImportError:
import simplejson as json
from six import iteritems
# NOTE -- this file assumes Ansible is being accessed FROM the cobbler
# server, so it does not attempt to login with a username and password.
# this will be addressed in a future version of this script.
orderby_keyname = 'owners' # alternatively 'mgmt_classes'
class CobblerInventory(object):
def __init__(self):
""" Main execution path """
self.conn = None
@ -98,16 +108,14 @@ class CobblerInventory(object):
# Data to print
if self.args.host:
data_to_print = self.get_host_info()
data_to_print += self.get_host_info()
else:
self.inventory['_meta'] = { 'hostvars': {} }
for hostname in self.cache:
self.inventory['_meta']['hostvars'][hostname] = {'cobbler': self.cache[hostname] }
data_to_print += self.json_format_dict(self.inventory, True)
elif self.args.list:
# Display list of instances for inventory
data_to_print = self.json_format_dict(self.inventory, True)
else: # default action with no options
data_to_print = self.json_format_dict(self.inventory, True)
print data_to_print
print(data_to_print)
def _connect(self):
if not self.conn:
@ -160,21 +168,23 @@ class CobblerInventory(object):
for host in data:
# Get the FQDN for the host and add it to the right groups
dns_name = None
dns_name = host['hostname'] #None
ksmeta = None
interfaces = host['interfaces']
for (iname, ivalue) in interfaces.iteritems():
if ivalue['management']:
this_dns_name = ivalue.get('dns_name', None)
if this_dns_name is not None and this_dns_name is not "":
dns_name = this_dns_name
# hostname is often empty for non-static IP hosts
if dns_name == '':
for (iname, ivalue) in iteritems(interfaces):
if ivalue['management'] or not ivalue['static']:
this_dns_name = ivalue.get('dns_name', None)
if this_dns_name is not None and this_dns_name is not "":
dns_name = this_dns_name
if dns_name is None:
if dns_name == '':
continue
status = host['status']
profile = host['profile']
classes = host['mgmt_classes']
classes = host[orderby_keyname]
if status not in self.inventory:
self.inventory[status] = []
@ -193,9 +203,9 @@ class CobblerInventory(object):
# The old way was ksmeta only -- provide backwards compatibility
self.cache[dns_name] = dict()
self.cache[dns_name] = host
if "ks_meta" in host:
for key, value in host["ks_meta"].iteritems():
for key, value in iteritems(host["ks_meta"]):
self.cache[dns_name][key] = value
self.write_to_cache(self.cache, self.cache_path_cache)
@ -242,7 +252,6 @@ class CobblerInventory(object):
def write_to_cache(self, data, filename):
""" Writes data in JSON format to a file """
json_data = self.json_format_dict(data, True)
cache = open(filename, 'w')
cache.write(json_data)

View File

@ -41,7 +41,7 @@ that will be used instead of the configured values if they are set:
If errors are encountered during operation, this script will return an exit code of
255; otherwise, it will return an exit code of 0.
Collins attributes are accessable as variables in ansible via the COLLINS['attribute_name'].
Collins attributes are accessible as variables in ansible via the COLLINS['attribute_name'].
Tested against Ansible 1.8.2 and Collins 1.3.0.
"""
@ -67,7 +67,6 @@ Tested against Ansible 1.8.2 and Collins 1.3.0.
import argparse
import base64
import ConfigParser
import logging
import os
@ -76,13 +75,15 @@ import sys
from time import time
import traceback
import urllib
import urllib2
try:
import json
except ImportError:
import simplejson as json
from six import iteritems
from ansible.module_utils.urls import open_url
class CollinsDefaults(object):
ASSETS_API_ENDPOINT = '%s/api/assets'
@ -164,7 +165,7 @@ class CollinsInventory(object):
else: # default action with no options
data_to_print = self.json_format_dict(self.inventory, self.args.pretty)
print data_to_print
print(data_to_print)
return successful
def find_assets(self, attributes = {}, operation = 'AND'):
@ -174,7 +175,7 @@ class CollinsInventory(object):
# the CQL search feature as described here:
# http://tumblr.github.io/collins/recipes.html
attributes_query = [ '='.join(attr_pair)
for attr_pair in attributes.iteritems() ]
for attr_pair in iteritems(attributes) ]
query_parameters = {
'details': ['True'],
'operation': [operation],
@ -196,10 +197,11 @@ class CollinsInventory(object):
(CollinsDefaults.ASSETS_API_ENDPOINT % self.collins_host),
urllib.urlencode(query_parameters, doseq=True)
)
request = urllib2.Request(query_url)
request.add_header('Authorization', self.basic_auth_header)
try:
response = urllib2.urlopen(request, timeout=self.collins_timeout_secs)
response = open_url(query_url,
timeout=self.collins_timeout_secs,
url_username=self.collins_username,
url_password=self.collins_password)
json_response = json.loads(response.read())
# Adds any assets found to the array of assets.
assets += json_response['data']['Data']
@ -259,8 +261,6 @@ class CollinsInventory(object):
log_path = config.get('collins', 'log_path')
self.log_location = log_path + '/ansible-collins.log'
self.basic_auth_header = "Basic %s" % base64.encodestring(
'%s:%s' % (self.collins_username, self.collins_password))[:-1]
def parse_cli_args(self):
""" Command line argument processing """

View File

@ -125,6 +125,7 @@ import os
import re
import argparse
from time import time
import sys
import ConfigParser
import urllib, urllib2, base64
@ -135,11 +136,12 @@ except ImportError:
try:
import consul
except ImportError, e:
print """failed=True msg='python-consul required for this module. see
http://python-consul.readthedocs.org/en/latest/#installation'"""
except ImportError as e:
print("""failed=True msg='python-consul required for this module. see
http://python-consul.readthedocs.org/en/latest/#installation'""")
sys.exit(1)
from six import iteritems
class ConsulInventory(object):
@ -170,7 +172,7 @@ class ConsulInventory(object):
self.load_all_data_consul()
self.combine_all_results()
print json.dumps(self.inventory, sort_keys=True, indent=2)
print(json.dumps(self.inventory, sort_keys=True, indent=2))
def load_all_data_consul(self):
''' cycle through each of the datacenters in the consul catalog and process
@ -186,7 +188,7 @@ class ConsulInventory(object):
an 'available' or 'unavailable' grouping. The suffix for each group can be
controlled from the config'''
if self.config.has_config('availability'):
for service_name, service in node['Services'].iteritems():
for service_name, service in iteritems(node['Services']):
for node in self.consul_api.health.service(service_name)[1]:
for check in node['Checks']:
if check['ServiceName'] == service_name:
@ -210,7 +212,7 @@ class ConsulInventory(object):
def load_data_for_node(self, node, datacenter):
'''loads the data for a sinle node adding it to various groups based on
metadata retrieved from the kv store and service availablity'''
metadata retrieved from the kv store and service availability'''
index, node_data = self.consul_api.catalog.node(node, dc=datacenter)
node = node_data['Node']

View File

@ -3,12 +3,11 @@
[digital_ocean]
# The module needs your DigitalOcean Client ID and API Key.
# These may also be specified on the command line via --client-id and --api-key
# or via the environment variables DO_CLIENT_ID and DO_API_KEY
# The module needs your DigitalOcean API Token.
# It may also be specified on the command line via --api-token
# or via the environment variables DO_API_TOKEN or DO_API_KEY
#
#client_id = abcdefg123456
#api_key = 123456abcdefg
#api_token = 123456abcdefg
# API calls to DigitalOcean may be slow. For this reason, we cache the results
@ -23,3 +22,7 @@ cache_path = /tmp
# seconds, a new API call will be made, and the cache file will be updated.
#
cache_max_age = 300
# Use the private network IP address instead of the public when available.
#
use_private_network = False

View File

@ -24,12 +24,12 @@ found. You can force this script to use the cache with --force-cache.
Configuration is read from `digital_ocean.ini`, then from environment variables,
then and command-line arguments.
Most notably, the DigitalOcean Client ID and API Key must be specified. They
can be specified in the INI file or with the following environment variables:
export DO_CLIENT_ID='DO123' DO_API_KEY='abc123'
Most notably, the DigitalOcean API Token must be specified. It can be specified
in the INI file or with the following environment variables:
export DO_API_TOKEN='abc123' or
export DO_API_KEY='abc123'
Alternatively, they can be passed on the command-line with --client-id and
--api-key.
Alternatively, it can be passed on the command-line with --api-token.
If you specify DigitalOcean credentials in the INI file, a handy way to
get them into your environment (e.g., to use the digital_ocean module)
@ -43,25 +43,31 @@ The following groups are generated from --list:
- image_ID
- image_NAME
- distro_NAME (distribution NAME from image)
- region_ID
- region_NAME
- size_ID
- size_NAME
- status_STATUS
When run against a specific host, this script returns the following variables:
- do_backup_ids
- do_created_at
- do_distroy
- do_disk
- do_features - list
- do_id
- do_image
- do_image_id
- do_image - object
- do_ip_address
- do_private_ip_address
- do_kernel - object
- do_locked
- de_memory
- do_name
- do_region
- do_region_id
- do_size
- do_size_id
- do_networks - object
- do_next_backup_window
- do_region - object
- do_size - object
- do_size_slug
- do_snapshot_ids - list
- do_status
- do_vcpus
-----
```
@ -70,8 +76,9 @@ usage: digital_ocean.py [-h] [--list] [--host HOST] [--all]
[--ssh-keys] [--domains] [--pretty]
[--cache-path CACHE_PATH]
[--cache-max_age CACHE_MAX_AGE]
[--refresh-cache] [--client-id CLIENT_ID]
[--api-key API_KEY]
[--force-cache]
[--refresh-cache]
[--api-token API_TOKEN]
Produce an Ansible Inventory file based on DigitalOcean credentials
@ -93,12 +100,11 @@ optional arguments:
Path to the cache files (default: .)
--cache-max_age CACHE_MAX_AGE
Maximum age of the cached items (default: 0)
--force-cache Only use data from the cache
--refresh-cache Force refresh of cache by making API requests to
DigitalOcean (default: False - use cache files)
--client-id CLIENT_ID, -c CLIENT_ID
DigitalOcean Client ID
--api-key API_KEY, -a API_KEY
DigitalOcean API Key
--api-token API_TOKEN, -a API_TOKEN
DigitalOcean API Token
```
'''
@ -106,7 +112,7 @@ optional arguments:
# (c) 2013, Evan Wies <evan@neomantra.net>
#
# Inspired by the EC2 inventory plugin:
# https://github.com/ansible/ansible/blob/devel/plugins/inventory/ec2.py
# https://github.com/ansible/ansible/blob/devel/contrib/inventory/ec2.py
#
# This file is part of Ansible,
#
@ -139,8 +145,8 @@ except ImportError:
try:
from dopy.manager import DoError, DoManager
except ImportError, e:
print "failed=True msg='`dopy` library required for this script'"
except ImportError as e:
print("failed=True msg='`dopy` library required for this script'")
sys.exit(1)
@ -157,11 +163,11 @@ class DigitalOceanInventory(object):
# DigitalOceanInventory data
self.data = {} # All DigitalOcean data
self.inventory = {} # Ansible Inventory
self.index = {} # Various indices of Droplet metadata
# Define defaults
self.cache_path = '.'
self.cache_max_age = 0
self.use_private_network = False
# Read settings, environment variables, and CLI arguments
self.read_settings()
@ -169,54 +175,66 @@ class DigitalOceanInventory(object):
self.read_cli_args()
# Verify credentials were set
if not hasattr(self, 'client_id') or not hasattr(self, 'api_key'):
print '''Could not find values for DigitalOcean client_id and api_key.
They must be specified via either ini file, command line argument (--client-id and --api-key),
or environment variables (DO_CLIENT_ID and DO_API_KEY)'''
if not hasattr(self, 'api_token'):
print('''Could not find values for DigitalOcean api_token.
They must be specified via either ini file, command line argument (--api-token),
or environment variables (DO_API_TOKEN)''')
sys.exit(-1)
# env command, show DigitalOcean credentials
if self.args.env:
print "DO_CLIENT_ID=%s DO_API_KEY=%s" % (self.client_id, self.api_key)
print("DO_API_TOKEN=%s" % self.api_token)
sys.exit(0)
# Manage cache
self.cache_filename = self.cache_path + "/ansible-digital_ocean.cache"
self.cache_refreshed = False
if not self.args.force_cache and self.args.refresh_cache or not self.is_cache_valid():
self.load_all_data_from_digital_ocean()
else:
if self.is_cache_valid:
self.load_from_cache()
if len(self.data) == 0:
if self.args.force_cache:
print '''Cache is empty and --force-cache was specified'''
print('''Cache is empty and --force-cache was specified''')
sys.exit(-1)
self.load_all_data_from_digital_ocean()
else:
# We always get fresh droplets for --list, --host, --all, and --droplets
# unless --force-cache is specified
if not self.args.force_cache and (
self.args.list or self.args.host or self.args.all or self.args.droplets):
self.load_droplets_from_digital_ocean()
self.manager = DoManager(None, self.api_token, api_version=2)
# Pick the json_data to print based on the CLI command
if self.args.droplets: json_data = { 'droplets': self.data['droplets'] }
elif self.args.regions: json_data = { 'regions': self.data['regions'] }
elif self.args.images: json_data = { 'images': self.data['images'] }
elif self.args.sizes: json_data = { 'sizes': self.data['sizes'] }
elif self.args.ssh_keys: json_data = { 'ssh_keys': self.data['ssh_keys'] }
elif self.args.domains: json_data = { 'domains': self.data['domains'] }
elif self.args.all: json_data = self.data
elif self.args.host: json_data = self.load_droplet_variables_for_host()
if self.args.droplets:
self.load_from_digital_ocean('droplets')
json_data = {'droplets': self.data['droplets']}
elif self.args.regions:
self.load_from_digital_ocean('regions')
json_data = {'regions': self.data['regions']}
elif self.args.images:
self.load_from_digital_ocean('images')
json_data = {'images': self.data['images']}
elif self.args.sizes:
self.load_from_digital_ocean('sizes')
json_data = {'sizes': self.data['sizes']}
elif self.args.ssh_keys:
self.load_from_digital_ocean('ssh_keys')
json_data = {'ssh_keys': self.data['ssh_keys']}
elif self.args.domains:
self.load_from_digital_ocean('domains')
json_data = {'domains': self.data['domains']}
elif self.args.all:
self.load_from_digital_ocean()
json_data = self.data
elif self.args.host:
json_data = self.load_droplet_variables_for_host()
else: # '--list' this is last to make it default
json_data = self.inventory
self.load_from_digital_ocean('droplets')
self.build_inventory()
json_data = self.inventory
if self.cache_refreshed:
self.write_to_cache()
if self.args.pretty:
print json.dumps(json_data, sort_keys=True, indent=2)
print(json.dumps(json_data, sort_keys=True, indent=2))
else:
print json.dumps(json_data)
print(json.dumps(json_data))
# That's all she wrote...
@ -230,10 +248,8 @@ or environment variables (DO_CLIENT_ID and DO_API_KEY)'''
config.read(os.path.dirname(os.path.realpath(__file__)) + '/digital_ocean.ini')
# Credentials
if config.has_option('digital_ocean', 'client_id'):
self.client_id = config.get('digital_ocean', 'client_id')
if config.has_option('digital_ocean', 'api_key'):
self.api_key = config.get('digital_ocean', 'api_key')
if config.has_option('digital_ocean', 'api_token'):
self.api_token = config.get('digital_ocean', 'api_token')
# Cache related
if config.has_option('digital_ocean', 'cache_path'):
@ -241,12 +257,17 @@ or environment variables (DO_CLIENT_ID and DO_API_KEY)'''
if config.has_option('digital_ocean', 'cache_max_age'):
self.cache_max_age = config.getint('digital_ocean', 'cache_max_age')
# Private IP Address
if config.has_option('digital_ocean', 'use_private_network'):
self.use_private_network = config.get('digital_ocean', 'use_private_network')
def read_environment(self):
''' Reads the settings from environment variables '''
# Setup credentials
if os.getenv("DO_CLIENT_ID"): self.client_id = os.getenv("DO_CLIENT_ID")
if os.getenv("DO_API_KEY"): self.api_key = os.getenv("DO_API_KEY")
if os.getenv("DO_API_TOKEN"):
self.api_token = os.getenv("DO_API_TOKEN")
if os.getenv("DO_API_KEY"):
self.api_token = os.getenv("DO_API_KEY")
def read_cli_args(self):
@ -269,70 +290,57 @@ or environment variables (DO_CLIENT_ID and DO_API_KEY)'''
parser.add_argument('--cache-path', action='store', help='Path to the cache files (default: .)')
parser.add_argument('--cache-max_age', action='store', help='Maximum age of the cached items (default: 0)')
parser.add_argument('--force-cache', action='store_true', default=False, help='Only use data from the cache')
parser.add_argument('--refresh-cache','-r', action='store_true', default=False, help='Force refresh of cache by making API requests to DigitalOcean (default: False - use cache files)')
parser.add_argument('--refresh-cache','-r', action='store_true', default=False,
help='Force refresh of cache by making API requests to DigitalOcean (default: False - use cache files)')
parser.add_argument('--env','-e', action='store_true', help='Display DO_CLIENT_ID and DO_API_KEY')
parser.add_argument('--client-id','-c', action='store', help='DigitalOcean Client ID')
parser.add_argument('--api-key','-a', action='store', help='DigitalOcean API Key')
parser.add_argument('--env','-e', action='store_true', help='Display DO_API_TOKEN')
parser.add_argument('--api-token','-a', action='store', help='DigitalOcean API Token')
self.args = parser.parse_args()
if self.args.client_id: self.client_id = self.args.client_id
if self.args.api_key: self.api_key = self.args.api_key
if self.args.cache_path: self.cache_path = self.args.cache_path
if self.args.cache_max_age: self.cache_max_age = self.args.cache_max_age
if self.args.api_token:
self.api_token = self.args.api_token
# Make --list default if none of the other commands are specified
if (not self.args.droplets and not self.args.regions and not self.args.images and
not self.args.sizes and not self.args.ssh_keys and not self.args.domains and
not self.args.all and not self.args.host):
self.args.list = True
if (not self.args.droplets and not self.args.regions and
not self.args.images and not self.args.sizes and
not self.args.ssh_keys and not self.args.domains and
not self.args.all and not self.args.host):
self.args.list = True
###########################################################################
# Data Management
###########################################################################
def load_all_data_from_digital_ocean(self):
''' Use dopy to get all the information from DigitalOcean and save data in cache files '''
manager = DoManager(self.client_id, self.api_key)
def load_from_digital_ocean(self, resource=None):
'''Get JSON from DigitalOcean API'''
if self.args.force_cache:
return
# We always get fresh droplets
if self.is_cache_valid() and not (resource=='droplets' or resource is None):
return
if self.args.refresh_cache:
resource=None
self.data = {}
self.data['droplets'] = self.sanitize_list(manager.all_active_droplets())
self.data['regions'] = self.sanitize_list(manager.all_regions())
self.data['images'] = self.sanitize_list(manager.all_images(filter=None))
self.data['sizes'] = self.sanitize_list(manager.sizes())
self.data['ssh_keys'] = self.sanitize_list(manager.all_ssh_keys())
self.data['domains'] = self.sanitize_list(manager.all_domains())
self.index = {}
self.index['region_to_name'] = self.build_index(self.data['regions'], 'id', 'name')
self.index['size_to_name'] = self.build_index(self.data['sizes'], 'id', 'name')
self.index['image_to_name'] = self.build_index(self.data['images'], 'id', 'name')
self.index['image_to_distro'] = self.build_index(self.data['images'], 'id', 'distribution')
self.index['host_to_droplet'] = self.build_index(self.data['droplets'], 'ip_address', 'id', False)
self.build_inventory()
self.write_to_cache()
def load_droplets_from_digital_ocean(self):
''' Use dopy to get droplet information from DigitalOcean and save data in cache files '''
manager = DoManager(self.client_id, self.api_key)
self.data['droplets'] = self.sanitize_list(manager.all_active_droplets())
self.index['host_to_droplet'] = self.build_index(self.data['droplets'], 'ip_address', 'id', False)
self.build_inventory()
self.write_to_cache()
def build_index(self, source_seq, key_from, key_to, use_slug=True):
dest_dict = {}
for item in source_seq:
name = (use_slug and item.has_key('slug')) and item['slug'] or item[key_to]
key = item[key_from]
dest_dict[key] = name
return dest_dict
if resource == 'droplets' or resource is None:
self.data['droplets'] = self.manager.all_active_droplets()
self.cache_refreshed = True
if resource == 'regions' or resource is None:
self.data['regions'] = self.manager.all_regions()
self.cache_refreshed = True
if resource == 'images' or resource is None:
self.data['images'] = self.manager.all_images(filter=None)
self.cache_refreshed = True
if resource == 'sizes' or resource is None:
self.data['sizes'] = self.manager.sizes()
self.cache_refreshed = True
if resource == 'ssh_keys' or resource is None:
self.data['ssh_keys'] = self.manager.all_ssh_keys()
self.cache_refreshed = True
if resource == 'domains' or resource is None:
self.data['domains'] = self.manager.all_domains()
self.cache_refreshed = True
def build_inventory(self):
@ -341,74 +349,46 @@ or environment variables (DO_CLIENT_ID and DO_API_KEY)'''
# add all droplets by id and name
for droplet in self.data['droplets']:
dest = droplet['ip_address']
#when using private_networking, the API reports the private one in "ip_address".
if 'private_networking' in droplet['features'] and not self.use_private_network:
for net in droplet['networks']['v4']:
if net['type']=='public':
dest=net['ip_address']
else:
continue
else:
dest = droplet['ip_address']
self.inventory[droplet['id']] = [dest]
self.push(self.inventory, droplet['name'], dest)
self.push(self.inventory, 'region_'+droplet['region_id'], dest)
self.push(self.inventory, 'image_' +droplet['image_id'], dest)
self.push(self.inventory, 'size_' +droplet['size_id'], dest)
self.push(self.inventory, 'status_'+droplet['status'], dest)
self.push(self.inventory, 'region_' + droplet['region']['slug'], dest)
self.push(self.inventory, 'image_' + str(droplet['image']['id']), dest)
self.push(self.inventory, 'size_' + droplet['size']['slug'], dest)
region_name = self.index['region_to_name'].get(droplet['region_id'])
if region_name:
self.push(self.inventory, 'region_'+region_name, dest)
image_slug = droplet['image']['slug']
if image_slug:
self.push(self.inventory, 'image_' + self.to_safe(image_slug), dest)
else:
image_name = droplet['image']['name']
if image_name:
self.push(self.inventory, 'image_' + self.to_safe(image_name), dest)
size_name = self.index['size_to_name'].get(droplet['size_id'])
if size_name:
self.push(self.inventory, 'size_'+size_name, dest)
image_name = self.index['image_to_name'].get(droplet['image_id'])
if image_name:
self.push(self.inventory, 'image_'+image_name, dest)
distro_name = self.index['image_to_distro'].get(droplet['image_id'])
if distro_name:
self.push(self.inventory, 'distro_'+distro_name, dest)
self.push(self.inventory, 'distro_' + self.to_safe(droplet['image']['distribution']), dest)
self.push(self.inventory, 'status_' + droplet['status'], dest)
def load_droplet_variables_for_host(self):
'''Generate a JSON response to a --host call'''
host = self.to_safe(str(self.args.host))
host = int(self.args.host)
if not host in self.index['host_to_droplet']:
# try updating cache
if not self.args.force_cache:
self.load_all_data_from_digital_ocean()
if not host in self.index['host_to_droplet']:
# host might not exist anymore
return {}
droplet = None
if self.cache_refreshed:
for drop in self.data['droplets']:
if drop['ip_address'] == host:
droplet = self.sanitize_dict(drop)
break
else:
# Cache wasn't refreshed this run, so hit DigitalOcean API
manager = DoManager(self.client_id, self.api_key)
droplet_id = self.index['host_to_droplet'][host]
droplet = self.sanitize_dict(manager.show_droplet(droplet_id))
if not droplet:
return {}
droplet = self.manager.show_droplet(host)
# Put all the information in a 'do_' namespace
info = {}
for k, v in droplet.items():
info['do_'+k] = v
# Generate user-friendly variables (i.e. not the ID's)
if droplet.has_key('region_id'):
info['do_region'] = self.index['region_to_name'].get(droplet['region_id'])
if droplet.has_key('size_id'):
info['do_size'] = self.index['size_to_name'].get(droplet['size_id'])
if droplet.has_key('image_id'):
info['do_image'] = self.index['image_to_name'].get(droplet['image_id'])
info['do_distro'] = self.index['image_to_distro'].get(droplet['image_id'])
return info
return {'droplet': info}
@ -428,19 +408,21 @@ or environment variables (DO_CLIENT_ID and DO_API_KEY)'''
def load_from_cache(self):
''' Reads the data from the cache file and assigns it to member variables as Python Objects'''
cache = open(self.cache_filename, 'r')
json_data = cache.read()
cache.close()
data = json.loads(json_data)
try:
cache = open(self.cache_filename, 'r')
json_data = cache.read()
cache.close()
data = json.loads(json_data)
except IOError:
data = {'data': {}, 'inventory': {}}
self.data = data['data']
self.inventory = data['inventory']
self.index = data['index']
def write_to_cache(self):
''' Writes data in JSON format to a file '''
data = { 'data': self.data, 'index': self.index, 'inventory': self.inventory }
data = { 'data': self.data, 'inventory': self.inventory }
json_data = json.dumps(data, sort_keys=True, indent=2)
cache = open(self.cache_filename, 'w')
@ -448,7 +430,6 @@ or environment variables (DO_CLIENT_ID and DO_API_KEY)'''
cache.close()
###########################################################################
# Utilities
###########################################################################
@ -456,7 +437,7 @@ or environment variables (DO_CLIENT_ID and DO_API_KEY)'''
def push(self, my_dict, key, element):
''' Pushed an element onto an array that may not have been defined in the dict '''
if key in my_dict:
my_dict[key].append(element);
my_dict[key].append(element)
else:
my_dict[key] = [element]
@ -466,21 +447,6 @@ or environment variables (DO_CLIENT_ID and DO_API_KEY)'''
return re.sub("[^A-Za-z0-9\-\.]", "_", word)
def sanitize_dict(self, d):
new_dict = {}
for k, v in d.items():
if v != None:
new_dict[self.to_safe(str(k))] = self.to_safe(str(v))
return new_dict
def sanitize_list(self, seq):
new_seq = []
for d in seq:
new_seq.append(self.sanitize_dict(d))
return new_seq
###########################################################################
# Run the script

View File

@ -334,7 +334,7 @@ def list_groups():
groups['docker_hosts'] = [host.get('base_url') for host in hosts]
groups['_meta'] = dict()
groups['_meta']['hostvars'] = hostvars
print json.dumps(groups, sort_keys=True, indent=4)
print(json.dumps(groups, sort_keys=True, indent=4))
sys.exit(0)

View File

@ -33,8 +33,11 @@ destination_variable = public_dns_name
# has 'subnet_id' set, this variable is used. If the subnet is public, setting
# this to 'ip_address' will return the public IP address. For instances in a
# private subnet, this should be set to 'private_ip_address', and Ansible must
# be run from with EC2. The key of an EC2 tag may optionally be used; however
# be run from within EC2. The key of an EC2 tag may optionally be used; however
# the boto instance variables hold precedence in the event of a collision.
# WARNING: - instances that are in the private vpc, _without_ public ip address
# will not be listed in the inventory until You set:
# vpc_destination_variable = 'private_ip_address'
vpc_destination_variable = ip_address
# To tag instances on EC2 with the resource records that point to them from
@ -44,6 +47,9 @@ route53 = False
# To exclude RDS instances from the inventory, uncomment and set to False.
#rds = False
# To exclude ElastiCache instances from the inventory, uncomment and set to False.
#elasticache = False
# Additionally, you can specify the list of zones to exclude looking up in
# 'route53_excluded_zones' as a comma-separated list.
# route53_excluded_zones = samplezone1.com, samplezone2.com
@ -52,10 +58,27 @@ route53 = False
# 'all_instances' to True to return all instances regardless of state.
all_instances = False
# By default, only EC2 instances in the 'running' state are returned. Specify
# EC2 instance states to return as a comma-separated list. This
# option is overriden when 'all_instances' is True.
# instance_states = pending, running, shutting-down, terminated, stopping, stopped
# By default, only RDS instances in the 'available' state are returned. Set
# 'all_rds_instances' to True return all RDS instances regardless of state.
all_rds_instances = False
# By default, only ElastiCache clusters and nodes in the 'available' state
# are returned. Set 'all_elasticache_clusters' and/or 'all_elastic_nodes'
# to True return all ElastiCache clusters and nodes, regardless of state.
#
# Note that all_elasticache_nodes only applies to listed clusters. That means
# if you set all_elastic_clusters to false, no node will be return from
# unavailable clusters, regardless of the state and to what you set for
# all_elasticache_nodes.
all_elasticache_replication_groups = False
all_elasticache_clusters = False
all_elasticache_nodes = False
# API calls to EC2 are slow. For this reason, we cache the results of an API
# call. Set this to the path you want cache files to be written to. Two files
# will be written to this directory:
@ -71,6 +94,13 @@ cache_max_age = 300
# Organize groups into a nested/hierarchy instead of a flat namespace.
nested_groups = False
# Replace - tags when creating groups to avoid issues with ansible
replace_dash_in_groups = True
# If set to true, any tag of the form "a,b,c" is expanded into a list
# and the results are used to create additional tag_* inventory groups.
expand_csv_tags = False
# The EC2 inventory output can become very large. To manage its size,
# configure which groups should be created.
group_by_instance_id = True
@ -86,12 +116,16 @@ group_by_tag_none = True
group_by_route53_names = True
group_by_rds_engine = True
group_by_rds_parameter_group = True
group_by_elasticache_engine = True
group_by_elasticache_cluster = True
group_by_elasticache_parameter_group = True
group_by_elasticache_replication_group = True
# If you only want to include hosts that match a certain regular expression
# pattern_include = stage-*
# pattern_include = staging-*
# If you want to exclude any hosts that match a certain regular expression
# pattern_exclude = stage-*
# pattern_exclude = staging-*
# Instance filters can be used to control which instances are retrieved for
# inventory. For the full list of possible filters, please read the EC2 API
@ -99,16 +133,20 @@ group_by_rds_parameter_group = True
# Filters are key/value pairs separated by '=', to list multiple filters use
# a list separated by commas. See examples below.
# Retrieve only instances with (key=value) env=stage tag
# instance_filters = tag:env=stage
# Retrieve only instances with (key=value) env=staging tag
# instance_filters = tag:env=staging
# Retrieve only instances with role=webservers OR role=dbservers tag
# instance_filters = tag:role=webservers,tag:role=dbservers
# Retrieve only t1.micro instances OR instances with tag env=stage
# instance_filters = instance-type=t1.micro,tag:env=stage
# Retrieve only t1.micro instances OR instances with tag env=staging
# instance_filters = instance-type=t1.micro,tag:env=staging
# You can use wildcards in filter values also. Below will list instances which
# tag Name value matches webservers1*
# (ex. webservers15, webservers1a, webservers123 etc)
# instance_filters = tag:Name=webservers1*
# A boto configuration profile may be used to separate out credentials
# see http://boto.readthedocs.org/en/latest/boto_config_tut.html
# boto_profile = some-boto-profile-name

View File

@ -22,6 +22,12 @@ you need to define:
export EC2_URL=http://hostname_of_your_cc:port/services/Eucalyptus
If you're using boto profiles (requires boto>=2.24.0) you can choose a profile
using the --boto-profile command line argument (e.g. ec2.py --boto-profile prod) or using
the AWS_PROFILE variable:
AWS_PROFILE=prod ansible-playbook -i ec2.py myplaybook.yml
For more details, see: http://docs.pythonboto.org/en/latest/boto_config_tut.html
When run against a specific host, this script returns the following variables:
@ -121,8 +127,11 @@ from time import time
import boto
from boto import ec2
from boto import rds
from boto import elasticache
from boto import route53
import ConfigParser
import six
from six.moves import configparser
from collections import defaultdict
try:
@ -132,6 +141,7 @@ except ImportError:
class Ec2Inventory(object):
def _empty_inventory(self):
return {"_meta" : {"hostvars" : {}}}
@ -145,9 +155,18 @@ class Ec2Inventory(object):
# Index of hostname (address) to instance ID
self.index = {}
# Boto profile to use (if any)
self.boto_profile = None
# Read settings and parse CLI arguments
self.read_settings()
self.parse_cli_args()
self.read_settings()
# Make sure that profile_name is not passed at all if not set
# as pre 2.24 boto will fall over otherwise
if self.boto_profile:
if not hasattr(boto.ec2.EC2Connection, 'profile_name'):
self.fail_with_error("boto version must be >= 2.24 to use profile")
# Cache
if self.args.refresh_cache:
@ -166,7 +185,7 @@ class Ec2Inventory(object):
else:
data_to_print = self.json_format_dict(self.inventory, True)
print data_to_print
print(data_to_print)
def is_cache_valid(self):
@ -184,10 +203,12 @@ class Ec2Inventory(object):
def read_settings(self):
''' Reads the settings from the ec2.ini file '''
config = ConfigParser.SafeConfigParser()
if six.PY3:
config = configparser.ConfigParser()
else:
config = configparser.SafeConfigParser()
ec2_default_ini_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'ec2.ini')
ec2_ini_path = os.environ.get('EC2_INI_PATH', ec2_default_ini_path)
ec2_ini_path = os.path.expanduser(os.path.expandvars(os.environ.get('EC2_INI_PATH', ec2_default_ini_path)))
config.read(ec2_ini_path)
# is eucalyptus?
@ -228,18 +249,72 @@ class Ec2Inventory(object):
if config.has_option('ec2', 'rds'):
self.rds_enabled = config.getboolean('ec2', 'rds')
# Return all EC2 and RDS instances (if RDS is enabled)
# Include ElastiCache instances?
self.elasticache_enabled = True
if config.has_option('ec2', 'elasticache'):
self.elasticache_enabled = config.getboolean('ec2', 'elasticache')
# Return all EC2 instances?
if config.has_option('ec2', 'all_instances'):
self.all_instances = config.getboolean('ec2', 'all_instances')
else:
self.all_instances = False
# Instance states to be gathered in inventory. Default is 'running'.
# Setting 'all_instances' to 'yes' overrides this option.
ec2_valid_instance_states = [
'pending',
'running',
'shutting-down',
'terminated',
'stopping',
'stopped'
]
self.ec2_instance_states = []
if self.all_instances:
self.ec2_instance_states = ec2_valid_instance_states
elif config.has_option('ec2', 'instance_states'):
for instance_state in config.get('ec2', 'instance_states').split(','):
instance_state = instance_state.strip()
if instance_state not in ec2_valid_instance_states:
continue
self.ec2_instance_states.append(instance_state)
else:
self.ec2_instance_states = ['running']
# Return all RDS instances? (if RDS is enabled)
if config.has_option('ec2', 'all_rds_instances') and self.rds_enabled:
self.all_rds_instances = config.getboolean('ec2', 'all_rds_instances')
else:
self.all_rds_instances = False
# Return all ElastiCache replication groups? (if ElastiCache is enabled)
if config.has_option('ec2', 'all_elasticache_replication_groups') and self.elasticache_enabled:
self.all_elasticache_replication_groups = config.getboolean('ec2', 'all_elasticache_replication_groups')
else:
self.all_elasticache_replication_groups = False
# Return all ElastiCache clusters? (if ElastiCache is enabled)
if config.has_option('ec2', 'all_elasticache_clusters') and self.elasticache_enabled:
self.all_elasticache_clusters = config.getboolean('ec2', 'all_elasticache_clusters')
else:
self.all_elasticache_clusters = False
# Return all ElastiCache nodes? (if ElastiCache is enabled)
if config.has_option('ec2', 'all_elasticache_nodes') and self.elasticache_enabled:
self.all_elasticache_nodes = config.getboolean('ec2', 'all_elasticache_nodes')
else:
self.all_elasticache_nodes = False
# boto configuration profile (prefer CLI argument)
self.boto_profile = self.args.boto_profile
if config.has_option('ec2', 'boto_profile') and not self.boto_profile:
self.boto_profile = config.get('ec2', 'boto_profile')
# Cache related
cache_dir = os.path.expanduser(config.get('ec2', 'cache_path'))
if self.boto_profile:
cache_dir = os.path.join(cache_dir, 'profile_' + self.boto_profile)
if not os.path.exists(cache_dir):
os.makedirs(cache_dir)
@ -247,12 +322,23 @@ class Ec2Inventory(object):
self.cache_path_index = cache_dir + "/ansible-ec2.index"
self.cache_max_age = config.getint('ec2', 'cache_max_age')
if config.has_option('ec2', 'expand_csv_tags'):
self.expand_csv_tags = config.getboolean('ec2', 'expand_csv_tags')
else:
self.expand_csv_tags = False
# Configure nested groups instead of flat namespace.
if config.has_option('ec2', 'nested_groups'):
self.nested_groups = config.getboolean('ec2', 'nested_groups')
else:
self.nested_groups = False
# Replace dash or not in group names
if config.has_option('ec2', 'replace_dash_in_groups'):
self.replace_dash_in_groups = config.getboolean('ec2', 'replace_dash_in_groups')
else:
self.replace_dash_in_groups = True
# Configure which groups should be created.
group_by_options = [
'group_by_instance_id',
@ -268,6 +354,10 @@ class Ec2Inventory(object):
'group_by_route53_names',
'group_by_rds_engine',
'group_by_rds_parameter_group',
'group_by_elasticache_engine',
'group_by_elasticache_cluster',
'group_by_elasticache_parameter_group',
'group_by_elasticache_replication_group',
]
for option in group_by_options:
if config.has_option('ec2', option):
@ -282,7 +372,7 @@ class Ec2Inventory(object):
self.pattern_include = re.compile(pattern_include)
else:
self.pattern_include = None
except ConfigParser.NoOptionError, e:
except configparser.NoOptionError:
self.pattern_include = None
# Do we need to exclude hosts that match a pattern?
@ -292,7 +382,7 @@ class Ec2Inventory(object):
self.pattern_exclude = re.compile(pattern_exclude)
else:
self.pattern_exclude = None
except ConfigParser.NoOptionError, e:
except configparser.NoOptionError:
self.pattern_exclude = None
# Instance filters (see boto and EC2 API docs). Ignore invalid filters.
@ -317,6 +407,8 @@ class Ec2Inventory(object):
help='Get all the variables about a specific instance')
parser.add_argument('--refresh-cache', action='store_true', default=False,
help='Force refresh of cache by making API requests to EC2 (default: False - use cache files)')
parser.add_argument('--profile', '--boto-profile', action='store', dest='boto_profile',
help='Use boto profile for connections to EC2')
self.args = parser.parse_args()
@ -330,6 +422,9 @@ class Ec2Inventory(object):
self.get_instances_by_region(region)
if self.rds_enabled:
self.get_rds_instances_by_region(region)
if self.elasticache_enabled:
self.get_elasticache_clusters_by_region(region)
self.get_elasticache_replication_groups_by_region(region)
self.write_to_cache(self.inventory, self.cache_path_cache)
self.write_to_cache(self.index, self.cache_path_index)
@ -340,7 +435,25 @@ class Ec2Inventory(object):
conn = boto.connect_euca(host=self.eucalyptus_host)
conn.APIVersion = '2010-08-31'
else:
conn = ec2.connect_to_region(region)
conn = self.connect_to_aws(ec2, region)
return conn
def boto_fix_security_token_in_profile(self, connect_args):
''' monkey patch for boto issue boto/boto#2100 '''
profile = 'profile ' + self.boto_profile
if boto.config.has_option(profile, 'aws_security_token'):
connect_args['security_token'] = boto.config.get(profile, 'aws_security_token')
return connect_args
def connect_to_aws(self, module, region):
connect_args = {}
# only pass the profile name if it's set (as it is not supported by older boto versions)
if self.boto_profile:
connect_args['profile_name'] = self.boto_profile
self.boto_fix_security_token_in_profile(connect_args)
conn = module.connect_to_region(region, **connect_args)
# connect_to_region will fail "silently" by returning None if the region name is wrong or not supported
if conn is None:
self.fail_with_error("region name: %s likely not supported, or AWS is down. connection to region failed." % region)
@ -354,7 +467,7 @@ class Ec2Inventory(object):
conn = self.connect(region)
reservations = []
if self.ec2_instance_filters:
for filter_key, filter_values in self.ec2_instance_filters.iteritems():
for filter_key, filter_values in self.ec2_instance_filters.items():
reservations.extend(conn.get_all_instances(filters = { filter_key : filter_values }))
else:
reservations = conn.get_all_instances()
@ -363,31 +476,102 @@ class Ec2Inventory(object):
for instance in reservation.instances:
self.add_instance(instance, region)
except boto.exception.BotoServerError, e:
except boto.exception.BotoServerError as e:
if e.error_code == 'AuthFailure':
error = self.get_auth_error_message()
else:
backend = 'Eucalyptus' if self.eucalyptus else 'AWS'
error = "Error connecting to %s backend.\n%s" % (backend, e.message)
self.fail_with_error(error)
self.fail_with_error(error, 'getting EC2 instances')
def get_rds_instances_by_region(self, region):
''' Makes an AWS API call to the list of RDS instances in a particular
region '''
try:
conn = rds.connect_to_region(region)
conn = self.connect_to_aws(rds, region)
if conn:
instances = conn.get_all_dbinstances()
for instance in instances:
self.add_rds_instance(instance, region)
except boto.exception.BotoServerError, e:
error = e.message
except boto.exception.BotoServerError as e:
error = e.reason
if e.error_code == 'AuthFailure':
error = self.get_auth_error_message()
if not e.reason == "Forbidden":
error = "Looks like AWS RDS is down:\n%s" % e.message
self.fail_with_error(error)
self.fail_with_error(error, 'getting RDS instances')
def get_elasticache_clusters_by_region(self, region):
''' Makes an AWS API call to the list of ElastiCache clusters (with
nodes' info) in a particular region.'''
# ElastiCache boto module doesn't provide a get_all_intances method,
# that's why we need to call describe directly (it would be called by
# the shorthand method anyway...)
try:
conn = elasticache.connect_to_region(region)
if conn:
# show_cache_node_info = True
# because we also want nodes' information
response = conn.describe_cache_clusters(None, None, None, True)
except boto.exception.BotoServerError as e:
error = e.reason
if e.error_code == 'AuthFailure':
error = self.get_auth_error_message()
if not e.reason == "Forbidden":
error = "Looks like AWS ElastiCache is down:\n%s" % e.message
self.fail_with_error(error, 'getting ElastiCache clusters')
try:
# Boto also doesn't provide wrapper classes to CacheClusters or
# CacheNodes. Because of that wo can't make use of the get_list
# method in the AWSQueryConnection. Let's do the work manually
clusters = response['DescribeCacheClustersResponse']['DescribeCacheClustersResult']['CacheClusters']
except KeyError as e:
error = "ElastiCache query to AWS failed (unexpected format)."
self.fail_with_error(error, 'getting ElastiCache clusters')
for cluster in clusters:
self.add_elasticache_cluster(cluster, region)
def get_elasticache_replication_groups_by_region(self, region):
''' Makes an AWS API call to the list of ElastiCache replication groups
in a particular region.'''
# ElastiCache boto module doesn't provide a get_all_intances method,
# that's why we need to call describe directly (it would be called by
# the shorthand method anyway...)
try:
conn = elasticache.connect_to_region(region)
if conn:
response = conn.describe_replication_groups()
except boto.exception.BotoServerError as e:
error = e.reason
if e.error_code == 'AuthFailure':
error = self.get_auth_error_message()
if not e.reason == "Forbidden":
error = "Looks like AWS ElastiCache [Replication Groups] is down:\n%s" % e.message
self.fail_with_error(error, 'getting ElastiCache clusters')
try:
# Boto also doesn't provide wrapper classes to ReplicationGroups
# Because of that wo can't make use of the get_list method in the
# AWSQueryConnection. Let's do the work manually
replication_groups = response['DescribeReplicationGroupsResponse']['DescribeReplicationGroupsResult']['ReplicationGroups']
except KeyError as e:
error = "ElastiCache [Replication Groups] query to AWS failed (unexpected format)."
self.fail_with_error(error, 'getting ElastiCache clusters')
for replication_group in replication_groups:
self.add_elasticache_replication_group(replication_group, region)
def get_auth_error_message(self):
''' create an informative error message if there is an issue authenticating'''
@ -405,9 +589,12 @@ class Ec2Inventory(object):
errors.append(" - No Boto config found at any expected location '%s'" % ', '.join(boto_paths))
return '\n'.join(errors)
def fail_with_error(self, err_msg):
def fail_with_error(self, err_msg, err_operation=None):
'''log an error to std err for ansible-playbook to consume and exit'''
if err_operation:
err_msg = 'ERROR: "{err_msg}", while: {err_operation}'.format(
err_msg=err_msg, err_operation=err_operation)
sys.stderr.write(err_msg)
sys.exit(1)
@ -423,8 +610,8 @@ class Ec2Inventory(object):
''' Adds an instance to the inventory and index, as long as it is
addressable '''
# Only want running instances unless all_instances is True
if not self.all_instances and instance.state != 'running':
# Only return instances with desired instance states
if instance.state not in self.ec2_instance_states:
return
# Select the best destination address
@ -514,12 +701,22 @@ class Ec2Inventory(object):
# Inventory: Group by tag keys
if self.group_by_tag_keys:
for k, v in instance.tags.iteritems():
key = self.to_safe("tag_" + k + "=" + v)
self.push(self.inventory, key, dest)
if self.nested_groups:
self.push_group(self.inventory, 'tags', self.to_safe("tag_" + k))
self.push_group(self.inventory, self.to_safe("tag_" + k), key)
for k, v in instance.tags.items():
if self.expand_csv_tags and v and ',' in v:
values = map(lambda x: x.strip(), v.split(','))
else:
values = [v]
for v in values:
if v:
key = self.to_safe("tag_" + k + "=" + v)
else:
key = self.to_safe("tag_" + k)
self.push(self.inventory, key, dest)
if self.nested_groups:
self.push_group(self.inventory, 'tags', self.to_safe("tag_" + k))
if v:
self.push_group(self.inventory, self.to_safe("tag_" + k), key)
# Inventory: Group by Route53 domain names if enabled
if self.route53_enabled and self.group_by_route53_names:
@ -624,6 +821,243 @@ class Ec2Inventory(object):
self.inventory["_meta"]["hostvars"][dest] = self.get_host_info_dict_from_instance(instance)
def add_elasticache_cluster(self, cluster, region):
''' Adds an ElastiCache cluster to the inventory and index, as long as
it's nodes are addressable '''
# Only want available clusters unless all_elasticache_clusters is True
if not self.all_elasticache_clusters and cluster['CacheClusterStatus'] != 'available':
return
# Select the best destination address
if 'ConfigurationEndpoint' in cluster and cluster['ConfigurationEndpoint']:
# Memcached cluster
dest = cluster['ConfigurationEndpoint']['Address']
is_redis = False
else:
# Redis sigle node cluster
# Because all Redis clusters are single nodes, we'll merge the
# info from the cluster with info about the node
dest = cluster['CacheNodes'][0]['Endpoint']['Address']
is_redis = True
if not dest:
# Skip clusters we cannot address (e.g. private VPC subnet)
return
# Add to index
self.index[dest] = [region, cluster['CacheClusterId']]
# Inventory: Group by instance ID (always a group of 1)
if self.group_by_instance_id:
self.inventory[cluster['CacheClusterId']] = [dest]
if self.nested_groups:
self.push_group(self.inventory, 'instances', cluster['CacheClusterId'])
# Inventory: Group by region
if self.group_by_region and not is_redis:
self.push(self.inventory, region, dest)
if self.nested_groups:
self.push_group(self.inventory, 'regions', region)
# Inventory: Group by availability zone
if self.group_by_availability_zone and not is_redis:
self.push(self.inventory, cluster['PreferredAvailabilityZone'], dest)
if self.nested_groups:
if self.group_by_region:
self.push_group(self.inventory, region, cluster['PreferredAvailabilityZone'])
self.push_group(self.inventory, 'zones', cluster['PreferredAvailabilityZone'])
# Inventory: Group by node type
if self.group_by_instance_type and not is_redis:
type_name = self.to_safe('type_' + cluster['CacheNodeType'])
self.push(self.inventory, type_name, dest)
if self.nested_groups:
self.push_group(self.inventory, 'types', type_name)
# Inventory: Group by VPC (information not available in the current
# AWS API version for ElastiCache)
# Inventory: Group by security group
if self.group_by_security_group and not is_redis:
# Check for the existence of the 'SecurityGroups' key and also if
# this key has some value. When the cluster is not placed in a SG
# the query can return None here and cause an error.
if 'SecurityGroups' in cluster and cluster['SecurityGroups'] is not None:
for security_group in cluster['SecurityGroups']:
key = self.to_safe("security_group_" + security_group['SecurityGroupId'])
self.push(self.inventory, key, dest)
if self.nested_groups:
self.push_group(self.inventory, 'security_groups', key)
# Inventory: Group by engine
if self.group_by_elasticache_engine and not is_redis:
self.push(self.inventory, self.to_safe("elasticache_" + cluster['Engine']), dest)
if self.nested_groups:
self.push_group(self.inventory, 'elasticache_engines', self.to_safe(cluster['Engine']))
# Inventory: Group by parameter group
if self.group_by_elasticache_parameter_group:
self.push(self.inventory, self.to_safe("elasticache_parameter_group_" + cluster['CacheParameterGroup']['CacheParameterGroupName']), dest)
if self.nested_groups:
self.push_group(self.inventory, 'elasticache_parameter_groups', self.to_safe(cluster['CacheParameterGroup']['CacheParameterGroupName']))
# Inventory: Group by replication group
if self.group_by_elasticache_replication_group and 'ReplicationGroupId' in cluster and cluster['ReplicationGroupId']:
self.push(self.inventory, self.to_safe("elasticache_replication_group_" + cluster['ReplicationGroupId']), dest)
if self.nested_groups:
self.push_group(self.inventory, 'elasticache_replication_groups', self.to_safe(cluster['ReplicationGroupId']))
# Global Tag: all ElastiCache clusters
self.push(self.inventory, 'elasticache_clusters', cluster['CacheClusterId'])
host_info = self.get_host_info_dict_from_describe_dict(cluster)
self.inventory["_meta"]["hostvars"][dest] = host_info
# Add the nodes
for node in cluster['CacheNodes']:
self.add_elasticache_node(node, cluster, region)
def add_elasticache_node(self, node, cluster, region):
''' Adds an ElastiCache node to the inventory and index, as long as
it is addressable '''
# Only want available nodes unless all_elasticache_nodes is True
if not self.all_elasticache_nodes and node['CacheNodeStatus'] != 'available':
return
# Select the best destination address
dest = node['Endpoint']['Address']
if not dest:
# Skip nodes we cannot address (e.g. private VPC subnet)
return
node_id = self.to_safe(cluster['CacheClusterId'] + '_' + node['CacheNodeId'])
# Add to index
self.index[dest] = [region, node_id]
# Inventory: Group by node ID (always a group of 1)
if self.group_by_instance_id:
self.inventory[node_id] = [dest]
if self.nested_groups:
self.push_group(self.inventory, 'instances', node_id)
# Inventory: Group by region
if self.group_by_region:
self.push(self.inventory, region, dest)
if self.nested_groups:
self.push_group(self.inventory, 'regions', region)
# Inventory: Group by availability zone
if self.group_by_availability_zone:
self.push(self.inventory, cluster['PreferredAvailabilityZone'], dest)
if self.nested_groups:
if self.group_by_region:
self.push_group(self.inventory, region, cluster['PreferredAvailabilityZone'])
self.push_group(self.inventory, 'zones', cluster['PreferredAvailabilityZone'])
# Inventory: Group by node type
if self.group_by_instance_type:
type_name = self.to_safe('type_' + cluster['CacheNodeType'])
self.push(self.inventory, type_name, dest)
if self.nested_groups:
self.push_group(self.inventory, 'types', type_name)
# Inventory: Group by VPC (information not available in the current
# AWS API version for ElastiCache)
# Inventory: Group by security group
if self.group_by_security_group:
# Check for the existence of the 'SecurityGroups' key and also if
# this key has some value. When the cluster is not placed in a SG
# the query can return None here and cause an error.
if 'SecurityGroups' in cluster and cluster['SecurityGroups'] is not None:
for security_group in cluster['SecurityGroups']:
key = self.to_safe("security_group_" + security_group['SecurityGroupId'])
self.push(self.inventory, key, dest)
if self.nested_groups:
self.push_group(self.inventory, 'security_groups', key)
# Inventory: Group by engine
if self.group_by_elasticache_engine:
self.push(self.inventory, self.to_safe("elasticache_" + cluster['Engine']), dest)
if self.nested_groups:
self.push_group(self.inventory, 'elasticache_engines', self.to_safe("elasticache_" + cluster['Engine']))
# Inventory: Group by parameter group (done at cluster level)
# Inventory: Group by replication group (done at cluster level)
# Inventory: Group by ElastiCache Cluster
if self.group_by_elasticache_cluster:
self.push(self.inventory, self.to_safe("elasticache_cluster_" + cluster['CacheClusterId']), dest)
# Global Tag: all ElastiCache nodes
self.push(self.inventory, 'elasticache_nodes', dest)
host_info = self.get_host_info_dict_from_describe_dict(node)
if dest in self.inventory["_meta"]["hostvars"]:
self.inventory["_meta"]["hostvars"][dest].update(host_info)
else:
self.inventory["_meta"]["hostvars"][dest] = host_info
def add_elasticache_replication_group(self, replication_group, region):
''' Adds an ElastiCache replication group to the inventory and index '''
# Only want available clusters unless all_elasticache_replication_groups is True
if not self.all_elasticache_replication_groups and replication_group['Status'] != 'available':
return
# Select the best destination address (PrimaryEndpoint)
dest = replication_group['NodeGroups'][0]['PrimaryEndpoint']['Address']
if not dest:
# Skip clusters we cannot address (e.g. private VPC subnet)
return
# Add to index
self.index[dest] = [region, replication_group['ReplicationGroupId']]
# Inventory: Group by ID (always a group of 1)
if self.group_by_instance_id:
self.inventory[replication_group['ReplicationGroupId']] = [dest]
if self.nested_groups:
self.push_group(self.inventory, 'instances', replication_group['ReplicationGroupId'])
# Inventory: Group by region
if self.group_by_region:
self.push(self.inventory, region, dest)
if self.nested_groups:
self.push_group(self.inventory, 'regions', region)
# Inventory: Group by availability zone (doesn't apply to replication groups)
# Inventory: Group by node type (doesn't apply to replication groups)
# Inventory: Group by VPC (information not available in the current
# AWS API version for replication groups
# Inventory: Group by security group (doesn't apply to replication groups)
# Check this value in cluster level
# Inventory: Group by engine (replication groups are always Redis)
if self.group_by_elasticache_engine:
self.push(self.inventory, 'elasticache_redis', dest)
if self.nested_groups:
self.push_group(self.inventory, 'elasticache_engines', 'redis')
# Global Tag: all ElastiCache clusters
self.push(self.inventory, 'elasticache_replication_groups', replication_group['ReplicationGroupId'])
host_info = self.get_host_info_dict_from_describe_dict(replication_group)
self.inventory["_meta"]["hostvars"][dest] = host_info
def get_route53_records(self):
''' Get and store the map of resource records to domain names that
@ -672,7 +1106,6 @@ class Ec2Inventory(object):
return list(name_list)
def get_host_info_dict_from_instance(self, instance):
instance_vars = {}
for key in vars(instance):
@ -689,7 +1122,7 @@ class Ec2Inventory(object):
instance_vars['ec2_previous_state_code'] = instance.previous_state_code
elif type(value) in [int, bool]:
instance_vars[key] = value
elif type(value) in [str, unicode]:
elif isinstance(value, six.string_types):
instance_vars[key] = value.strip()
elif type(value) == type(None):
instance_vars[key] = ''
@ -698,7 +1131,9 @@ class Ec2Inventory(object):
elif key == 'ec2__placement':
instance_vars['ec2_placement'] = value.zone
elif key == 'ec2_tags':
for k, v in value.iteritems():
for k, v in value.items():
if self.expand_csv_tags and ',' in v:
v = map(lambda x: x.strip(), v.split(','))
key = self.to_safe('ec2_tag_' + k)
instance_vars[key] = v
elif key == 'ec2_groups':
@ -718,6 +1153,91 @@ class Ec2Inventory(object):
return instance_vars
def get_host_info_dict_from_describe_dict(self, describe_dict):
''' Parses the dictionary returned by the API call into a flat list
of parameters. This method should be used only when 'describe' is
used directly because Boto doesn't provide specific classes. '''
# I really don't agree with prefixing everything with 'ec2'
# because EC2, RDS and ElastiCache are different services.
# I'm just following the pattern used until now to not break any
# compatibility.
host_info = {}
for key in describe_dict:
value = describe_dict[key]
key = self.to_safe('ec2_' + self.uncammelize(key))
# Handle complex types
# Target: Memcached Cache Clusters
if key == 'ec2_configuration_endpoint' and value:
host_info['ec2_configuration_endpoint_address'] = value['Address']
host_info['ec2_configuration_endpoint_port'] = value['Port']
# Target: Cache Nodes and Redis Cache Clusters (single node)
if key == 'ec2_endpoint' and value:
host_info['ec2_endpoint_address'] = value['Address']
host_info['ec2_endpoint_port'] = value['Port']
# Target: Redis Replication Groups
if key == 'ec2_node_groups' and value:
host_info['ec2_endpoint_address'] = value[0]['PrimaryEndpoint']['Address']
host_info['ec2_endpoint_port'] = value[0]['PrimaryEndpoint']['Port']
replica_count = 0
for node in value[0]['NodeGroupMembers']:
if node['CurrentRole'] == 'primary':
host_info['ec2_primary_cluster_address'] = node['ReadEndpoint']['Address']
host_info['ec2_primary_cluster_port'] = node['ReadEndpoint']['Port']
host_info['ec2_primary_cluster_id'] = node['CacheClusterId']
elif node['CurrentRole'] == 'replica':
host_info['ec2_replica_cluster_address_'+ str(replica_count)] = node['ReadEndpoint']['Address']
host_info['ec2_replica_cluster_port_'+ str(replica_count)] = node['ReadEndpoint']['Port']
host_info['ec2_replica_cluster_id_'+ str(replica_count)] = node['CacheClusterId']
replica_count += 1
# Target: Redis Replication Groups
if key == 'ec2_member_clusters' and value:
host_info['ec2_member_clusters'] = ','.join([str(i) for i in value])
# Target: All Cache Clusters
elif key == 'ec2_cache_parameter_group':
host_info["ec2_cache_node_ids_to_reboot"] = ','.join([str(i) for i in value['CacheNodeIdsToReboot']])
host_info['ec2_cache_parameter_group_name'] = value['CacheParameterGroupName']
host_info['ec2_cache_parameter_apply_status'] = value['ParameterApplyStatus']
# Target: Almost everything
elif key == 'ec2_security_groups':
# Skip if SecurityGroups is None
# (it is possible to have the key defined but no value in it).
if value is not None:
sg_ids = []
for sg in value:
sg_ids.append(sg['SecurityGroupId'])
host_info["ec2_security_group_ids"] = ','.join([str(i) for i in sg_ids])
# Target: Everything
# Preserve booleans and integers
elif type(value) in [int, bool]:
host_info[key] = value
# Target: Everything
# Sanitize string values
elif isinstance(value, six.string_types):
host_info[key] = value.strip()
# Target: Everything
# Replace None by an empty string
elif type(value) == type(None):
host_info[key] = ''
else:
# Remove non-processed complex types
pass
return host_info
def get_host_info(self):
''' Get variables about a specific host '''
@ -781,13 +1301,16 @@ class Ec2Inventory(object):
cache.write(json_data)
cache.close()
def uncammelize(self, key):
temp = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', key)
return re.sub('([a-z0-9])([A-Z])', r'\1_\2', temp).lower()
def to_safe(self, word):
''' Converts 'bad' characters in a string to underscores so they can be
used as Ansible groups '''
return re.sub("[^A-Za-z0-9\-]", "_", word)
''' Converts 'bad' characters in a string to underscores so they can be used as Ansible groups '''
regex = "[^A-Za-z0-9\_"
if not self.replace_dash_in_groups:
regex += "\-"
return re.sub(regex + "]", "_", word)
def json_format_dict(self, data, pretty=False):
''' Converts a dict to a JSON object and dumps it as a formatted
@ -801,3 +1324,4 @@ class Ec2Inventory(object):
# Run the script
Ec2Inventory()

107
contrib/inventory/fleet.py Executable file
View File

@ -0,0 +1,107 @@
#!/usr/bin/env python
"""
fleetctl base external inventory script. Automatically finds the IPs of the booted coreos instances and
returns it under the host group 'coreos'
"""
# Copyright (C) 2014 Andrew Rothstein <andrew.rothstein at gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Thanks to the vagrant.py inventory script for giving me the basic structure
# of this.
#
import sys
import subprocess
import re
import string
from optparse import OptionParser
try:
import json
except:
import simplejson as json
# Options
#------------------------------
parser = OptionParser(usage="%prog [options] --list | --host <machine>")
parser.add_option('--list', default=False, dest="list", action="store_true",
help="Produce a JSON consumable grouping of servers in your fleet")
parser.add_option('--host', default=None, dest="host",
help="Generate additional host specific details for given host for Ansible")
(options, args) = parser.parse_args()
#
# helper functions
#
def get_ssh_config():
configs = []
for box in list_running_boxes():
config = get_a_ssh_config(box)
configs.append(config)
return configs
#list all the running instances in the fleet
def list_running_boxes():
boxes = []
for line in subprocess.check_output(["fleetctl", "list-machines"]).split('\n'):
matcher = re.search("[^\s]+[\s]+([^\s]+).+", line)
if matcher and matcher.group(1) != "IP":
boxes.append(matcher.group(1))
return boxes
def get_a_ssh_config(box_name):
config = {}
config['Host'] = box_name
config['ansible_ssh_user'] = 'core'
config['ansible_python_interpreter'] = '/opt/bin/python'
return config
# List out servers that vagrant has running
#------------------------------
if options.list:
ssh_config = get_ssh_config()
hosts = { 'coreos': []}
for data in ssh_config:
hosts['coreos'].append(data['Host'])
print(json.dumps(hosts))
sys.exit(1)
# Get out the host details
#------------------------------
elif options.host:
result = {}
ssh_config = get_ssh_config()
details = filter(lambda x: (x['Host'] == options.host), ssh_config)
if len(details) > 0:
#pass through the port, in case it's non standard.
result = details[0]
result
print(json.dumps(result))
sys.exit(1)
# Print out help
#------------------------------
else:
parser.print_help()
sys.exit(1)

View File

@ -13,7 +13,11 @@ def initialize():
api.bootstrap(context='cli')
api.finalize()
api.Backend.xmlclient.connect()
try:
api.Backend.rpcclient.connect()
except AttributeError:
#FreeIPA < 4.0 compatibility
api.Backend.xmlclient.connect()
return api
@ -37,7 +41,7 @@ def list_groups(api):
inventory['_meta'] = {'hostvars': hostvars}
inv_string = json.dumps(inventory, indent=1, sort_keys=True)
print inv_string
print(inv_string)
return None
@ -65,7 +69,7 @@ def print_host(host):
This function expects one string, this hostname to lookup variables for.
'''
print json.dumps({})
print(json.dumps({}))
return None

View File

@ -66,7 +66,7 @@ Examples:
$ ansible -i gce.py us-central1-a -m shell -a "/bin/uname -a"
Use the GCE inventory script to print out instance specific information
$ plugins/inventory/gce.py --host my_instance
$ contrib/inventory/gce.py --host my_instance
Author: Eric Johnson <erjohnso@google.com>
Version: 0.0.1
@ -112,9 +112,9 @@ class GceInventory(object):
# Just display data for specific host
if self.args.host:
print self.json_format_dict(self.node_to_dict(
print(self.json_format_dict(self.node_to_dict(
self.get_instance(self.args.host)),
pretty=self.args.pretty)
pretty=self.args.pretty))
sys.exit(0)
# Otherwise, assume user wants all instances grouped
@ -221,7 +221,7 @@ class GceInventory(object):
'gce_image': inst.image,
'gce_machine_type': inst.size,
'gce_private_ip': inst.private_ips[0],
'gce_public_ip': inst.public_ips[0],
'gce_public_ip': inst.public_ips[0] if len(inst.public_ips) >= 1 else None,
'gce_name': inst.name,
'gce_description': inst.extra['description'],
'gce_status': inst.extra['status'],
@ -230,14 +230,14 @@ class GceInventory(object):
'gce_metadata': md,
'gce_network': net,
# Hosts don't have a public name, so we add an IP
'ansible_ssh_host': inst.public_ips[0]
'ansible_ssh_host': inst.public_ips[0] if len(inst.public_ips) >= 1 else inst.private_ips[0]
}
def get_instance(self, instance_name):
'''Gets details about a specific instance '''
try:
return self.driver.ex_get_node(instance_name)
except Exception, e:
except Exception as e:
return None
def group_instances(self):
@ -257,7 +257,10 @@ class GceInventory(object):
tags = node.extra['tags']
for t in tags:
tag = 'tag_%s' % t
if t.startswith('group-'):
tag = t[6:]
else:
tag = 'tag_%s' % t
if groups.has_key(tag): groups[tag].append(name)
else: groups[tag] = [name]

View File

@ -30,8 +30,8 @@ result['all']['vars'] = {}
result['all']['vars']['ansible_connection'] = 'jail'
if len(sys.argv) == 2 and sys.argv[1] == '--list':
print json.dumps(result)
print(json.dumps(result))
elif len(sys.argv) == 3 and sys.argv[1] == '--host':
print json.dumps({'ansible_connection': 'jail'})
print(json.dumps({'ansible_connection': 'jail'}))
else:
print "Need an argument, either --list or --host <host>"
print("Need an argument, either --list or --host <host>")

128
contrib/inventory/landscape.py Executable file
View File

@ -0,0 +1,128 @@
#!/usr/bin/env python
# (c) 2015, Marc Abramowitz <marca@surveymonkey.com>
#
# This file is part of Ansible.
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
# Dynamic inventory script which lets you use nodes discovered by Canonical's
# Landscape (http://www.ubuntu.com/management/landscape-features).
#
# Requires the `landscape_api` Python module
# See:
# - https://landscape.canonical.com/static/doc/api/api-client-package.html
# - https://landscape.canonical.com/static/doc/api/python-api.html
#
# Environment variables
# ---------------------
# - `LANDSCAPE_API_URI`
# - `LANDSCAPE_API_KEY`
# - `LANDSCAPE_API_SECRET`
# - `LANDSCAPE_API_SSL_CA_FILE` (optional)
import argparse
import collections
import os
import sys
from landscape_api.base import API, HTTPError
try:
import json
except ImportError:
import simplejson as json
_key = 'landscape'
class EnvironmentConfig(object):
uri = os.getenv('LANDSCAPE_API_URI')
access_key = os.getenv('LANDSCAPE_API_KEY')
secret_key = os.getenv('LANDSCAPE_API_SECRET')
ssl_ca_file = os.getenv('LANDSCAPE_API_SSL_CA_FILE')
def _landscape_client():
env = EnvironmentConfig()
return API(
uri=env.uri,
access_key=env.access_key,
secret_key=env.secret_key,
ssl_ca_file=env.ssl_ca_file)
def get_landscape_members_data():
return _landscape_client().get_computers()
def get_nodes(data):
return [node['hostname'] for node in data]
def get_groups(data):
groups = collections.defaultdict(list)
for node in data:
for value in node['tags']:
groups[value].append(node['hostname'])
return groups
def get_meta(data):
meta = {'hostvars': {}}
for node in data:
meta['hostvars'][node['hostname']] = {'tags': node['tags']}
return meta
def print_list():
data = get_landscape_members_data()
nodes = get_nodes(data)
groups = get_groups(data)
meta = get_meta(data)
inventory_data = {_key: nodes, '_meta': meta}
inventory_data.update(groups)
print(json.dumps(inventory_data))
def print_host(host):
data = get_landscape_members_data()
meta = get_meta(data)
print(json.dumps(meta['hostvars'][host]))
def get_args(args_list):
parser = argparse.ArgumentParser(
description='ansible inventory script reading from landscape cluster')
mutex_group = parser.add_mutually_exclusive_group(required=True)
help_list = 'list all hosts from landscape cluster'
mutex_group.add_argument('--list', action='store_true', help=help_list)
help_host = 'display variables for a host'
mutex_group.add_argument('--host', help=help_host)
return parser.parse_args(args_list)
def main(args_list):
args = get_args(args_list)
if args.list:
print_list()
if args.host:
print_host(args.host)
if __name__ == '__main__':
main(sys.argv[1:])

View File

@ -27,11 +27,11 @@ result['all'] = {}
pipe = Popen(['virsh', '-q', '-c', 'lxc:///', 'list', '--name', '--all'], stdout=PIPE, universal_newlines=True)
result['all']['hosts'] = [x[:-1] for x in pipe.stdout.readlines()]
result['all']['vars'] = {}
result['all']['vars']['ansible_connection'] = 'lxc'
result['all']['vars']['ansible_connection'] = 'libvirt_lxc'
if len(sys.argv) == 2 and sys.argv[1] == '--list':
print json.dumps(result)
print(json.dumps(result))
elif len(sys.argv) == 3 and sys.argv[1] == '--host':
print json.dumps({'ansible_connection': 'lxc'})
print(json.dumps({'ansible_connection': 'libvirt_lxc'}))
else:
print "Need an argument, either --list or --host <host>"
print("Need an argument, either --list or --host <host>")

View File

@ -101,7 +101,7 @@ except:
from chube.linode_obj import Linode
sys.path = old_path
except Exception, e:
except Exception as e:
raise Exception("could not import chube")
load_chube_config()
@ -139,7 +139,7 @@ class LinodeInventory(object):
else:
data_to_print = self.json_format_dict(self.inventory, True)
print data_to_print
print(data_to_print)
def is_cache_valid(self):
"""Determines if the cache file has expired, or if it is still valid."""
@ -184,20 +184,20 @@ class LinodeInventory(object):
try:
for node in Linode.search(status=Linode.STATUS_RUNNING):
self.add_node(node)
except chube_api.linode_api.ApiError, e:
print "Looks like Linode's API is down:"
print
print e
except chube_api.linode_api.ApiError as e:
print("Looks like Linode's API is down:")
print("")
print(e)
sys.exit(1)
def get_node(self, linode_id):
"""Gets details about a specific node."""
try:
return Linode.find(api_id=linode_id)
except chube_api.linode_api.ApiError, e:
print "Looks like Linode's API is down:"
print
print e
except chube_api.linode_api.ApiError as e:
print("Looks like Linode's API is down:")
print("")
print(e)
sys.exit(1)
def populate_datacenter_cache(self):

View File

@ -0,0 +1,10 @@
# Ansible Nagios external inventory script settings
#
[ndo]
# NDO database URI
# Make sure that data is returned as strings and not bytes if using python 3.
# See http://docs.sqlalchemy.org/en/rel_1_0/core/engines.html
# for supported databases and URI format.
# Example for mysqlclient module :
database_uri=mysql+mysqldb://user:passwd@hostname/ndo?charset=utf8&use_unicode=1

109
contrib/inventory/nagios_ndo.py Executable file
View File

@ -0,0 +1,109 @@
#!/usr/bin/env python
# (c) 2014, Jonathan Lestrelin <jonathan.lestrelin@gmail.com>
#
# This file is part of Ansible,
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
"""
Nagios NDO external inventory script.
========================================
Returns hosts and hostgroups from Nagios NDO.
Configuration is read from `nagios_ndo.ini`.
"""
import os
import argparse
try:
import configparser
except ImportError:
import ConfigParser
configparser = ConfigParser
import json
try:
from sqlalchemy import text
from sqlalchemy.engine import create_engine
except ImportError:
print("Error: SQLAlchemy is needed. Try something like: pip install sqlalchemy")
exit(1)
class NagiosNDOInventory(object):
def read_settings(self):
config = configparser.SafeConfigParser()
config.read(os.path.dirname(os.path.realpath(__file__)) + '/nagios_ndo.ini')
if config.has_option('ndo', 'database_uri'):
self.ndo_database_uri = config.get('ndo', 'database_uri')
def read_cli(self):
parser = argparse.ArgumentParser()
parser.add_argument('--host', nargs=1)
parser.add_argument('--list', action='store_true')
self.options = parser.parse_args()
def get_hosts(self):
engine = create_engine(self.ndo_database_uri)
connection = engine.connect()
select_hosts = text("SELECT display_name \
FROM nagios_hosts")
select_hostgroups = text("SELECT alias \
FROM nagios_hostgroups")
select_hostgroup_hosts = text("SELECT h.display_name \
FROM nagios_hostgroup_members hgm, nagios_hosts h, nagios_hostgroups hg \
WHERE hgm.hostgroup_id = hg.hostgroup_id \
AND hgm.host_object_id = h.host_object_id \
AND hg.alias =:hostgroup_alias")
hosts = connection.execute(select_hosts)
self.result['all']['hosts'] = [host['display_name'] for host in hosts]
for hostgroup in connection.execute(select_hostgroups):
hostgroup_alias = hostgroup['alias']
self.result[hostgroup_alias] = {}
hosts = connection.execute(select_hostgroup_hosts, hostgroup_alias=hostgroup_alias)
self.result[hostgroup_alias]['hosts'] = [host['display_name'] for host in hosts]
def __init__(self):
self.defaultgroup = 'group_all'
self.ndo_database_uri = None
self.options = None
self.read_settings()
self.read_cli()
self.result = {}
self.result['all'] = {}
self.result['all']['hosts'] = []
self.result['_meta'] = {}
self.result['_meta']['hostvars'] = {}
if self.ndo_database_uri:
self.get_hosts()
if self.options.host:
print(json.dumps({}))
elif self.options.list:
print(json.dumps(self.result))
else:
print("usage: --list or --host HOSTNAME")
exit(1)
else:
print("Error: Database configuration is missing. See nagios_ndo.ini.")
exit(1)
NagiosNDOInventory()

View File

@ -0,0 +1,48 @@
# Ansible OpenStack external inventory script
# DEPRECATED: please use openstack.py inventory which is configured for
# auth using the os-client-config library and either clouds.yaml or standard
# openstack environment variables
[openstack]
#-------------------------------------------------------------------------
# Required settings
#-------------------------------------------------------------------------
# API version
version = 2
# OpenStack nova username
username =
# OpenStack nova api_key or password
api_key =
# OpenStack nova auth_url
auth_url =
# OpenStack nova project_id or tenant name
project_id =
#-------------------------------------------------------------------------
# Optional settings
#-------------------------------------------------------------------------
# Authentication system
# auth_system = keystone
# Serverarm region name to use
# region_name =
# Specify a preference for public or private IPs (public is default)
# prefer_private = False
# What service type (required for newer nova client)
# service_type = compute
# TODO: Some other options
# insecure =
# endpoint_type =
# extensions =
# service_name =

230
contrib/inventory/nova.py Executable file
View File

@ -0,0 +1,230 @@
#!/usr/bin/env python
# (c) 2012, Marco Vito Moscaritolo <marco@agavee.com>
#
# This file is part of Ansible,
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
# WARNING: This file is deprecated. New work should focus on the openstack.py
# inventory module, which properly handles multiple clouds as well as keystone
# v3 and keystone auth plugins
import sys
import re
import os
import ConfigParser
from novaclient import client as nova_client
from six import iteritems
try:
import json
except ImportError:
import simplejson as json
sys.stderr.write("WARNING: this inventory module is deprecated. please migrate usage to openstack.py\n")
###################################################
# executed with no parameters, return the list of
# all groups and hosts
NOVA_CONFIG_FILES = [os.getcwd() + "/nova.ini",
os.path.expanduser(os.environ.get('ANSIBLE_CONFIG', "~/nova.ini")),
"/etc/ansible/nova.ini"]
NOVA_DEFAULTS = {
'auth_system': None,
'region_name': None,
'service_type': 'compute',
}
def nova_load_config_file():
p = ConfigParser.SafeConfigParser(NOVA_DEFAULTS)
for path in NOVA_CONFIG_FILES:
if os.path.exists(path):
p.read(path)
return p
return None
def get_fallback(config, value, section="openstack"):
"""
Get value from config object and return the value
or false
"""
try:
return config.get(section, value)
except ConfigParser.NoOptionError:
return False
def push(data, key, element):
"""
Assist in items to a dictionary of lists
"""
if (not element) or (not key):
return
if key in data:
data[key].append(element)
else:
data[key] = [element]
def to_safe(word):
'''
Converts 'bad' characters in a string to underscores so they can
be used as Ansible groups
'''
return re.sub(r"[^A-Za-z0-9\-]", "_", word)
def get_ips(server, access_ip=True):
"""
Returns a list of the server's IPs, or the preferred
access IP
"""
private = []
public = []
address_list = []
# Iterate through each servers network(s), get addresses and get type
addresses = getattr(server, 'addresses', {})
if len(addresses) > 0:
for network in addresses.itervalues():
for address in network:
if address.get('OS-EXT-IPS:type', False) == 'fixed':
private.append(address['addr'])
elif address.get('OS-EXT-IPS:type', False) == 'floating':
public.append(address['addr'])
if not access_ip:
address_list.append(server.accessIPv4)
address_list.extend(private)
address_list.extend(public)
return address_list
access_ip = None
# Append group to list
if server.accessIPv4:
access_ip = server.accessIPv4
if (not access_ip) and public and not (private and prefer_private):
access_ip = public[0]
if private and not access_ip:
access_ip = private[0]
return access_ip
def get_metadata(server):
"""Returns dictionary of all host metadata"""
get_ips(server, False)
results = {}
for key in vars(server):
# Extract value
value = getattr(server, key)
# Generate sanitized key
key = 'os_' + re.sub(r"[^A-Za-z0-9\-]", "_", key).lower()
# Att value to instance result (exclude manager class)
#TODO: maybe use value.__class__ or similar inside of key_name
if key != 'os_manager':
results[key] = value
return results
config = nova_load_config_file()
if not config:
sys.exit('Unable to find configfile in %s' % ', '.join(NOVA_CONFIG_FILES))
# Load up connections info based on config and then environment
# variables
username = (get_fallback(config, 'username') or
os.environ.get('OS_USERNAME', None))
api_key = (get_fallback(config, 'api_key') or
os.environ.get('OS_PASSWORD', None))
auth_url = (get_fallback(config, 'auth_url') or
os.environ.get('OS_AUTH_URL', None))
project_id = (get_fallback(config, 'project_id') or
os.environ.get('OS_TENANT_NAME', None))
region_name = (get_fallback(config, 'region_name') or
os.environ.get('OS_REGION_NAME', None))
auth_system = (get_fallback(config, 'auth_system') or
os.environ.get('OS_AUTH_SYSTEM', None))
# Determine what type of IP is preferred to return
prefer_private = False
try:
prefer_private = config.getboolean('openstack', 'prefer_private')
except ConfigParser.NoOptionError:
pass
client = nova_client.Client(
version=config.get('openstack', 'version'),
username=username,
api_key=api_key,
auth_url=auth_url,
region_name=region_name,
project_id=project_id,
auth_system=auth_system,
service_type=config.get('openstack', 'service_type'),
)
# Default or added list option
if (len(sys.argv) == 2 and sys.argv[1] == '--list') or len(sys.argv) == 1:
groups = {'_meta': {'hostvars': {}}}
# Cycle on servers
for server in client.servers.list():
access_ip = get_ips(server)
# Push to name group of 1
push(groups, server.name, access_ip)
# Run through each metadata item and add instance to it
for key, value in iteritems(server.metadata):
composed_key = to_safe('tag_{0}_{1}'.format(key, value))
push(groups, composed_key, access_ip)
# Do special handling of group for backwards compat
# inventory groups
group = server.metadata['group'] if 'group' in server.metadata else 'undefined'
push(groups, group, access_ip)
# Add vars to _meta key for performance optimization in
# Ansible 1.3+
groups['_meta']['hostvars'][access_ip] = get_metadata(server)
# Return server list
print(json.dumps(groups, sort_keys=True, indent=2))
sys.exit(0)
#####################################################
# executed with a hostname as a parameter, return the
# variables for that host
elif len(sys.argv) == 3 and (sys.argv[1] == '--host'):
results = {}
ips = []
for server in client.servers.list():
if sys.argv[2] in (get_ips(server) or []):
results = get_metadata(server)
print(json.dumps(results, sort_keys=True, indent=2))
sys.exit(0)
else:
print("usage: --list ..OR.. --host <hostname>")
sys.exit(1)

341
contrib/inventory/nsot.py Normal file
View File

@ -0,0 +1,341 @@
#!/bin/env python
'''
nsot
====
Ansible Dynamic Inventory to pull hosts from NSoT, a flexible CMDB by Dropbox
Features
--------
* Define host groups in form of NSoT device attribute criteria
* All parameters defined by the spec as of 2015-09-05 are supported.
+ ``--list``: Returns JSON hash of host groups -> hosts and top-level
``_meta`` -> ``hostvars`` which correspond to all device attributes.
Group vars can be specified in the YAML configuration, noted below.
+ ``--host <hostname>``: Returns JSON hash where every item is a device
attribute.
* In addition to all attributes assigned to resource being returned, script
will also append ``site_id`` and ``id`` as facts to utilize.
Confguration
------------
Since it'd be annoying and failure prone to guess where you're configuration
file is, use ``NSOT_INVENTORY_CONFIG`` to specify the path to it.
This file should adhere to the YAML spec. All top-level variable must be
desired Ansible group-name hashed with single 'query' item to define the NSoT
attribute query.
Queries follow the normal NSoT query syntax, `shown here`_
.. _shown here: https://github.com/dropbox/pynsot#set-queries
.. code:: yaml
routers:
query: 'deviceType=ROUTER'
vars:
a: b
c: d
juniper_fw:
query: 'deviceType=FIREWALL manufacturer=JUNIPER'
not_f10:
query: '-manufacturer=FORCE10'
The inventory will automatically use your ``.pynsotrc`` like normal pynsot from
cli would, so make sure that's configured appropriately.
.. note::
Attributes I'm showing above are influenced from ones that the Trigger
project likes. As is the spirit of NSoT, use whichever attributes work best
for your workflow.
If config file is blank or absent, the following default groups will be
created:
* ``routers``: deviceType=ROUTER
* ``switches``: deviceType=SWITCH
* ``firewalls``: deviceType=FIREWALL
These are likely not useful for everyone so please use the configuration. :)
.. note::
By default, resources will only be returned for what your default
site is set for in your ``~/.pynsotrc``.
If you want to specify, add an extra key under the group for ``site: n``.
Output Examples
---------------
Here are some examples shown from just calling the command directly::
$ NSOT_INVENTORY_CONFIG=$PWD/test.yaml ansible_nsot --list | jq '.'
{
"routers": {
"hosts": [
"test1.example.com"
],
"vars": {
"cool_level": "very",
"group": "routers"
}
},
"firewalls": {
"hosts": [
"test2.example.com"
],
"vars": {
"cool_level": "enough",
"group": "firewalls"
}
},
"_meta": {
"hostvars": {
"test2.example.com": {
"make": "SRX",
"site_id": 1,
"id": 108
},
"test1.example.com": {
"make": "MX80",
"site_id": 1,
"id": 107
}
}
},
"rtr_and_fw": {
"hosts": [
"test1.example.com",
"test2.example.com"
],
"vars": {}
}
}
$ NSOT_INVENTORY_CONFIG=$PWD/test.yaml ansible_nsot --host test1 | jq '.'
{
"make": "MX80",
"site_id": 1,
"id": 107
}
'''
from __future__ import print_function
import sys
import os
import pkg_resources
import argparse
import json
import yaml
from textwrap import dedent
from pynsot.client import get_api_client
from pynsot.app import HttpServerError
from click.exceptions import UsageError
def warning(*objs):
print("WARNING: ", *objs, file=sys.stderr)
class NSoTInventory(object):
'''NSoT Client object for gather inventory'''
def __init__(self):
self.config = dict()
config_env = os.environ.get('NSOT_INVENTORY_CONFIG')
if config_env:
try:
config_file = os.path.abspath(config_env)
except IOError: # If file non-existent, use default config
self._config_default()
except Exception as e:
sys.exit('%s\n' % e)
with open(config_file) as f:
try:
self.config.update(yaml.safe_load(f))
except TypeError: # If empty file, use default config
warning('Empty config file')
self._config_default()
except Exception as e:
sys.exit('%s\n' % e)
else: # Use defaults if env var missing
self._config_default()
self.groups = self.config.keys()
self.client = get_api_client()
self._meta = {'hostvars': dict()}
def _config_default(self):
default_yaml = '''
---
routers:
query: deviceType=ROUTER
switches:
query: deviceType=SWITCH
firewalls:
query: deviceType=FIREWALL
'''
self.config = yaml.safe_load(dedent(default_yaml))
def do_list(self):
'''Direct callback for when ``--list`` is provided
Relies on the configuration generated from init to run
_inventory_group()
'''
inventory = dict()
for group, contents in self.config.iteritems():
group_response = self._inventory_group(group, contents)
inventory.update(group_response)
inventory.update({'_meta': self._meta})
return json.dumps(inventory)
def do_host(self, host):
return json.dumps(self._hostvars(host))
def _hostvars(self, host):
'''Return dictionary of all device attributes
Depending on number of devices in NSoT, could be rather slow since this
has to request every device resource to filter through
'''
device = [i for i in self.client.devices.get()['data']['devices']
if host in i['hostname']][0]
attributes = device['attributes']
attributes.update({'site_id': device['site_id'], 'id': device['id']})
return attributes
def _inventory_group(self, group, contents):
'''Takes a group and returns inventory for it as dict
:param group: Group name
:type group: str
:param contents: The contents of the group's YAML config
:type contents: dict
contents param should look like::
{
'query': 'xx',
'vars':
'a': 'b'
}
Will return something like::
{ group: {
hosts: [],
vars: {},
}
'''
query = contents.get('query')
hostvars = contents.get('vars', dict())
site = contents.get('site', dict())
obj = {group: dict()}
obj[group]['hosts'] = []
obj[group]['vars'] = hostvars
try:
assert isinstance(query, basestring)
except:
sys.exit('ERR: Group queries must be a single string\n'
' Group: %s\n'
' Query: %s\n' % (group, query)
)
try:
if site:
site = self.client.sites(site)
devices = site.devices.query.get(query=query)
else:
devices = self.client.devices.query.get(query=query)
except HttpServerError as e:
if '500' in str(e.response):
_site = 'Correct site id?'
_attr = 'Queried attributes actually exist?'
questions = _site + '\n' + _attr
sys.exit('ERR: 500 from server.\n%s' % questions)
else:
raise
except UsageError:
sys.exit('ERR: Could not connect to server. Running?')
# Would do a list comprehension here, but would like to save code/time
# and also acquire attributes in this step
for host in devices['data']['devices']:
# Iterate through each device that matches query, assign hostname
# to the group's hosts array and then use this single iteration as
# a chance to update self._meta which will be used in the final
# return
hostname = host['hostname']
obj[group]['hosts'].append(hostname)
attributes = host['attributes']
attributes.update({'site_id': host['site_id'], 'id': host['id']})
self._meta['hostvars'].update({hostname: attributes})
return obj
def parse_args():
desc = __doc__.splitlines()[4] # Just to avoid being redundant
# Establish parser with options and error out if no action provided
parser = argparse.ArgumentParser(
description=desc,
conflict_handler='resolve',
)
# Arguments
#
# Currently accepting (--list | -l) and (--host | -h)
# These must not be allowed together
parser.add_argument(
'--list', '-l',
help='Print JSON object containing hosts to STDOUT',
action='store_true',
dest='list_', # Avoiding syntax highlighting for list
)
parser.add_argument(
'--host', '-h',
help='Print JSON object containing hostvars for <host>',
action='store',
)
args = parser.parse_args()
if not args.list_ and not args.host: # Require at least one option
parser.exit(status=1, message='No action requested')
if args.list_ and args.host: # Do not allow multiple options
parser.exit(status=1, message='Too many actions requested')
return args
def main():
'''Set up argument handling and callback routing'''
args = parse_args()
client = NSoTInventory()
# Callback condition
if args.list_:
print(client.do_list())
elif args.host:
print(client.do_host(args.host))
if __name__ == '__main__':
main()

View File

@ -0,0 +1,22 @@
---
juniper_routers:
query: 'deviceType=ROUTER manufacturer=JUNIPER'
vars:
group: juniper_routers
netconf: true
os: junos
cisco_asa:
query: 'manufacturer=CISCO deviceType=FIREWALL'
vars:
group: cisco_asa
routed_vpn: false
stateful: true
old_cisco_asa:
query: 'manufacturer=CISCO deviceType=FIREWALL -softwareVersion=8.3+'
vars:
old_nat: true
not_f10:
query: '-manufacturer=FORCE10'

View File

@ -28,7 +28,6 @@ version_added: None
author: Michael Scherer
'''
import urllib2
try:
import json
except ImportError:
@ -39,6 +38,8 @@ import sys
import ConfigParser
import StringIO
from ansible.module_utils.urls import open_url
configparser = None
@ -61,39 +62,26 @@ def get_config(env_var, config_var):
if not result:
result = get_from_rhc_config(config_var)
if not result:
print "failed=True msg='missing %s'" % env_var
print("failed=True msg='missing %s'" % env_var)
sys.exit(1)
return result
def get_json_from_api(url):
req = urllib2.Request(url, None, {'Accept': 'application/json; version=1.5'})
response = urllib2.urlopen(req)
def get_json_from_api(url, username, password):
headers = {'Accept': 'application/json; version=1.5'}
response = open_url(url, headers=headers, url_username=username, url_password=password)
return json.loads(response.read())['data']
def passwd_setup(top_level_url, username, password):
# create a password manager
password_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
password_mgr.add_password(None, top_level_url, username, password)
handler = urllib2.HTTPBasicAuthHandler(password_mgr)
opener = urllib2.build_opener(handler)
urllib2.install_opener(opener)
username = get_config('ANSIBLE_OPENSHIFT_USERNAME', 'default_rhlogin')
password = get_config('ANSIBLE_OPENSHIFT_PASSWORD', 'password')
broker_url = 'https://%s/broker/rest/' % get_config('ANSIBLE_OPENSHIFT_BROKER', 'libra_server')
passwd_setup(broker_url, username, password)
response = get_json_from_api(broker_url + '/domains')
response = get_json_from_api(broker_url + '/domains', username, password)
response = get_json_from_api("%s/domains/%s/applications" %
(broker_url, response[0]['id']))
(broker_url, response[0]['id']), username, password)
result = {}
for app in response:
@ -109,8 +97,8 @@ for app in response:
result[app_name]['vars']['ansible_ssh_user'] = user
if len(sys.argv) == 2 and sys.argv[1] == '--list':
print json.dumps(result)
print(json.dumps(result))
elif len(sys.argv) == 3 and sys.argv[1] == '--host':
print json.dumps({})
print(json.dumps({}))
else:
print "Need an argument, either --list or --host <host>"
print("Need an argument, either --list or --host <host>")

229
contrib/inventory/openstack.py Executable file
View File

@ -0,0 +1,229 @@
#!/usr/bin/env python
# Copyright (c) 2012, Marco Vito Moscaritolo <marco@agavee.com>
# Copyright (c) 2013, Jesse Keating <jesse.keating@rackspace.com>
# Copyright (c) 2015, Hewlett-Packard Development Company, L.P.
#
# This module is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this software. If not, see <http://www.gnu.org/licenses/>.
# The OpenStack Inventory module uses os-client-config for configuration.
# https://github.com/stackforge/os-client-config
# This means it will either:
# - Respect normal OS_* environment variables like other OpenStack tools
# - Read values from a clouds.yaml file.
# If you want to configure via clouds.yaml, you can put the file in:
# - Current directory
# - ~/.config/openstack/clouds.yaml
# - /etc/openstack/clouds.yaml
# - /etc/ansible/openstack.yml
# The clouds.yaml file can contain entries for multiple clouds and multiple
# regions of those clouds. If it does, this inventory module will connect to
# all of them and present them as one contiguous inventory.
#
# See the adjacent openstack.yml file for an example config file
# There are two ansible inventory specific options that can be set in
# the inventory section.
# expand_hostvars controls whether or not the inventory will make extra API
# calls to fill out additional information about each server
# use_hostnames changes the behavior from registering every host with its UUID
# and making a group of its hostname to only doing this if the
# hostname in question has more than one server
import argparse
import collections
import os
import sys
import time
try:
import json
except:
import simplejson as json
import os_client_config
import shade
import shade.inventory
CONFIG_FILES = ['/etc/ansible/openstack.yaml']
def get_groups_from_server(server_vars, namegroup=True):
groups = []
region = server_vars['region']
cloud = server_vars['cloud']
metadata = server_vars.get('metadata', {})
# Create a group for the cloud
groups.append(cloud)
# Create a group on region
groups.append(region)
# And one by cloud_region
groups.append("%s_%s" % (cloud, region))
# Check if group metadata key in servers' metadata
if 'group' in metadata:
groups.append(metadata['group'])
for extra_group in metadata.get('groups', '').split(','):
if extra_group:
groups.append(extra_group)
groups.append('instance-%s' % server_vars['id'])
if namegroup:
groups.append(server_vars['name'])
for key in ('flavor', 'image'):
if 'name' in server_vars[key]:
groups.append('%s-%s' % (key, server_vars[key]['name']))
for key, value in iter(metadata.items()):
groups.append('meta-%s_%s' % (key, value))
az = server_vars.get('az', None)
if az:
# Make groups for az, region_az and cloud_region_az
groups.append(az)
groups.append('%s_%s' % (region, az))
groups.append('%s_%s_%s' % (cloud, region, az))
return groups
def get_host_groups(inventory, refresh=False):
(cache_file, cache_expiration_time) = get_cache_settings()
if is_cache_stale(cache_file, cache_expiration_time, refresh=refresh):
groups = to_json(get_host_groups_from_cloud(inventory))
open(cache_file, 'w').write(groups)
else:
groups = open(cache_file, 'r').read()
return groups
def get_host_groups_from_cloud(inventory):
groups = collections.defaultdict(list)
firstpass = collections.defaultdict(list)
hostvars = {}
list_args = {}
if hasattr(inventory, 'extra_config'):
use_hostnames = inventory.extra_config['use_hostnames']
list_args['expand'] = inventory.extra_config['expand_hostvars']
else:
use_hostnames = False
for server in inventory.list_hosts(**list_args):
if 'interface_ip' not in server:
continue
firstpass[server['name']].append(server)
for name, servers in firstpass.items():
if len(servers) == 1 and use_hostnames:
server = servers[0]
hostvars[name] = dict(
ansible_ssh_host=server['interface_ip'],
openstack=server)
for group in get_groups_from_server(server, namegroup=False):
groups[group].append(server['name'])
else:
for server in servers:
server_id = server['id']
hostvars[server_id] = dict(
ansible_ssh_host=server['interface_ip'],
openstack=server)
for group in get_groups_from_server(server, namegroup=True):
groups[group].append(server_id)
groups['_meta'] = {'hostvars': hostvars}
return groups
def is_cache_stale(cache_file, cache_expiration_time, refresh=False):
''' Determines if cache file has expired, or if it is still valid '''
if refresh:
return True
if os.path.isfile(cache_file):
mod_time = os.path.getmtime(cache_file)
current_time = time.time()
if (mod_time + cache_expiration_time) > current_time:
return False
return True
def get_cache_settings():
config = os_client_config.config.OpenStackConfig(
config_files=os_client_config.config.CONFIG_FILES + CONFIG_FILES)
# For inventory-wide caching
cache_expiration_time = config.get_cache_expiration_time()
cache_path = config.get_cache_path()
if not os.path.exists(cache_path):
os.makedirs(cache_path)
cache_file = os.path.join(cache_path, 'ansible-inventory.cache')
return (cache_file, cache_expiration_time)
def to_json(in_dict):
return json.dumps(in_dict, sort_keys=True, indent=2)
def parse_args():
parser = argparse.ArgumentParser(description='OpenStack Inventory Module')
parser.add_argument('--private',
action='store_true',
help='Use private address for ansible host')
parser.add_argument('--refresh', action='store_true',
help='Refresh cached information')
parser.add_argument('--debug', action='store_true', default=False,
help='Enable debug output')
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument('--list', action='store_true',
help='List active servers')
group.add_argument('--host', help='List details about the specific host')
return parser.parse_args()
def main():
args = parse_args()
try:
config_files = os_client_config.config.CONFIG_FILES + CONFIG_FILES
shade.simple_logging(debug=args.debug)
inventory_args = dict(
refresh=args.refresh,
config_files=config_files,
private=args.private,
)
if hasattr(shade.inventory.OpenStackInventory, 'extra_config'):
inventory_args.update(dict(
config_key='ansible',
config_defaults={
'use_hostnames': False,
'expand_hostvars': True,
}
))
inventory = shade.inventory.OpenStackInventory(**inventory_args)
if args.list:
output = get_host_groups(inventory, refresh=args.refresh)
elif args.host:
output = to_json(inventory.get_host(args.host))
print(output)
except shade.OpenStackCloudException as e:
sys.stderr.write('%s\n' % e.message)
sys.exit(1)
sys.exit(0)
if __name__ == '__main__':
main()

View File

@ -26,3 +26,6 @@ clouds:
username: stack
password: stack
project_name: stack
ansible:
use_hostnames: True
expand_hostvars: False

77
contrib/inventory/openvz.py Executable file
View File

@ -0,0 +1,77 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# openvz.py
#
# Copyright 2014 jordonr <jordon@beamsyn.net>
#
# This file is part of Ansible.
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
#
# Inspired by libvirt_lxc.py inventory script
# https://github.com/ansible/ansible/blob/e5ef0eca03cbb6c8950c06dc50d0ca22aa8902f4/plugins/inventory/libvirt_lxc.py
#
# Groups are determined by the description field of openvz guests
# multiple groups can be separated by commas: webserver,dbserver
from subprocess import Popen,PIPE
import sys
import json
#List openvz hosts
vzhosts = ['vzhost1','vzhost2','vzhost3']
#Add openvz hosts to the inventory and Add "_meta" trick
inventory = {'vzhosts': {'hosts': vzhosts}, '_meta': {'hostvars': {}}}
#default group, when description not defined
default_group = ['vzguest']
def get_guests():
#Loop through vzhosts
for h in vzhosts:
#SSH to vzhost and get the list of guests in json
pipe = Popen(['ssh', h,'vzlist','-j'], stdout=PIPE, universal_newlines=True)
#Load Json info of guests
json_data = json.loads(pipe.stdout.read())
#loop through guests
for j in json_data:
#Add information to host vars
inventory['_meta']['hostvars'][j['hostname']] = {'ctid': j['ctid'], 'veid': j['veid'], 'vpsid': j['vpsid'], 'private_path': j['private'], 'root_path': j['root'], 'ip': j['ip']}
#determine group from guest description
if j['description'] is not None:
groups = j['description'].split(",")
else:
groups = default_group
#add guest to inventory
for g in groups:
if g not in inventory:
inventory[g] = {'hosts': []}
inventory[g]['hosts'].append(j['hostname'])
return inventory
if len(sys.argv) == 2 and sys.argv[1] == '--list':
inv_json = get_guests()
print(json.dumps(inv_json, sort_keys=True))
elif len(sys.argv) == 3 and sys.argv[1] == '--host':
print(json.dumps({}))
else:
print("Need an argument, either --list or --host <host>")

View File

@ -0,0 +1,33 @@
# Copyright 2013 Google Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
# Author: Josha Inglis <jinglis@iix.net> based on the gce.ini by Eric Johnson <erjohnso@google.com>
[ovirt]
# ovirt Service Account configuration information can be stored in the
# libcloud 'secrets.py' file. Ideally, the 'secrets.py' file will already
# exist in your PYTHONPATH and be picked up automatically with an import
# statement in the inventory script. However, you can specify an absolute
# path to the secrets.py file with 'libcloud_secrets' parameter.
ovirt_api_secrets =
# If you are not going to use a 'secrets.py' file, you can set the necessary
# authorization parameters here.
ovirt_url =
ovirt_username =
ovirt_password =

287
contrib/inventory/ovirt.py Executable file
View File

@ -0,0 +1,287 @@
#!/usr/bin/env python
# Copyright 2015 IIX Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
"""
ovirt external inventory script
=================================
Generates inventory that Ansible can understand by making API requests to
oVirt via the ovirt-engine-sdk-python library.
When run against a specific host, this script returns the following variables
based on the data obtained from the ovirt_sdk Node object:
- ovirt_uuid
- ovirt_id
- ovirt_image
- ovirt_machine_type
- ovirt_ips
- ovirt_name
- ovirt_description
- ovirt_status
- ovirt_zone
- ovirt_tags
- ovirt_stats
When run in --list mode, instances are grouped by the following categories:
- zone:
zone group name.
- instance tags:
An entry is created for each tag. For example, if you have two instances
with a common tag called 'foo', they will both be grouped together under
the 'tag_foo' name.
- network name:
the name of the network is appended to 'network_' (e.g. the 'default'
network will result in a group named 'network_default')
- running status:
group name prefixed with 'status_' (e.g. status_up, status_down,..)
Examples:
Execute uname on all instances in the us-central1-a zone
$ ansible -i ovirt.py us-central1-a -m shell -a "/bin/uname -a"
Use the ovirt inventory script to print out instance specific information
$ contrib/inventory/ovirt.py --host my_instance
Author: Josha Inglis <jinglis@iix.net> based on the gce.py by Eric Johnson <erjohnso@google.com>
Version: 0.0.1
"""
USER_AGENT_PRODUCT = "Ansible-ovirt_inventory_plugin"
USER_AGENT_VERSION = "v1"
import sys
import os
import argparse
import ConfigParser
from collections import defaultdict
try:
import json
except ImportError:
# noinspection PyUnresolvedReferences,PyPackageRequirements
import simplejson as json
try:
# noinspection PyUnresolvedReferences
from ovirtsdk.api import API
# noinspection PyUnresolvedReferences
from ovirtsdk.xml import params
except ImportError:
print("ovirt inventory script requires ovirt-engine-sdk-python")
sys.exit(1)
class OVirtInventory(object):
def __init__(self):
# Read settings and parse CLI arguments
self.args = self.parse_cli_args()
self.driver = self.get_ovirt_driver()
# Just display data for specific host
if self.args.host:
print(self.json_format_dict(
self.node_to_dict(self.get_instance(self.args.host)),
pretty=self.args.pretty
))
sys.exit(0)
# Otherwise, assume user wants all instances grouped
print(
self.json_format_dict(
data=self.group_instances(),
pretty=self.args.pretty
)
)
sys.exit(0)
@staticmethod
def get_ovirt_driver():
"""
Determine the ovirt authorization settings and return a ovirt_sdk driver.
:rtype : ovirtsdk.api.API
"""
kwargs = {}
ovirt_ini_default_path = os.path.join(
os.path.dirname(os.path.realpath(__file__)), "ovirt.ini")
ovirt_ini_path = os.environ.get('OVIRT_INI_PATH', ovirt_ini_default_path)
# Create a ConfigParser.
# This provides empty defaults to each key, so that environment
# variable configuration (as opposed to INI configuration) is able
# to work.
config = ConfigParser.SafeConfigParser(defaults={
'ovirt_url': '',
'ovirt_username': '',
'ovirt_password': '',
'ovirt_api_secrets': '',
})
if 'ovirt' not in config.sections():
config.add_section('ovirt')
config.read(ovirt_ini_path)
# Attempt to get ovirt params from a configuration file, if one
# exists.
secrets_path = config.get('ovirt', 'ovirt_api_secrets')
secrets_found = False
try:
# noinspection PyUnresolvedReferences,PyPackageRequirements
import secrets
kwargs = getattr(secrets, 'OVIRT_KEYWORD_PARAMS', {})
secrets_found = True
except ImportError:
pass
if not secrets_found and secrets_path:
if not secrets_path.endswith('secrets.py'):
err = "Must specify ovirt_sdk secrets file as /absolute/path/to/secrets.py"
print(err)
sys.exit(1)
sys.path.append(os.path.dirname(secrets_path))
try:
# noinspection PyUnresolvedReferences,PyPackageRequirements
import secrets
kwargs = getattr(secrets, 'OVIRT_KEYWORD_PARAMS', {})
except ImportError:
pass
if not secrets_found:
kwargs = {
'url': config.get('ovirt', 'ovirt_url'),
'username': config.get('ovirt', 'ovirt_username'),
'password': config.get('ovirt', 'ovirt_password'),
}
# If the appropriate environment variables are set, they override
# other configuration; process those into our args and kwargs.
kwargs['url'] = os.environ.get('OVIRT_URL')
kwargs['username'] = os.environ.get('OVIRT_EMAIL')
kwargs['password'] = os.environ.get('OVIRT_PASS')
# Retrieve and return the ovirt driver.
return API(insecure=True, **kwargs)
@staticmethod
def parse_cli_args():
"""
Command line argument processing
:rtype : argparse.Namespace
"""
parser = argparse.ArgumentParser(description='Produce an Ansible Inventory file based on ovirt')
parser.add_argument('--list', action='store_true', default=True, help='List instances (default: True)')
parser.add_argument('--host', action='store', help='Get all information about an instance')
parser.add_argument('--pretty', action='store_true', default=False, help='Pretty format (default: False)')
return parser.parse_args()
def node_to_dict(self, inst):
"""
:type inst: params.VM
"""
if inst is None:
return {}
inst.get_custom_properties()
ips = [ip.get_address() for ip in inst.get_guest_info().get_ips().get_ip()] \
if inst.get_guest_info() is not None else []
stats = {}
for stat in inst.get_statistics().list():
stats[stat.get_name()] = stat.get_values().get_value()[0].get_datum()
return {
'ovirt_uuid': inst.get_id(),
'ovirt_id': inst.get_id(),
'ovirt_image': inst.get_os().get_type(),
'ovirt_machine_type': inst.get_instance_type(),
'ovirt_ips': ips,
'ovirt_name': inst.get_name(),
'ovirt_description': inst.get_description(),
'ovirt_status': inst.get_status().get_state(),
'ovirt_zone': inst.get_cluster().get_id(),
'ovirt_tags': self.get_tags(inst),
'ovirt_stats': stats,
# Hosts don't have a public name, so we add an IP
'ansible_ssh_host': ips[0] if len(ips) > 0 else None
}
@staticmethod
def get_tags(inst):
"""
:type inst: params.VM
"""
return [x.get_name() for x in inst.get_tags().list()]
# noinspection PyBroadException,PyUnusedLocal
def get_instance(self, instance_name):
"""Gets details about a specific instance """
try:
return self.driver.vms.get(name=instance_name)
except Exception as e:
return None
def group_instances(self):
"""Group all instances"""
groups = defaultdict(list)
meta = {"hostvars": {}}
for node in self.driver.vms.list():
assert isinstance(node, params.VM)
name = node.get_name()
meta["hostvars"][name] = self.node_to_dict(node)
zone = node.get_cluster().get_name()
groups[zone].append(name)
tags = self.get_tags(node)
for t in tags:
tag = 'tag_%s' % t
groups[tag].append(name)
nets = [x.get_name() for x in node.get_nics().list()]
for net in nets:
net = 'network_%s' % net
groups[net].append(name)
status = node.get_status().get_state()
stat = 'status_%s' % status.lower()
if stat in groups:
groups[stat].append(name)
else:
groups[stat] = [name]
groups["_meta"] = meta
return groups
@staticmethod
def json_format_dict(data, pretty=False):
""" Converts a dict to a JSON object and dumps it as a formatted
string """
if pretty:
return json.dumps(data, sort_keys=True, indent=2)
else:
return json.dumps(data)
# Run the script
OVirtInventory()

180
contrib/inventory/proxmox.py Executable file
View File

@ -0,0 +1,180 @@
#!/usr/bin/env python
# Copyright (C) 2014 Mathieu GAUTHIER-LAFAYE <gauthierl@lapth.cnrs.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import urllib
try:
import json
except ImportError:
import simplejson as json
import os
import sys
from optparse import OptionParser
from six import iteritems
from ansible.module_utils.urls import open_url
class ProxmoxNodeList(list):
def get_names(self):
return [node['node'] for node in self]
class ProxmoxQemu(dict):
def get_variables(self):
variables = {}
for key, value in iteritems(self):
variables['proxmox_' + key] = value
return variables
class ProxmoxQemuList(list):
def __init__(self, data=[]):
for item in data:
self.append(ProxmoxQemu(item))
def get_names(self):
return [qemu['name'] for qemu in self if qemu['template'] != 1]
def get_by_name(self, name):
results = [qemu for qemu in self if qemu['name'] == name]
return results[0] if len(results) > 0 else None
def get_variables(self):
variables = {}
for qemu in self:
variables[qemu['name']] = qemu.get_variables()
return variables
class ProxmoxPoolList(list):
def get_names(self):
return [pool['poolid'] for pool in self]
class ProxmoxPool(dict):
def get_members_name(self):
return [member['name'] for member in self['members'] if member['template'] != 1]
class ProxmoxAPI(object):
def __init__(self, options):
self.options = options
self.credentials = None
if not options.url:
raise Exception('Missing mandatory parameter --url (or PROXMOX_URL).')
elif not options.username:
raise Exception('Missing mandatory parameter --username (or PROXMOX_USERNAME).')
elif not options.password:
raise Exception('Missing mandatory parameter --password (or PROXMOX_PASSWORD).')
def auth(self):
request_path = '{}api2/json/access/ticket'.format(self.options.url)
request_params = urllib.urlencode({
'username': self.options.username,
'password': self.options.password,
})
data = json.load(open_url(request_path, data=request_params))
self.credentials = {
'ticket': data['data']['ticket'],
'CSRFPreventionToken': data['data']['CSRFPreventionToken'],
}
def get(self, url, data=None):
request_path = '{}{}'.format(self.options.url, url)
headers = {'Cookie': 'PVEAuthCookie={}'.format(self.credentials['ticket'])}
request = open_url(request_path, data=data, headers=headers)
response = json.load(request)
return response['data']
def nodes(self):
return ProxmoxNodeList(self.get('api2/json/nodes'))
def node_qemu(self, node):
return ProxmoxQemuList(self.get('api2/json/nodes/{}/qemu'.format(node)))
def pools(self):
return ProxmoxPoolList(self.get('api2/json/pools'))
def pool(self, poolid):
return ProxmoxPool(self.get('api2/json/pools/{}'.format(poolid)))
def main_list(options):
results = {
'all': {
'hosts': [],
},
'_meta': {
'hostvars': {},
}
}
proxmox_api = ProxmoxAPI(options)
proxmox_api.auth()
for node in proxmox_api.nodes().get_names():
qemu_list = proxmox_api.node_qemu(node)
results['all']['hosts'] += qemu_list.get_names()
results['_meta']['hostvars'].update(qemu_list.get_variables())
# pools
for pool in proxmox_api.pools().get_names():
results[pool] = {
'hosts': proxmox_api.pool(pool).get_members_name(),
}
return results
def main_host(options):
proxmox_api = ProxmoxAPI(options)
proxmox_api.auth()
for node in proxmox_api.nodes().get_names():
qemu_list = proxmox_api.node_qemu(node)
qemu = qemu_list.get_by_name(options.host)
if qemu:
return qemu.get_variables()
return {}
def main():
parser = OptionParser(usage='%prog [options] --list | --host HOSTNAME')
parser.add_option('--list', action="store_true", default=False, dest="list")
parser.add_option('--host', dest="host")
parser.add_option('--url', default=os.environ.get('PROXMOX_URL'), dest='url')
parser.add_option('--username', default=os.environ.get('PROXMOX_USERNAME'), dest='username')
parser.add_option('--password', default=os.environ.get('PROXMOX_PASSWORD'), dest='password')
parser.add_option('--pretty', action="store_true", default=False, dest='pretty')
(options, args) = parser.parse_args()
if options.list:
data = main_list(options)
elif options.host:
data = main_host(options)
else:
parser.print_help()
sys.exit(1)
indent = None
if options.pretty:
indent = 2
print(json.dumps(data, indent=indent))
if __name__ == '__main__':
main()

44
plugins/inventory/rax.py → contrib/inventory/rax.py Normal file → Executable file
View File

@ -153,6 +153,8 @@ import warnings
import collections
import ConfigParser
from six import iteritems
from ansible.constants import get_config, mk_boolean
try:
@ -167,6 +169,9 @@ except ImportError:
print('pyrax is required for this module')
sys.exit(1)
from time import time
NON_CALLABLES = (basestring, bool, dict, int, list, type(None))
@ -214,7 +219,7 @@ def host(regions, hostname):
print(json.dumps(hostvars, sort_keys=True, indent=4))
def _list(regions):
def _list_into_cache(regions):
groups = collections.defaultdict(list)
hostvars = collections.defaultdict(dict)
images = {}
@ -242,7 +247,7 @@ def _list(regions):
if cs is None:
warnings.warn(
'Connecting to Rackspace region "%s" has caused Pyrax to '
'return a NoneType. Is this a valid region?' % region,
'return None. Is this a valid region?' % region,
RuntimeWarning)
continue
for server in cs.servers.list():
@ -264,7 +269,7 @@ def _list(regions):
hostvars[server.name]['rax_region'] = region
for key, value in server.metadata.iteritems():
for key, value in iteritems(server.metadata):
groups['%s_%s_%s' % (prefix, key, value)].append(server.name)
groups['instance-%s' % server.id].append(server.name)
@ -334,7 +339,31 @@ def _list(regions):
if hostvars:
groups['_meta'] = {'hostvars': hostvars}
print(json.dumps(groups, sort_keys=True, indent=4))
with open(get_cache_file_path(regions), 'w') as cache_file:
json.dump(groups, cache_file)
def get_cache_file_path(regions):
regions_str = '.'.join([reg.strip().lower() for reg in regions])
ansible_tmp_path = os.path.join(os.path.expanduser("~"), '.ansible', 'tmp')
if not os.path.exists(ansible_tmp_path):
os.makedirs(ansible_tmp_path)
return os.path.join(ansible_tmp_path,
'ansible-rax-%s-%s.cache' % (
pyrax.identity.username, regions_str))
def _list(regions, refresh_cache=True):
if (not os.path.exists(get_cache_file_path(regions)) or
refresh_cache or
(time() - os.stat(get_cache_file_path(regions))[-1]) > 600):
# Cache file doesn't exist or older than 10m or refresh cache requested
_list_into_cache(regions)
with open(get_cache_file_path(regions), 'r') as cache_file:
groups = json.load(cache_file)
print(json.dumps(groups, sort_keys=True, indent=4))
def parse_args():
@ -344,6 +373,9 @@ def parse_args():
group.add_argument('--list', action='store_true',
help='List active servers')
group.add_argument('--host', help='List details about the specific host')
parser.add_argument('--refresh-cache', action='store_true', default=False,
help=('Force refresh of cache, making API requests to'
'RackSpace (default: False - use cache files)'))
return parser.parse_args()
@ -382,7 +414,7 @@ def setup():
pyrax.keyring_auth(keyring_username, region=region)
else:
pyrax.set_credential_file(creds_file, region=region)
except Exception, e:
except Exception as e:
sys.stderr.write("%s: %s\n" % (e, e.message))
sys.exit(1)
@ -410,7 +442,7 @@ def main():
args = parse_args()
regions = setup()
if args.list:
_list(regions)
_list(regions, refresh_cache=args.refresh_cache)
elif args.host:
host(regions, args.host)
sys.exit(0)

View File

@ -0,0 +1,35 @@
# Rudder external inventory script settings
#
[rudder]
# Your Rudder server API URL, typically:
# https://rudder.local/rudder/api
uri = https://rudder.local/rudder/api
# By default, Rudder uses a self-signed certificate. Set this to True
# to disable certificate validation.
disable_ssl_certificate_validation = True
# Your Rudder API token, created in the Web interface.
token = aaabbbccc
# Rudder API version to use, use "latest" for lastest available
# version.
version = latest
# Property to use as group name in the output.
# Can generally be "id" or "displayName".
group_name = displayName
# Fail if there are two groups with the same name or two hosts with the
# same hostname in the output.
fail_if_name_collision = True
# We cache the results of Rudder API in a local file
cache_path = /tmp/ansible-rudder.cache
# The number of seconds a cache file is considered valid. After this many
# seconds, a new API call will be made, and the cache file will be updated.
# Set to 0 to disable cache.
cache_max_age = 500

302
contrib/inventory/rudder.py Executable file
View File

@ -0,0 +1,302 @@
#!/usr/bin/env python
# Copyright (c) 2015, Normation SAS
#
# Inspired by the EC2 inventory plugin:
# https://github.com/ansible/ansible/blob/devel/contrib/inventory/ec2.py
#
# This file is part of Ansible,
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
######################################################################
'''
Rudder external inventory script
=================================
Generates inventory that Ansible can understand by making API request to
a Rudder server. This script is compatible with Rudder 2.10 or later.
The output JSON includes all your Rudder groups, containing the hostnames of
their nodes. Groups and nodes have a variable called rudder_group_id and
rudder_node_id, which is the Rudder internal id of the item, allowing to identify
them uniquely. Hosts variables also include your node properties, which are
key => value properties set by the API and specific to each node.
This script assumes there is an rudder.ini file alongside it. To specify a
different path to rudder.ini, define the RUDDER_INI_PATH environment variable:
export RUDDER_INI_PATH=/path/to/my_rudder.ini
You have to configure your Rudder server information, either in rudder.ini or
by overriding it with environment variables:
export RUDDER_API_VERSION='latest'
export RUDDER_API_TOKEN='my_token'
export RUDDER_API_URI='https://rudder.local/rudder/api'
'''
import sys
import os
import re
import argparse
import six
import httplib2 as http
from time import time
from six.moves import configparser
try:
from urlparse import urlparse
except ImportError:
from urllib.parse import urlparse
try:
import json
except ImportError:
import simplejson as json
class RudderInventory(object):
def __init__(self):
''' Main execution path '''
# Empty inventory by default
self.inventory = {}
# Read settings and parse CLI arguments
self.read_settings()
self.parse_cli_args()
# Create connection
self.conn = http.Http(disable_ssl_certificate_validation=self.disable_ssl_validation)
# Cache
if self.args.refresh_cache:
self.update_cache()
elif not self.is_cache_valid():
self.update_cache()
else:
self.load_cache()
data_to_print = {}
if self.args.host:
data_to_print = self.get_host_info(self.args.host)
elif self.args.list:
data_to_print = self.get_list_info()
print(self.json_format_dict(data_to_print, True))
def read_settings(self):
''' Reads the settings from the rudder.ini file '''
if six.PY2:
config = configparser.SafeConfigParser()
else:
config = configparser.ConfigParser()
rudder_default_ini_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'rudder.ini')
rudder_ini_path = os.path.expanduser(os.path.expandvars(os.environ.get('RUDDER_INI_PATH', rudder_default_ini_path)))
config.read(rudder_ini_path)
self.token = os.environ.get('RUDDER_API_TOKEN', config.get('rudder', 'token'))
self.version = os.environ.get('RUDDER_API_VERSION', config.get('rudder', 'version'))
self.uri = os.environ.get('RUDDER_API_URI', config.get('rudder', 'uri'))
self.disable_ssl_validation = config.getboolean('rudder', 'disable_ssl_certificate_validation')
self.group_name = config.get('rudder', 'group_name')
self.fail_if_name_collision = config.getboolean('rudder', 'fail_if_name_collision')
self.cache_path = config.get('rudder', 'cache_path')
self.cache_max_age = config.getint('rudder', 'cache_max_age')
def parse_cli_args(self):
''' Command line argument processing '''
parser = argparse.ArgumentParser(description='Produce an Ansible Inventory file based on Rudder inventory')
parser.add_argument('--list', action='store_true', default=True,
help='List instances (default: True)')
parser.add_argument('--host', action='store',
help='Get all the variables about a specific instance')
parser.add_argument('--refresh-cache', action='store_true', default=False,
help='Force refresh of cache by making API requests to Rudder (default: False - use cache files)')
self.args = parser.parse_args()
def is_cache_valid(self):
''' Determines if the cache files have expired, or if it is still valid '''
if os.path.isfile(self.cache_path):
mod_time = os.path.getmtime(self.cache_path)
current_time = time()
if (mod_time + self.cache_max_age) > current_time:
return True
return False
def load_cache(self):
''' Reads the cache from the cache file sets self.cache '''
cache = open(self.cache_path, 'r')
json_cache = cache.read()
try:
self.inventory = json.loads(json_cache)
except ValueError as e:
self.fail_with_error('Could not parse JSON response from local cache', 'parsing local cache')
def write_cache(self):
''' Writes data in JSON format to a file '''
json_data = self.json_format_dict(self.inventory, True)
cache = open(self.cache_path, 'w')
cache.write(json_data)
cache.close()
def get_nodes(self):
''' Gets the nodes list from Rudder '''
path = '/nodes?select=nodeAndPolicyServer'
result = self.api_call(path)
nodes = {}
for node in result['data']['nodes']:
nodes[node['id']] = {}
nodes[node['id']]['hostname'] = node['hostname']
if 'properties' in node:
nodes[node['id']]['properties'] = node['properties']
else:
nodes[node['id']]['properties'] = []
return nodes
def get_groups(self):
''' Gets the groups list from Rudder '''
path = '/groups'
result = self.api_call(path)
groups = {}
for group in result['data']['groups']:
groups[group['id']] = {'hosts': group['nodeIds'], 'name': self.to_safe(group[self.group_name])}
return groups
def update_cache(self):
''' Fetches the inventory information from Rudder and creates the inventory '''
nodes = self.get_nodes()
groups = self.get_groups()
inventory = {}
for group in groups:
# Check for name collision
if self.fail_if_name_collision:
if groups[group]['name'] in inventory:
self.fail_with_error('Name collision on groups: "%s" appears twice' % groups[group]['name'], 'creating groups')
# Add group to inventory
inventory[groups[group]['name']] = {}
inventory[groups[group]['name']]['hosts'] = []
inventory[groups[group]['name']]['vars'] = {}
inventory[groups[group]['name']]['vars']['rudder_group_id'] = group
for node in groups[group]['hosts']:
# Add node to group
inventory[groups[group]['name']]['hosts'].append(nodes[node]['hostname'])
properties = {}
for node in nodes:
# Check for name collision
if self.fail_if_name_collision:
if nodes[node]['hostname'] in properties:
self.fail_with_error('Name collision on hosts: "%s" appears twice' % nodes[node]['hostname'], 'creating hosts')
# Add node properties to inventory
properties[nodes[node]['hostname']] = {}
properties[nodes[node]['hostname']]['rudder_node_id'] = node
for node_property in nodes[node]['properties']:
properties[nodes[node]['hostname']][self.to_safe(node_property['name'])] = node_property['value']
inventory['_meta'] = {}
inventory['_meta']['hostvars'] = properties
self.inventory = inventory
if self.cache_max_age > 0:
self.write_cache()
def get_list_info(self):
''' Gets inventory information from local cache '''
return self.inventory
def get_host_info(self, hostname):
''' Gets information about a specific host from local cache '''
if hostname in self.inventory['_meta']['hostvars']:
return self.inventory['_meta']['hostvars'][hostname]
else:
return {}
def api_call(self, path):
''' Performs an API request '''
headers = {
'X-API-Token': self.token,
'X-API-Version': self.version,
'Content-Type': 'application/json;charset=utf-8'
}
target = urlparse(self.uri + path)
method = 'GET'
body = ''
try:
response, content = self.conn.request(target.geturl(), method, body, headers)
except:
self.fail_with_error('Error connecting to Rudder server')
try:
data = json.loads(content)
except ValueError as e:
self.fail_with_error('Could not parse JSON response from Rudder API', 'reading API response')
return data
def fail_with_error(self, err_msg, err_operation=None):
''' Logs an error to std err for ansible-playbook to consume and exit '''
if err_operation:
err_msg = 'ERROR: "{err_msg}", while: {err_operation}'.format(
err_msg=err_msg, err_operation=err_operation)
sys.stderr.write(err_msg)
sys.exit(1)
def json_format_dict(self, data, pretty=False):
''' Converts a dict to a JSON object and dumps it as a formatted
string '''
if pretty:
return json.dumps(data, sort_keys=True, indent=2)
else:
return json.dumps(data)
def to_safe(self, word):
''' Converts 'bad' characters in a string to underscores so they can be
used as Ansible variable names '''
return re.sub('[^A-Za-z0-9\_]', '_', word)
# Run the script
RudderInventory()

115
contrib/inventory/serf.py Executable file
View File

@ -0,0 +1,115 @@
#!/usr/bin/env python
# (c) 2015, Marc Abramowitz <marca@surveymonkey.com>
#
# This file is part of Ansible.
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
# Dynamic inventory script which lets you use nodes discovered by Serf
# (https://serfdom.io/).
#
# Requires the `serfclient` Python module from
# https://pypi.python.org/pypi/serfclient
#
# Environment variables
# ---------------------
# - `SERF_RPC_ADDR`
# - `SERF_RPC_AUTH`
#
# These variables are described at https://www.serfdom.io/docs/commands/members.html#_rpc_addr
import argparse
import collections
import os
import sys
# https://pypi.python.org/pypi/serfclient
from serfclient import SerfClient, EnvironmentConfig
try:
import json
except ImportError:
import simplejson as json
_key = 'serf'
def _serf_client():
env = EnvironmentConfig()
return SerfClient(host=env.host, port=env.port, rpc_auth=env.auth_key)
def get_serf_members_data():
return _serf_client().members().body['Members']
def get_nodes(data):
return [node['Name'] for node in data]
def get_groups(data):
groups = collections.defaultdict(list)
for node in data:
for key, value in node['Tags'].items():
groups[value].append(node['Name'])
return groups
def get_meta(data):
meta = {'hostvars': {}}
for node in data:
meta['hostvars'][node['Name']] = node['Tags']
return meta
def print_list():
data = get_serf_members_data()
nodes = get_nodes(data)
groups = get_groups(data)
meta = get_meta(data)
inventory_data = {_key: nodes, '_meta': meta}
inventory_data.update(groups)
print(json.dumps(inventory_data))
def print_host(host):
data = get_serf_members_data()
meta = get_meta(data)
print(json.dumps(meta['hostvars'][host]))
def get_args(args_list):
parser = argparse.ArgumentParser(
description='ansible inventory script reading from serf cluster')
mutex_group = parser.add_mutually_exclusive_group(required=True)
help_list = 'list all hosts from serf cluster'
mutex_group.add_argument('--list', action='store_true', help=help_list)
help_host = 'display variables for a host'
mutex_group.add_argument('--host', help=help_host)
return parser.parse_args(args_list)
def main(args_list):
args = get_args(args_list)
if args.list:
print_list()
if args.host:
print_host(args.host)
if __name__ == '__main__':
main(sys.argv[1:])

View File

@ -53,10 +53,10 @@ class SoftLayerInventory(object):
if self.args.list:
self.get_all_servers()
print self.json_format_dict(self.inventory, True)
print(self.json_format_dict(self.inventory, True))
elif self.args.host:
self.get_virtual_servers(client)
print self.json_format_dict(self.inventory["_meta"]["hostvars"][self.args.host], True)
self.get_virtual_servers()
print(self.json_format_dict(self.inventory["_meta"]["hostvars"][self.args.host], True))
def to_safe(self, word):
'''Converts 'bad' characters in a string to underscores so they can be used as Ansible groups'''

View File

@ -0,0 +1,16 @@
# Put this ini-file in the same directory as spacewalk.py
# Command line options have precedence over options defined in here.
[spacewalk]
# To limit the script on one organization in spacewalk, uncomment org_number
# and fill in the organization ID:
# org_number=2
# To prefix the group names with the organization ID set prefix_org_name=true.
# This is convenient when org_number is not set and you have the same group names
# in multiple organizations within spacewalk
# The prefix is "org_number-"
prefix_org_name=false
# Default cache_age for files created with spacewalk-report is 300sec.
cache_age=300

235
contrib/inventory/spacewalk.py Executable file
View File

@ -0,0 +1,235 @@
#!/bin/env python
"""
Spacewalk external inventory script
=================================
Ansible has a feature where instead of reading from /etc/ansible/hosts
as a text file, it can query external programs to obtain the list
of hosts, groups the hosts are in, and even variables to assign to each host.
To use this, copy this file over /etc/ansible/hosts and chmod +x the file.
This, more or less, allows you to keep one central database containing
info about all of your managed instances.
This script is dependent upon the spacealk-reports package being installed
on the same machine. It is basically a CSV-to-JSON converter from the
output of "spacewalk-report system-groups-systems|inventory".
Tested with Ansible 1.9.2 and spacewalk 2.3
"""
#
# Author:: Jon Miller <jonEbird@gmail.com>
# Copyright:: Copyright (c) 2013, Jon Miller
#
# Extended for support of multiple organizations and
# adding the "_meta" dictionary to --list output by
# Bernhard Lichtinger <bernhard.lichtinger@lrz.de> 2015
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from __future__ import print_function
import sys
import os
import time
from optparse import OptionParser
import subprocess
import ConfigParser
from six import iteritems
try:
import json
except:
import simplejson as json
base_dir = os.path.dirname(os.path.realpath(__file__))
SW_REPORT = '/usr/bin/spacewalk-report'
CACHE_DIR = os.path.join(base_dir, ".spacewalk_reports")
CACHE_AGE = 300 # 5min
INI_FILE = os.path.join(base_dir, "spacewalk.ini")
# Sanity check
if not os.path.exists(SW_REPORT):
print('Error: %s is required for operation.' % (SW_REPORT), file=sys.stderr)
sys.exit(1)
# Pre-startup work
if not os.path.exists(CACHE_DIR):
os.mkdir(CACHE_DIR)
os.chmod(CACHE_DIR, 2775)
# Helper functions
#------------------------------
def spacewalk_report(name):
"""Yield a dictionary form of each CSV output produced by the specified
spacewalk-report
"""
cache_filename = os.path.join(CACHE_DIR, name)
if not os.path.exists(cache_filename) or \
(time.time() - os.stat(cache_filename).st_mtime) > CACHE_AGE:
# Update the cache
fh = open(cache_filename, 'w')
p = subprocess.Popen([SW_REPORT, name], stdout=fh)
p.wait()
fh.close()
lines = open(cache_filename, 'r').readlines()
keys = lines[0].strip().split(',')
# add 'spacewalk_' prefix to the keys
keys = [ 'spacewalk_' + key for key in keys ]
for line in lines[1:]:
values = line.strip().split(',')
if len(keys) == len(values):
yield dict(zip(keys, values))
# Options
#------------------------------
parser = OptionParser(usage="%prog [options] --list | --host <machine>")
parser.add_option('--list', default=False, dest="list", action="store_true",
help="Produce a JSON consumable grouping of servers for Ansible")
parser.add_option('--host', default=None, dest="host",
help="Generate additional host specific details for given host for Ansible")
parser.add_option('-H', '--human', dest="human",
default=False, action="store_true",
help="Produce a friendlier version of either server list or host detail")
parser.add_option('-o', '--org', default=None, dest="org_number",
help="Limit to spacewalk organization number")
parser.add_option('-p', default=False, dest="prefix_org_name", action="store_true",
help="Prefix the group name with the organization number")
(options, args) = parser.parse_args()
# read spacewalk.ini if present
#------------------------------
if os.path.exists(INI_FILE):
config = ConfigParser.SafeConfigParser()
config.read(INI_FILE)
if config.has_option('spacewalk' , 'cache_age'):
CACHE_AGE = config.get('spacewalk' , 'cache_age')
if not options.org_number and config.has_option('spacewalk' , 'org_number'):
options.org_number = config.get('spacewalk' , 'org_number')
if not options.prefix_org_name and config.has_option('spacewalk' , 'prefix_org_name'):
options.prefix_org_name = config.getboolean('spacewalk' , 'prefix_org_name')
# Generate dictionary for mapping group_id to org_id
#------------------------------
org_groups = {}
try:
for group in spacewalk_report('system-groups'):
org_groups[group['spacewalk_group_id']] = group['spacewalk_org_id']
except (OSError) as e:
print('Problem executing the command "%s system-groups": %s' %
(SW_REPORT, str(e)), file=sys.stderr)
sys.exit(2)
# List out the known server from Spacewalk
#------------------------------
if options.list:
# to build the "_meta"-Group with hostvars first create dictionary for later use
host_vars = {}
try:
for item in spacewalk_report('inventory'):
host_vars[ item['spacewalk_profile_name'] ] = dict( ( key, ( value.split(';') if ';' in value else value) ) for key, value in item.items() )
except (OSError) as e:
print('Problem executing the command "%s inventory": %s' %
(SW_REPORT, str(e)), file=sys.stderr)
sys.exit(2)
groups = {}
meta = { "hostvars" : {} }
try:
for system in spacewalk_report('system-groups-systems'):
# first get org_id of system
org_id = org_groups[ system['spacewalk_group_id'] ]
# shall we add the org_id as prefix to the group name:
if options.prefix_org_name:
prefix = org_id + "-"
group_name = prefix + system['spacewalk_group_name']
else:
group_name = system['spacewalk_group_name']
# if we are limited to one organization:
if options.org_number:
if org_id == options.org_number:
if group_name not in groups:
groups[group_name] = set()
groups[group_name].add(system['spacewalk_server_name'])
if system['spacewalk_server_name'] in host_vars and not system['spacewalk_server_name'] in meta[ "hostvars" ]:
meta[ "hostvars" ][ system['spacewalk_server_name'] ] = host_vars[ system['spacewalk_server_name'] ]
# or we list all groups and systems:
else:
if group_name not in groups:
groups[group_name] = set()
groups[group_name].add(system['spacewalk_server_name'])
if system['spacewalk_server_name'] in host_vars and not system['spacewalk_server_name'] in meta[ "hostvars" ]:
meta[ "hostvars" ][ system['spacewalk_server_name'] ] = host_vars[ system['spacewalk_server_name'] ]
except (OSError) as e:
print('Problem executing the command "%s system-groups-systems": %s' %
(SW_REPORT, str(e)), file=sys.stderr)
sys.exit(2)
if options.human:
for group, systems in iteritems(groups):
print('[%s]\n%s\n' % (group, '\n'.join(systems)))
else:
final = dict( [ (k, list(s)) for k, s in iteritems(groups) ] )
final["_meta"] = meta
print(json.dumps( final ))
#print(json.dumps(groups))
sys.exit(0)
# Return a details information concerning the spacewalk server
#------------------------------
elif options.host:
host_details = {}
try:
for system in spacewalk_report('inventory'):
if system['spacewalk_hostname'] == options.host:
host_details = system
break
except (OSError) as e:
print('Problem executing the command "%s inventory": %s' %
(SW_REPORT, str(e)), file=sys.stderr)
sys.exit(2)
if options.human:
print('Host: %s' % options.host)
for k, v in iteritems(host_details):
print(' %s: %s' % (k, '\n '.join(v.split(';'))))
else:
print( json.dumps( dict( ( key, ( value.split(';') if ';' in value else value) ) for key, value in host_details.items() ) ) )
sys.exit(0)
else:
parser.print_help()
sys.exit(1)

View File

@ -19,6 +19,10 @@
# Dynamic inventory script which lets you use aliases from ~/.ssh/config.
#
# There were some issues with various Paramiko versions. I took a deeper look
# and tested heavily. Now, ansible parses this alright with Paramiko versions
# 1.7.2 to 1.15.2.
#
# It prints inventory based on parsed ~/.ssh/config. You can refer to hosts
# with their alias, rather than with the IP or hostname. It takes advantage
# of the ansible_ssh_{host,port,user,private_key_file}.
@ -39,7 +43,6 @@
import argparse
import os.path
import sys
import paramiko
try:
@ -47,6 +50,8 @@ try:
except ImportError:
import simplejson as json
SSH_CONF = '~/.ssh/config'
_key = 'ssh_config'
_ssh_to_ansible = [('user', 'ansible_ssh_user'),
@ -56,15 +61,25 @@ _ssh_to_ansible = [('user', 'ansible_ssh_user'),
def get_config():
with open(os.path.expanduser('~/.ssh/config')) as f:
if not os.path.isfile(os.path.expanduser(SSH_CONF)):
return {}
with open(os.path.expanduser(SSH_CONF)) as f:
cfg = paramiko.SSHConfig()
cfg.parse(f)
ret_dict = {}
for d in cfg._config:
if type(d['host']) is list:
alias = d['host'][0]
else:
alias = d['host']
if ('?' in alias) or ('*' in alias):
continue
_copy = dict(d)
del _copy['host']
for host in d['host']:
ret_dict[host] = _copy['config']
if 'config' in _copy:
ret_dict[alias] = _copy['config']
else:
ret_dict[alias] = _copy
return ret_dict
@ -75,16 +90,21 @@ def print_list():
tmp_dict = {}
for ssh_opt, ans_opt in _ssh_to_ansible:
if ssh_opt in attributes:
tmp_dict[ans_opt] = attributes[ssh_opt]
# If the attribute is a list, just take the first element.
# Private key is returned in a list for some reason.
attr = attributes[ssh_opt]
if type(attr) is list:
attr = attr[0]
tmp_dict[ans_opt] = attr
if tmp_dict:
meta['hostvars'][alias] = tmp_dict
print json.dumps({_key: list(set(meta['hostvars'].keys())), '_meta': meta})
print(json.dumps({_key: list(set(meta['hostvars'].keys())), '_meta': meta}))
def print_host(host):
cfg = get_config()
print json.dumps(cfg[host])
print(json.dumps(cfg[host]))
def get_args(args_list):

View File

@ -13,6 +13,7 @@ Example Vagrant configuration using this script:
"""
# Copyright (C) 2013 Mark Mandel <mark@compoundtheory.com>
# 2015 Igor Khomyakov <homyakov@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -33,17 +34,26 @@ Example Vagrant configuration using this script:
#
import sys
import os.path
import subprocess
import re
import string
from paramiko import SSHConfig
from cStringIO import StringIO
from optparse import OptionParser
from collections import defaultdict
try:
import json
except:
import simplejson as json
_group = 'vagrant' # a default group
_ssh_to_ansible = [('user', 'ansible_ssh_user'),
('hostname', 'ansible_ssh_host'),
('identityfile', 'ansible_ssh_private_key_file'),
('port', 'ansible_ssh_port')]
# Options
#------------------------------
# ------------------------------
parser = OptionParser(usage="%prog [options] --list | --host <machine>")
parser.add_option('--list', default=False, dest="list", action="store_true",
@ -56,19 +66,13 @@ parser.add_option('--host', default=None, dest="host",
# helper functions
#
# get all the ssh configs for all boxes in an array of dictionaries.
def get_ssh_config():
configs = []
return {k: get_a_ssh_config(k) for k in list_running_boxes()}
boxes = list_running_boxes()
for box in boxes:
config = get_a_ssh_config(box)
configs.append(config)
return configs
#list all the running boxes
# list all the running boxes
def list_running_boxes():
output = subprocess.check_output(["vagrant", "status"]).split('\n')
@ -79,54 +83,47 @@ def list_running_boxes():
if matcher:
boxes.append(matcher.group(1))
return boxes
#get the ssh config for a single box
# get the ssh config for a single box
def get_a_ssh_config(box_name):
"""Gives back a map of all the machine's ssh configurations"""
output = subprocess.check_output(["vagrant", "ssh-config", box_name]).split('\n')
output = subprocess.check_output(["vagrant", "ssh-config", box_name])
config = SSHConfig()
config.parse(StringIO(output))
host_config = config.lookup(box_name)
config = {}
for line in output:
if line.strip() != '':
matcher = re.search("( )?([a-zA-Z]+) (.*)", line)
config[matcher.group(2)] = matcher.group(3)
return config
# man 5 ssh_config:
# > It is possible to have multiple identity files ...
# > all these identities will be tried in sequence.
for id in host_config['identityfile']:
if os.path.isfile(id):
host_config['identityfile'] = id
return {v: host_config[k] for k, v in _ssh_to_ansible}
# List out servers that vagrant has running
#------------------------------
# ------------------------------
if options.list:
ssh_config = get_ssh_config()
hosts = { 'vagrant': []}
meta = defaultdict(dict)
for data in ssh_config:
hosts['vagrant'].append(data['HostName'])
for host in ssh_config:
meta['hostvars'][host] = ssh_config[host]
print json.dumps(hosts)
sys.exit(1)
print(json.dumps({_group: list(ssh_config.keys()), '_meta': meta}))
sys.exit(0)
# Get out the host details
#------------------------------
# ------------------------------
elif options.host:
result = {}
ssh_config = get_ssh_config()
details = filter(lambda x: (x['HostName'] == options.host), ssh_config)
if len(details) > 0:
#pass through the port, in case it's non standard.
result = details[0]
result['ansible_ssh_port'] = result['Port']
print json.dumps(result)
sys.exit(1)
print(json.dumps(get_a_ssh_config(options.host)))
sys.exit(0)
# Print out help
#------------------------------
# ------------------------------
else:
parser.print_help()
sys.exit(1)
sys.exit(0)

View File

@ -23,6 +23,11 @@ try:
except ImportError:
import simplejson as json
class SetEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, set):
return list(obj)
return json.JSONEncoder.default(self, obj)
VBOX="VBoxManage"
@ -110,5 +115,4 @@ if __name__ == '__main__':
else:
inventory = get_hosts()
import pprint
print pprint.pprint(inventory)
sys.stdout.write(json.dumps(inventory, indent=2, cls=SetEncoder))

View File

@ -23,6 +23,10 @@ guests_only = True
# caching will be disabled.
#cache_dir = ~/.cache/ansible
# Specify a prefix filter. Any VMs with names beginning with this string will
# not be returned.
# prefix_filter = test_
[auth]
# Specify hostname or IP address of vCenter/ESXi server. A port may be

View File

@ -28,6 +28,8 @@ take precedence over options present in the INI file. An INI file is not
required if these options are specified using environment variables.
'''
from __future__ import print_function
import collections
import json
import logging
@ -37,6 +39,8 @@ import sys
import time
import ConfigParser
from six import text_type
# Disable logging message trigged by pSphere/suds.
try:
from logging import NullHandler
@ -55,7 +59,7 @@ from suds.sudsobject import Object as SudsObject
class VMwareInventory(object):
def __init__(self, guests_only=None):
self.config = ConfigParser.SafeConfigParser()
if os.environ.get('VMWARE_INI', ''):
@ -95,7 +99,7 @@ class VMwareInventory(object):
Saves the value to cache with the name given.
'''
if self.config.has_option('defaults', 'cache_dir'):
cache_dir = self.config.get('defaults', 'cache_dir')
cache_dir = os.path.expanduser(self.config.get('defaults', 'cache_dir'))
if not os.path.exists(cache_dir):
os.makedirs(cache_dir)
cache_file = os.path.join(cache_dir, name)
@ -115,7 +119,7 @@ class VMwareInventory(object):
else:
cache_max_age = 0
cache_stat = os.stat(cache_file)
if (cache_stat.st_mtime + cache_max_age) < time.time():
if (cache_stat.st_mtime + cache_max_age) >= time.time():
with open(cache_file) as cache:
return json.load(cache)
return default
@ -147,7 +151,7 @@ class VMwareInventory(object):
seen = seen or set()
if isinstance(obj, ManagedObject):
try:
obj_unicode = unicode(getattr(obj, 'name'))
obj_unicode = text_type(getattr(obj, 'name'))
except AttributeError:
obj_unicode = ()
if obj in seen:
@ -164,7 +168,7 @@ class VMwareInventory(object):
obj_info = self._get_obj_info(val, depth - 1, seen)
if obj_info != ():
d[attr] = obj_info
except Exception, e:
except Exception as e:
pass
return d
elif isinstance(obj, SudsObject):
@ -207,8 +211,8 @@ class VMwareInventory(object):
host_info[k] = v
try:
host_info['ipAddress'] = host.config.network.vnic[0].spec.ip.ipAddress
except Exception, e:
print >> sys.stderr, e
except Exception as e:
print(e, file=sys.stderr)
host_info = self._flatten_dict(host_info, prefix)
if ('%s_ipAddress' % prefix) in host_info:
host_info['ansible_ssh_host'] = host_info['%s_ipAddress' % prefix]
@ -305,6 +309,11 @@ class VMwareInventory(object):
else:
vm_group = default_group + '_vm'
if self.config.has_option('defaults', 'prefix_filter'):
prefix_filter = self.config.get('defaults', 'prefix_filter')
else:
prefix_filter = None
# Loop through physical hosts:
for host in HostSystem.all(self.client):
@ -318,6 +327,9 @@ class VMwareInventory(object):
# Loop through all VMs on physical host.
for vm in host.vm:
if prefix_filter:
if vm.name.startswith( prefix_filter ):
continue
self._add_host(inv, 'all', vm.name)
self._add_host(inv, vm_group, vm.name)
vm_info = self._get_vm_info(vm)

View File

@ -13,8 +13,9 @@
# API calls to Windows Azure may be slow. For this reason, we cache the results
# of an API call. Set this to the path you want cache files to be written to.
# One file will be written to this directory:
# Two files will be written to this directory:
# - ansible-azure.cache
# - ansible-azure.index
#
cache_path = /tmp

View File

@ -51,7 +51,7 @@ try:
from azure import WindowsAzureError
from azure.servicemanagement import ServiceManagementService
except ImportError as e:
print "failed=True msg='`azure` library required for this script'"
print("failed=True msg='`azure` library required for this script'")
sys.exit(1)
@ -65,6 +65,14 @@ class AzureInventory(object):
self.inventory = {}
# Index of deployment name -> host
self.index = {}
self.host_metadata = {}
# Cache setting defaults.
# These can be overridden in settings (see `read_settings`).
cache_dir = os.path.expanduser('~')
self.cache_path_cache = os.path.join(cache_dir, '.ansible-azure.cache')
self.cache_path_index = os.path.join(cache_dir, '.ansible-azure.index')
self.cache_max_age = 0
# Read settings and parse CLI arguments
self.read_settings()
@ -82,14 +90,36 @@ class AzureInventory(object):
if self.args.list_images:
data_to_print = self.json_format_dict(self.get_images(), True)
elif self.args.list:
elif self.args.list or self.args.host:
# Display list of nodes for inventory
if len(self.inventory) == 0:
data_to_print = self.get_inventory_from_cache()
data = json.loads(self.get_inventory_from_cache())
else:
data_to_print = self.json_format_dict(self.inventory, True)
data = self.inventory
print data_to_print
if self.args.host:
data_to_print = self.get_host(self.args.host)
else:
# Add the `['_meta']['hostvars']` information.
hostvars = {}
if len(data) > 0:
for host in set([h for hosts in data.values() for h in hosts if h]):
hostvars[host] = self.get_host(host, jsonify=False)
data['_meta'] = {'hostvars': hostvars}
# JSONify the data.
data_to_print = self.json_format_dict(data, pretty=True)
print(data_to_print)
def get_host(self, hostname, jsonify=True):
"""Return information about the given hostname, based on what
the Windows Azure API provides.
"""
if hostname not in self.host_metadata:
return "No host found: %s" % json.dumps(self.host_metadata)
if jsonify:
return json.dumps(self.host_metadata[hostname])
return self.host_metadata[hostname]
def get_images(self):
images = []
@ -121,28 +151,36 @@ class AzureInventory(object):
# Cache related
if config.has_option('azure', 'cache_path'):
cache_path = config.get('azure', 'cache_path')
self.cache_path_cache = cache_path + "/ansible-azure.cache"
self.cache_path_index = cache_path + "/ansible-azure.index"
cache_path = os.path.expandvars(os.path.expanduser(config.get('azure', 'cache_path')))
self.cache_path_cache = os.path.join(cache_path, 'ansible-azure.cache')
self.cache_path_index = os.path.join(cache_path, 'ansible-azure.index')
if config.has_option('azure', 'cache_max_age'):
self.cache_max_age = config.getint('azure', 'cache_max_age')
def read_environment(self):
''' Reads the settings from environment variables '''
# Credentials
if os.getenv("AZURE_SUBSCRIPTION_ID"): self.subscription_id = os.getenv("AZURE_SUBSCRIPTION_ID")
if os.getenv("AZURE_CERT_PATH"): self.cert_path = os.getenv("AZURE_CERT_PATH")
if os.getenv("AZURE_SUBSCRIPTION_ID"):
self.subscription_id = os.getenv("AZURE_SUBSCRIPTION_ID")
if os.getenv("AZURE_CERT_PATH"):
self.cert_path = os.getenv("AZURE_CERT_PATH")
def parse_cli_args(self):
"""Command line argument processing"""
parser = argparse.ArgumentParser(description='Produce an Ansible Inventory file based on Azure')
parser = argparse.ArgumentParser(
description='Produce an Ansible Inventory file based on Azure',
)
parser.add_argument('--list', action='store_true', default=True,
help='List nodes (default: True)')
help='List nodes (default: True)')
parser.add_argument('--list-images', action='store',
help='Get all available images.')
parser.add_argument('--refresh-cache', action='store_true', default=False,
help='Force refresh of cache by making API requests to Azure (default: False - use cache files)')
help='Get all available images.')
parser.add_argument('--refresh-cache',
action='store_true', default=False,
help='Force refresh of thecache by making API requests to Azure '
'(default: False - use cache files)',
)
parser.add_argument('--host', action='store',
help='Get all information about an instance.')
self.args = parser.parse_args()
def do_api_calls_update_cache(self):
@ -157,39 +195,63 @@ class AzureInventory(object):
for cloud_service in self.sms.list_hosted_services():
self.add_deployments(cloud_service)
except WindowsAzureError as e:
print "Looks like Azure's API is down:"
print
print e
print("Looks like Azure's API is down:")
print("")
print(e)
sys.exit(1)
def add_deployments(self, cloud_service):
"""Makes an Azure API call to get the list of virtual machines associated with a cloud service"""
"""Makes an Azure API call to get the list of virtual machines
associated with a cloud service.
"""
try:
for deployment in self.sms.get_hosted_service_properties(cloud_service.service_name,embed_detail=True).deployments.deployments:
if deployment.deployment_slot == "Production":
self.add_deployment(cloud_service, deployment)
self.add_deployment(cloud_service, deployment)
except WindowsAzureError as e:
print "Looks like Azure's API is down:"
print
print e
print("Looks like Azure's API is down:")
print("")
print(e)
sys.exit(1)
def add_deployment(self, cloud_service, deployment):
"""Adds a deployment to the inventory and index"""
for role in deployment.role_instance_list.role_instances:
try:
# Default port 22 unless port found with name 'SSH'
port = '22'
for ie in role.instance_endpoints.instance_endpoints:
if ie.name == 'SSH':
port = ie.public_port
break
except AttributeError as e:
pass
finally:
self.add_instance(role.instance_name, deployment, port, cloud_service, role.instance_status)
def add_instance(self, hostname, deployment, ssh_port, cloud_service, status):
"""Adds an instance to the inventory and index"""
dest = urlparse(deployment.url).hostname
# Add to index
self.index[dest] = deployment.name
self.index[hostname] = deployment.name
self.host_metadata[hostname] = dict(ansible_ssh_host=dest,
ansible_ssh_port=int(ssh_port),
instance_status=status,
private_id=deployment.private_id)
# List of all azure deployments
self.push(self.inventory, "azure", dest)
self.push(self.inventory, "azure", hostname)
# Inventory: Group by service name
self.push(self.inventory, self.to_safe(cloud_service.service_name), dest)
self.push(self.inventory, self.to_safe(cloud_service.service_name), hostname)
if int(ssh_port) == 22:
self.push(self.inventory, "Cloud_services", hostname)
# Inventory: Group by region
self.push(self.inventory, self.to_safe(cloud_service.hosted_service_properties.location), dest)
self.push(self.inventory, self.to_safe(cloud_service.hosted_service_properties.location), hostname)
def push(self, my_dict, key, element):
"""Pushed an element onto an array that may not have been defined in the dict."""

View File

@ -30,6 +30,8 @@ Configuration is read from `zabbix.ini`.
Tested with Zabbix Server 2.0.6.
"""
from __future__ import print_function
import os, sys
import argparse
import ConfigParser
@ -37,7 +39,8 @@ import ConfigParser
try:
from zabbix_api import ZabbixAPI
except:
print >> sys.stderr, "Error: Zabbix API library must be installed: pip install zabbix-api."
print("Error: Zabbix API library must be installed: pip install zabbix-api.",
file=sys.stderr)
sys.exit(1)
try:
@ -49,7 +52,11 @@ class ZabbixInventory(object):
def read_settings(self):
config = ConfigParser.SafeConfigParser()
config.read(os.path.dirname(os.path.realpath(__file__)) + '/zabbix.ini')
conf_path = './zabbix.ini'
if not os.path.exists(conf_path):
conf_path = os.path.dirname(os.path.realpath(__file__)) + '/zabbix.ini'
if os.path.exists(conf_path):
config.read(conf_path)
# server
if config.has_option('zabbix', 'server'):
self.zabbix_server = config.get('zabbix', 'server')
@ -109,24 +116,24 @@ class ZabbixInventory(object):
try:
api = ZabbixAPI(server=self.zabbix_server)
api.login(user=self.zabbix_username, password=self.zabbix_password)
except BaseException, e:
print >> sys.stderr, "Error: Could not login to Zabbix server. Check your zabbix.ini."
except BaseException as e:
print("Error: Could not login to Zabbix server. Check your zabbix.ini.", file=sys.stderr)
sys.exit(1)
if self.options.host:
data = self.get_host(api, self.options.host)
print json.dumps(data, indent=2)
print(json.dumps(data, indent=2))
elif self.options.list:
data = self.get_list(api)
print json.dumps(data, indent=2)
print(json.dumps(data, indent=2))
else:
print >> sys.stderr, "usage: --list ..OR.. --host <hostname>"
print("usage: --list ..OR.. --host <hostname>", file=sys.stderr)
sys.exit(1)
else:
print >> sys.stderr, "Error: Configuration of server and credentials are required. See zabbix.ini."
print("Error: Configuration of server and credentials are required. See zabbix.ini.", file=sys.stderr)
sys.exit(1)
ZabbixInventory()

View File

@ -36,8 +36,8 @@ result['all']['vars'] = {}
result['all']['vars']['ansible_connection'] = 'zone'
if len(sys.argv) == 2 and sys.argv[1] == '--list':
print json.dumps(result)
print(json.dumps(result))
elif len(sys.argv) == 3 and sys.argv[1] == '--host':
print json.dumps({'ansible_connection': 'zone'})
print(json.dumps({'ansible_connection': 'zone'}))
else:
print "Need an argument, either --list or --host <host>"
print("Need an argument, either --list or --host <host>")

View File

@ -1,72 +0,0 @@
'\" t
.\" Title: ansible-doc
.\" Author: :doctype:manpage
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: 03/10/2015
.\" Manual: System administration commands
.\" Source: Ansible 1.9.0
.\" Language: English
.\"
.TH "ANSIBLE\-DOC" "1" "03/10/2015" "Ansible 1\&.9\&.0" "System administration commands"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
ansible-doc \- show documentation on Ansible modules
.SH "SYNOPSIS"
.sp
ansible\-doc [\-M module_path] [\-l] [\-s] [module\&...]
.SH "DESCRIPTION"
.sp
\fBansible\-doc\fR displays information on modules installed in Ansible libraries\&. It displays a terse listing of modules and their short descriptions, provides a printout of their DOCUMENTATION strings, and it can create a short "snippet" which can be pasted into a playbook\&.
.SH "OPTIONS"
.PP
\fB\-M\fR \fIdirectory\fR, \fB\-\-module\-path=\fR\fIdirectory\fR
.RS 4
Add an additional directory to the default path for finding module libraries\&.
.RE
.PP
\fB\-s\fR, \fB\-\-snippet=\fR
.RS 4
Produce a snippet which can be copied into a playbook for modification, like a kind of task template\&.
.RE
.PP
\fB\-l\fR, \fB\-\-list=\fR
.RS 4
Produce a terse listing of modules and a short description of each\&.
.RE
.SH "AUTHOR"
.sp
ansible\-doc was originally written by Jan\-Piet Mens\&. See the AUTHORS file for a complete list of contributors\&.
.SH "COPYRIGHT"
.sp
Copyright \(co 2012, Jan\-Piet Mens
.sp
Ansible is released under the terms of the GPLv3 License\&.
.SH "SEE ALSO"
.sp
\fBansible\-playbook\fR(1), \fBansible\fR(1), \fBansible\-pull\fR(1)
.sp
Extensive documentation is available in the documentation site: http://docs\&.ansible\&.com\&. IRC and mailing list info can be found in file CONTRIBUTING\&.md, available in: https://github\&.com/ansible/ansible
.SH "AUTHOR"
.PP
\fB:doctype:manpage\fR
.RS 4
Author.
.RE

View File

@ -28,9 +28,11 @@ playbook.
OPTIONS
-------
*-M* 'directory', *--module-path=*'directory'::
*-M* 'DIRECTORY', *--module-path=*'DIRECTORY'::
Add an additional directory to the default path for finding module libraries.
the 'DIRECTORY' search path to load modules from. The default is
'/usr/share/ansible'. This can also be set with the ANSIBLE_LIBRARY
environment variable.
*-s*, *--snippet=*::
@ -41,6 +43,24 @@ a kind of task template.
Produce a terse listing of modules and a short description of each.
ENVIRONMENT
-----------
ANSIBLE_LIBRARY -- Override the default ansible module library path
FILES
-----
/usr/share/ansible/ -- Default module library
/etc/ansible/ansible.cfg -- Config file, used if present
~/.ansible.cfg -- User config file, overrides the default config if present
AUTHOR
------
@ -59,7 +79,7 @@ Ansible is released under the terms of the GPLv3 License.
SEE ALSO
--------
*ansible-playbook*(1), *ansible*(1), *ansible-pull*(1)
*ansible-playbook*(1), *ansible*(1), *ansible-pull*(1), *ansible-vault*(1), *ansible-galaxy*(1)
Extensive documentation is available in the documentation site:
<http://docs.ansible.com>. IRC and mailing list info can be found

View File

@ -1,185 +0,0 @@
'\" t
.\" Title: ansible-galaxy
.\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: 03/10/2015
.\" Manual: System administration commands
.\" Source: Ansible 1.9.0
.\" Language: English
.\"
.TH "ANSIBLE\-GALAXY" "1" "03/10/2015" "Ansible 1\&.9\&.0" "System administration commands"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
ansible-galaxy \- manage roles using galaxy\&.ansible\&.com
.SH "SYNOPSIS"
.sp
ansible\-galaxy [init|info|install|list|remove] [\-\-help] [options] \&...
.SH "DESCRIPTION"
.sp
\fBAnsible Galaxy\fR is a shared repository for Ansible roles (added in ansible version 1\&.2)\&. The ansible\-galaxy command can be used to manage these roles, or by creating a skeleton framework for roles you\(cqd like to upload to Galaxy\&.
.SH "COMMON OPTIONS"
.PP
\fB\-h\fR, \fB\-\-help\fR
.RS 4
Show a help message related to the given sub\-command\&.
.RE
.SH "INSTALL"
.sp
The \fBinstall\fR sub\-command is used to install roles\&.
.SS "USAGE"
.sp
$ ansible\-galaxy install [options] [\-r FILE | role_name(s)[,version] | tar_file(s)]
.sp
Roles can be installed in several different ways:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
A username\&.rolename[,version] \- this will install a single role\&. The Galaxy API will be contacted to provide the information about the role, and the corresponding \&.tar\&.gz will be downloaded from
\fBgithub\&.com\fR\&. If the version is omitted, the most recent version available will be installed\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
A file name, using
\fB\-r\fR
\- this will install multiple roles listed one per line\&. The format of each line is the same as above: username\&.rolename[,version]
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
A \&.tar\&.gz of a valid role you\(cqve downloaded directly from
\fBgithub\&.com\fR\&. This is mainly useful when the system running Ansible does not have access to the Galaxy API, for instance when behind a firewall or proxy\&.
.RE
.SS "OPTIONS"
.PP
\fB\-f\fR, \fB\-\-force\fR
.RS 4
Force overwriting an existing role\&.
.RE
.PP
\fB\-i\fR, \fB\-\-ignore\-errors\fR
.RS 4
Ignore errors and continue with the next specified role\&.
.RE
.PP
\fB\-n\fR, \fB\-\-no\-deps\fR
.RS 4
Don\(cqt download roles listed as dependencies\&.
.RE
.PP
\fB\-p\fR \fIROLES_PATH\fR, \fB\-\-roles\-path=\fR\fIROLES_PATH\fR
.RS 4
The path to the directory containing your roles\&. The default is the
\fBroles_path\fR
configured in your
\fBansible\&.cfg\fR
file (/etc/ansible/roles if not configured)
.RE
.PP
\fB\-r\fR \fIROLE_FILE\fR, \fB\-\-role\-file=\fR\fIROLE_FILE\fR
.RS 4
A file containing a list of roles to be imported, as specified above\&. This option cannot be used if a rolename or \&.tar\&.gz have been specified\&.
.RE
.SH "REMOVE"
.sp
The \fBremove\fR sub\-command is used to remove one or more roles\&.
.SS "USAGE"
.sp
$ ansible\-galaxy remove role1 role2 \&...
.SS "OPTIONS"
.PP
\fB\-p\fR \fIROLES_PATH\fR, \fB\-\-roles\-path=\fR\fIROLES_PATH\fR
.RS 4
The path to the directory containing your roles\&. The default is the
\fBroles_path\fR
configured in your
\fBansible\&.cfg\fR
file (/etc/ansible/roles if not configured)
.RE
.SH "INIT"
.sp
The \fBinit\fR command is used to create an empty role suitable for uploading to https://galaxy\&.ansible\&.com (or for roles in general)\&.
.SS "USAGE"
.sp
$ ansible\-galaxy init [options] role_name
.SS "OPTIONS"
.PP
\fB\-f\fR, \fB\-\-force\fR
.RS 4
Force overwriting an existing role\&.
.RE
.PP
\fB\-p\fR \fIINIT_PATH\fR, \fB\-\-init\-path=\fR\fIINIT_PATH\fR
.RS 4
The path in which the skeleton role will be created\&.The default is the current working directory\&.
.RE
.PP
\fB\-\-offline\fR
.RS 4
Don\(cqt query the galaxy API when creating roles
.RE
.SH "LIST"
.sp
The \fBlist\fR sub\-command is used to show what roles are currently instaled\&. You can specify a role name, and if installed only that role will be shown\&.
.SS "USAGE"
.sp
$ ansible\-galaxy list [role_name]
.SS "OPTIONS"
.PP
\fB\-p\fR \fIROLES_PATH\fR, \fB\-\-roles\-path=\fR\fIROLES_PATH\fR
.RS 4
The path to the directory containing your roles\&. The default is the
\fBroles_path\fR
configured in your
\fBansible\&.cfg\fR
file (/etc/ansible/roles if not configured)
.RE
.SH "AUTHOR"
.sp
Ansible was originally written by Michael DeHaan\&. See the AUTHORS file for a complete list of contributors\&.
.SH "COPYRIGHT"
.sp
Copyright \(co 2014, Michael DeHaan
.sp
Ansible is released under the terms of the GPLv3 License\&.
.SH "SEE ALSO"
.sp
\fBansible\fR(1), \fBansible\-pull\fR(1), \fBansible\-doc\fR(1)
.sp
Extensive documentation is available in the documentation site: http://docs\&.ansible\&.com\&. IRC and mailing list info can be found in file CONTRIBUTING\&.md, available in: https://github\&.com/ansible/ansible

View File

@ -12,16 +12,15 @@ ansible-galaxy - manage roles using galaxy.ansible.com
SYNOPSIS
--------
ansible-galaxy [init|info|install|list|remove] [--help] [options] ...
ansible-galaxy [delete|import|info|init|install|list|login|remove|search|setup] [--help] [options] ...
DESCRIPTION
-----------
*Ansible Galaxy* is a shared repository for Ansible roles (added in
ansible version 1.2). The ansible-galaxy command can be used to manage
these roles, or by creating a skeleton framework for roles you'd like
to upload to Galaxy.
*Ansible Galaxy* is a shared repository for Ansible roles.
The ansible-galaxy command can be used to manage these roles,
or for creating a skeleton framework for roles you'd like to upload to Galaxy.
COMMON OPTIONS
--------------
@ -30,7 +29,6 @@ COMMON OPTIONS
Show a help message related to the given sub-command.
INSTALL
-------
@ -43,16 +41,16 @@ $ ansible-galaxy install [options] [-r FILE | role_name(s)[,version] | tar_file(
Roles can be installed in several different ways:
* A username.rolename[,version] - this will install a single role. The Galaxy
API will be contacted to provide the information about the role, and the
corresponding .tar.gz will be downloaded from *github.com*. If the version
* A username.rolename[,version] - this will install a single role. The Galaxy
API will be contacted to provide the information about the role, and the
corresponding .tar.gz will be downloaded from *github.com*. If the version
is omitted, the most recent version available will be installed.
* A file name, using *-r* - this will install multiple roles listed one per
line. The format of each line is the same as above: username.rolename[,version]
* A .tar.gz of a valid role you've downloaded directly from *github.com*. This
is mainly useful when the system running Ansible does not have access to
is mainly useful when the system running Ansible does not have access to
the Galaxy API, for instance when behind a firewall or proxy.
@ -146,6 +144,204 @@ The path to the directory containing your roles. The default is the *roles_path*
configured in your *ansible.cfg* file (/etc/ansible/roles if not configured)
SEARCH
------
The *search* sub-command returns a filtered list of roles found on the remote
server.
USAGE
~~~~~
$ ansible-galaxy search [options] [searchterm1 searchterm2]
OPTIONS
~~~~~~~
*--galaxy-tags*::
Provide a comma separated list of Galaxy Tags on which to filter.
*--platforms*::
Provide a comma separated list of Platforms on which to filter.
*--author*::
Specify the username of a Galaxy contributor on which to filter.
*-c*, *--ignore-certs*::
Ignore TLS certificate errors.
*-s*, *--server*::
Override the default server https://galaxy.ansible.com.
INFO
----
The *info* sub-command shows detailed information for a specific role.
Details returned about the role included information from the local copy
as well as information from galaxy.ansible.com.
USAGE
~~~~~
$ ansible-galaxy info [options] role_name[, version]
OPTIONS
~~~~~~~
*-p* 'ROLES_PATH', *--roles-path=*'ROLES_PATH'::
The path to the directory containing your roles. The default is the *roles_path*
configured in your *ansible.cfg* file (/etc/ansible/roles if not configured)
*-c*, *--ignore-certs*::
Ignore TLS certificate errors.
*-s*, *--server*::
Override the default server https://galaxy.ansible.com.
LOGIN
-----
The *login* sub-command is used to authenticate with galaxy.ansible.com.
Authentication is required to use the import, delete and setup commands.
It will authenticate the user, retrieve a token from Galaxy, and store it
in the user's home directory.
USAGE
~~~~~
$ ansible-galaxy login [options]
The *login* sub-command prompts for a *GitHub* username and password. It does
NOT send your password to Galaxy. It actually authenticates with GitHub and
creates a personal access token. It then sends the personal access token to
Galaxy, which in turn verifies that you are you and returns a Galaxy access
token. After authentication completes the *GitHub* personal access token is
destroyed.
If you do not wish to use your GitHub password, or if you have two-factor
authentication enabled with GitHub, use the *--github-token* option to pass a
personal access token that you create. Log into GitHub, go to Settings and
click on Personal Access Token to create a token.
OPTIONS
~~~~~~~
*-c*, *--ignore-certs*::
Ignore TLS certificate errors.
*-s*, *--server*::
Override the default server https://galaxy.ansible.com.
*--github-token*::
Authenticate using a *GitHub* personal access token rather than a password.
IMPORT
------
Import a role from *GitHub* to galaxy.ansible.com. Requires the user first
authenticate with galaxy.ansible.com using the *login* subcommand.
USAGE
~~~~~
$ ansible-galaxy import [options] github_user github_repo
OPTIONS
~~~~~~~
*-c*, *--ignore-certs*::
Ignore TLS certificate errors.
*-s*, *--server*::
Override the default server https://galaxy.ansible.com.
*--branch*::
Provide a specific branch to import. When a branch is not specified the
branch found in meta/main.yml is used. If no branch is specified in
meta/main.yml, the repo's default branch (usually master) is used.
DELETE
------
The *delete* sub-command will delete a role from galaxy.ansible.com. Requires
the user first authenticate with galaxy.ansible.com using the *login* subcommand.
USAGE
~~~~~
$ ansible-galaxy delete [options] github_user github_repo
OPTIONS
~~~~~~~
*-c*, *--ignore-certs*::
Ignore TLS certificate errors.
*-s*, *--server*::
Override the default server https://galaxy.ansible.com.
SETUP
-----
The *setup* sub-command creates an integration point for *Travis CI*, enabling
galaxy.ansible.com to receive notifications from *Travis* on build completion.
Requires the user first authenticate with galaxy.ansible.com using the *login*
subcommand.
USAGE
~~~~~
$ ansible-galaxy setup [options] source github_user github_repo secret
* Use *travis* as the source value. In the future additional source values may
be added.
* Provide your *Travis* user token as the secret. The token is not stored by
galaxy.ansible.com. A hash is created using github_user, github_repo
and your token. The hash value is what actually gets stored.
OPTIONS
~~~~~~~
*-c*, *--ignore-certs*::
Ignore TLS certificate errors.
*-s*, *--server*::
Override the default server https://galaxy.ansible.com.
--list::
Show your configured integrations. Provids the ID of each integration
which can be used with the remove option.
--remove::
Remove a specific integration. Provide the ID of the integration to
be removed.
AUTHOR
------
@ -164,7 +360,7 @@ Ansible is released under the terms of the GPLv3 License.
SEE ALSO
--------
*ansible*(1), *ansible-pull*(1), *ansible-doc*(1)
*ansible*(1), *ansible-pull*(1), *ansible-doc*(1), *ansible-playbook*(1), *ansible-vault*(1)
Extensive documentation is available in the documentation site:
<http://docs.ansible.com>. IRC and mailing list info can be found

View File

@ -1,189 +0,0 @@
'\" t
.\" Title: ansible-playbook
.\" Author: :doctype:manpage
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: 03/10/2015
.\" Manual: System administration commands
.\" Source: Ansible 1.9.0
.\" Language: English
.\"
.TH "ANSIBLE\-PLAYBOOK" "1" "03/10/2015" "Ansible 1\&.9\&.0" "System administration commands"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
ansible-playbook \- run an ansible playbook
.SH "SYNOPSIS"
.sp
ansible\-playbook <filename\&.yml> \&... [options]
.SH "DESCRIPTION"
.sp
\fBAnsible playbooks\fR are a configuration and multinode deployment system\&. Ansible\-playbook is the tool used to run them\&. See the project home page (link below) for more information\&.
.SH "ARGUMENTS"
.PP
\fBfilename\&.yml\fR
.RS 4
The names of one or more YAML format files to run as ansible playbooks\&.
.RE
.SH "OPTIONS"
.PP
\fB\-v\fR, \fB\-\-verbose\fR
.RS 4
Verbose mode, more output from successful actions will be shown\&. Give up to three times for more output\&.
.RE
.PP
\fB\-i\fR \fIPATH\fR, \fB\-\-inventory=\fR\fIPATH\fR
.RS 4
The
\fIPATH\fR
to the inventory hosts file, which defaults to
\fI/etc/ansible/hosts\fR\&.
.RE
.PP
\fB\-M\fR \fIDIRECTORY\fR, \fB\-\-module\-path=\fR\fIDIRECTORY\fR
.RS 4
The
\fIDIRECTORY\fR
search path to load modules from\&. The default is
\fI/usr/share/ansible\fR\&. This can also be set with the ANSIBLE_LIBRARY environment variable\&.
.RE
.PP
\fB\-e\fR \fIVARS\fR, \fB\-\-extra\-vars=\fR\fIVARS\fR
.RS 4
Extra variables to inject into a playbook, in key=value key=value format or as quoted JSON (hashes and arrays)\&. To load variables from a file, specify the file preceded by @ (e\&.g\&. @vars\&.yml)\&.
.RE
.PP
\fB\-f\fR \fINUM\fR, \fB\-\-forks=\fR\fINUM\fR
.RS 4
Level of parallelism\&.
\fINUM\fR
is specified as an integer, the default is 5\&.
.RE
.PP
\fB\-k\fR, \fB\-\-ask\-pass\fR
.RS 4
Prompt for the SSH password instead of assuming key\-based authentication with ssh\-agent\&.
.RE
.PP
\fB\-K\fR, \fB\-\-ask\-sudo\-pass\fR
.RS 4
Prompt for the password to use for playbook plays that request sudo access, if any\&.
.RE
.PP
\fB\-U\fR, \fISUDO_USER\fR, \fB\-\-sudo\-user=\fR\fISUDO_USER\fR
.RS 4
Desired sudo user (default=root)\&.
.RE
.PP
\fB\-t\fR, \fITAGS\fR, \fB\-\-tags=\fR\fITAGS\fR
.RS 4
Only run plays and tasks tagged with these values\&.
.RE
.PP
\fB\-\-skip\-tags=\fR\fISKIP_TAGS\fR
.RS 4
Only run plays and tasks whose tags do not match these values\&.
.RE
.PP
\fB\-\-syntax\-check\fR
.RS 4
Look for syntax errors in the playbook, but don\(cqt run anything
.RE
.PP
\fB\-\-check\fR
.RS 4
Do not make any changes on the remote system, but test resources to see what might have changed\&. Note this can not scan all possible resource types and is only a simulation\&.
.RE
.PP
\fB\-\-diff\fR
.RS 4
When changing any templated files, show the unified diffs of how they changed\&. When used with \-\-check, shows how the files would have changed if \-\-check were not used\&.
.RE
.PP
\fB\-T\fR \fISECONDS\fR, \fB\-\-timeout=\fR\fISECONDS\fR
.RS 4
Connection timeout to use when trying to talk to hosts, in
\fISECONDS\fR\&.
.RE
.PP
\fB\-s\fR, \fB\-\-sudo\fR
.RS 4
Force all plays to use sudo, even if not marked as such\&.
.RE
.PP
\fB\-u\fR \fIUSERNAME\fR, \fB\-\-user=\fR\fIUSERNAME\fR
.RS 4
Use this remote user name on playbook steps that do not indicate a user name to run as\&.
.RE
.PP
\fB\-c\fR \fICONNECTION\fR, \fB\-\-connection=\fR\fICONNECTION\fR
.RS 4
Connection type to use\&. Possible options are
\fIparamiko\fR
(SSH),
\fIssh\fR, and
\fIlocal\fR\&.
\fIlocal\fR
is mostly useful for crontab or kickstarts\&.
.RE
.PP
\fB\-l\fR \fISUBSET\fR, \fB\-\-limit=\fR\fISUBSET\fR
.RS 4
Further limits the selected host/group patterns\&.
.RE
.PP
\fB\-\-list\-hosts\fR
.RS 4
Outputs a list of matching hosts; does not execute anything else\&.
.RE
.SH "ENVIRONMENT"
.sp
The following environment variables may be specified\&.
.sp
ANSIBLE_HOSTS \(em Override the default ansible hosts file
.sp
ANSIBLE_LIBRARY \(em Override the default ansible module library path
.SH "FILES"
.sp
/etc/ansible/hosts \(em Default inventory file
.sp
/usr/share/ansible/ \(em Default module library
.sp
/etc/ansible/ansible\&.cfg \(em Config file, used if present
.sp
~/\&.ansible\&.cfg \(em User config file, overrides the default config if present
.SH "AUTHOR"
.sp
Ansible was originally written by Michael DeHaan\&. See the AUTHORS file for a complete list of contributors\&.
.SH "COPYRIGHT"
.sp
Copyright \(co 2012, Michael DeHaan
.sp
Ansible is released under the terms of the GPLv3 License\&.
.SH "SEE ALSO"
.sp
\fBansible\fR(1), \fBansible\-pull\fR(1), \fBansible\-doc\fR(1)
.sp
Extensive documentation is available in the documentation site: http://docs\&.ansible\&.com\&. IRC and mailing list info can be found in file CONTRIBUTING\&.md, available in: https://github\&.com/ansible/ansible
.SH "AUTHOR"
.PP
\fB:doctype:manpage\fR
.RS 4
Author.
.RE

View File

@ -34,16 +34,86 @@ The names of one or more YAML format files to run as ansible playbooks.
OPTIONS
-------
*-v*, *--verbose*::
*--ask-become-pass*::
Verbose mode, more output from successful actions will be shown. Give
up to three times for more output.
Ask for privilege escalation password.
*-k*, *--ask-pass*::
Prompt for the connection password, if it is needed for the transport used.
For example, using ssh and not having a key-based authentication with ssh-agent.
*--ask-su-pass*::
Prompt for su password, used with --su (deprecated, use become).
*-K*, *--ask-sudo-pass*::
Prompt for the password to use with --sudo, if any (deprecated, use become).
*--ask-vault-pass*::
Prompt for vault password.
*-C*, *--check*::
Do not make any changes on the remote system, but test resources to see what might
have changed. Note this can not scan all possible resource types and is only
a simulation.
*-c* 'CONNECTION', *--connection=*'CONNECTION'::
Connection type to use. Most common options are 'paramiko' (SSH), 'ssh', 'winrm'
and 'local'. 'local' is mostly useful for crontab or kickstarts.
*-D*, *--diff*::
When changing any templated files, show the unified diffs of how they changed. When
used with --check, shows how the files would have changed if --check were not used.
*-e* 'EXTRA_VARS', *--extra-vars=*'EXTRA_VARS'::
Extra variables to inject into a playbook, in key=value key=value format or
as quoted YAML/JSON (hashes and arrays). To load variables from a file, specify
the file preceded by @ (e.g. @vars.yml).
*--flush-cache*::
Clear the fact cache.
*--force-handlers*::
Run handlers even if a task fails.
*-f* 'NUM', *--forks=*'NUM'::
Level of parallelism. 'NUM' is specified as an integer, the default is 5.
*-h*, *--help*::
Show help page and exit
*-i* 'PATH', *--inventory=*'PATH'::
The 'PATH' to the inventory hosts file, which defaults to
'/etc/ansible/hosts'.
The 'PATH' to the inventory, which defaults to '/etc/ansible/hosts'.
Alternatively, you can use a comma-separated list of hosts or a single host with a trailing comma 'host,'.
*-l* 'SUBSET', *--limit=*'SUBSET'::
Further limits the selected host/group patterns.
You can prefix it with '~' to indicate that the pattern in a regex.
*--list-hosts*::
Outputs a list of matching hosts; does not execute anything else.
*--list-tags*::
List all available tags; does not execute anything else.
*--list-tasks*::
List all tasks that would be executed; does not execute anything else.
*-M* 'DIRECTORY', *--module-path=*'DIRECTORY'::
@ -51,35 +121,55 @@ The 'DIRECTORY' search path to load modules from. The default is
'/usr/share/ansible'. This can also be set with the ANSIBLE_LIBRARY
environment variable.
*-e* 'VARS', *--extra-vars=*'VARS'::
*--private-key=*'PRIVATE_KEY_FILE'::
Extra variables to inject into a playbook, in key=value key=value format or
as quoted JSON (hashes and arrays). To load variables from a file, specify
the file preceded by @ (e.g. @vars.yml).
Use this file to authenticate the connection
*-f* 'NUM', *--forks=*'NUM'::
*--skip-tages=*'SKIP_TAGS'::
Level of parallelism. 'NUM' is specified as an integer, the default is 5.
Only run plays and tasks whose tags do not match these values.
*--start-at-task=*'START_AT'::
*-k*, *--ask-pass*::
Start the playbook at the task matching this name.
Prompt for the SSH password instead of assuming key-based
authentication with ssh-agent.
*--step*::
One-step-at-a-time: confirm each task before running.
*-K*, *--ask-sudo-pass*::
*-S*, --su*::
Prompt for the password to use for playbook plays that request sudo
access, if any.
Run operations with su (deprecated, use become)
*-U*, 'SUDO_USER', *--sudo-user=*'SUDO_USER'::
*-R SU-USER*, *--su-user=*'SU_USER'::
Desired sudo user (default=root).
run operations with su as this user (default=root) (deprecated, use become)
*-t*, 'TAGS', *--tags=*'TAGS'::
*-s*, *--sudo*::
Only run plays and tasks tagged with these values.
Run the command as the user given by -u and sudo to root (deprecated, use become).
*--ssh-common-args=*''-o ProxyCommand="ssh -W %h:%p ..." ...''::
Add the specified arguments to any sftp/scp/ssh command-line. Useful to
set a ProxyCommand to use a jump host, but any arguments that are
accepted by all three programs may be specified.
*--sftp-extra-args=*''-f ...''::
Add the specified arguments to any sftp command-line.
*--scp-extra-args=*''-l ...''::
Add the specified arguments to any scp command-line.
*--ssh-extra-args=*''-R ...''::
Add the specified arguments to any ssh command-line.
*-U* 'SUDO_USERNAME', *--sudo-user=*'SUDO_USERNAME'::
Sudo to 'SUDO_USERNAME' deafult is root. (deprecated, use become).
*--skip-tags=*'SKIP_TAGS'::
@ -89,54 +179,46 @@ Only run plays and tasks whose tags do not match these values.
Look for syntax errors in the playbook, but don't run anything
*--check*::
*-t*, 'TAGS', *--tags=*'TAGS'::
Do not make any changes on the remote system, but test resources to see what might
have changed. Note this can not scan all possible resource types and is only
a simulation.
*--diff*::
When changing any templated files, show the unified diffs of how they changed. When
used with --check, shows how the files would have changed if --check were not used.
Only run plays and tasks tagged with these values.
*-T* 'SECONDS', *--timeout=*'SECONDS'::
Connection timeout to use when trying to talk to hosts, in 'SECONDS'.
*-s*, *--sudo*::
Force all plays to use sudo, even if not marked as such.
*-u* 'USERNAME', *--user=*'USERNAME'::
Use this remote user name on playbook steps that do not indicate a
user name to run as.
Use this 'USERNAME' to login to the target host, instead of the current user.
*-c* 'CONNECTION', *--connection=*'CONNECTION'::
*--vault-password-file=*'VAULT_PASSWORD_FILE'::
Connection type to use. Possible options are 'paramiko' (SSH), 'ssh',
and 'local'. 'local' is mostly useful for crontab or kickstarts.
Vault password file.
*-l* 'SUBSET', *--limit=*'SUBSET'::
*-v*, *--verbose*::
Further limits the selected host/group patterns.
Verbose mode, more output from successful actions will be shown. Give
up to three times for more output.
*--list-hosts*::
*--version*::
Show program's version number and exit.
Outputs a list of matching hosts; does not execute anything else.
ENVIRONMENT
-----------
The following environment variables may be specified.
ANSIBLE_HOSTS -- Override the default ansible hosts file
ANSIBLE_INVENTORY -- Override the default ansible inventory file
ANSIBLE_LIBRARY -- Override the default ansible module library path
ANSIBLE_CONFIG -- Override the default ansible config file
Many more are available for most options in ansible.cfg
FILES
-----
@ -148,6 +230,7 @@ FILES
~/.ansible.cfg -- User config file, overrides the default config if present
AUTHOR
------
@ -166,7 +249,7 @@ Ansible is released under the terms of the GPLv3 License.
SEE ALSO
--------
*ansible*(1), *ansible-pull*(1), *ansible-doc*(1)
*ansible*(1), *ansible-pull*(1), *ansible-doc*(1), *ansible-vault*(1), *ansible-galaxy*(1)
Extensive documentation is available in the documentation site:
<http://docs.ansible.com>. IRC and mailing list info can be found

View File

@ -1,112 +0,0 @@
'\" t
.\" Title: ansible
.\" Author: :doctype:manpage
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: 03/10/2015
.\" Manual: System administration commands
.\" Source: Ansible 1.9.0
.\" Language: English
.\"
.TH "ANSIBLE" "1" "03/10/2015" "Ansible 1\&.9\&.0" "System administration commands"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
ansible-pull \- set up a remote copy of ansible on each managed node
.SH "SYNOPSIS"
.sp
ansible\-pull \-d DEST \-U URL [options] [ <filename\&.yml> ]
.SH "DESCRIPTION"
.sp
\fBAnsible\fR is an extra\-simple tool/framework/API for doing \*(Aqremote things\*(Aq over SSH\&.
.sp
Use ansible\-pull to set up a remote copy of ansible on each managed node, each set to run via cron and update playbook source via a source repository\&. This inverts the default \fBpush\fR architecture of ansible into a \fBpull\fR architecture, which has near\-limitless scaling potential\&.
.sp
The setup playbook can be tuned to change the cron frequency, logging locations, and parameters to ansible\-pull\&.
.sp
This is useful both for extreme scale\-out as well as periodic remediation\&. Usage of the \fIfetch\fR module to retrieve logs from ansible\-pull runs would be an excellent way to gather and analyze remote logs from ansible\-pull\&.
.SH "OPTIONAL ARGUMENT"
.PP
\fBfilename\&.yml\fR
.RS 4
The name of one the YAML format files to run as an ansible playbook\&. This can be a relative path within the checkout\&. If not provided, ansible\-pull will look for a playbook based on the host\(cqs fully\-qualified domain name, on the host hostname and finally a playbook named
\fBlocal\&.yml\fR\&.
.RE
.SH "OPTIONS"
.PP
\fB\-d\fR \fIDEST\fR, \fB\-\-directory=\fR\fIDEST\fR
.RS 4
Directory to checkout repository into\&. If not provided, a subdirectory of ~/\&.ansible/pull/ will be used\&.
.RE
.PP
\fB\-U\fR \fIURL\fR, \fB\-\-url=\fR\fIURL\fR
.RS 4
URL of the playbook repository to checkout\&.
.RE
.PP
\fB\-C\fR \fICHECKOUT\fR, \fB\-\-checkout=\fR\fICHECKOUT\fR
.RS 4
Branch/Tag/Commit to checkout\&. If not provided, uses default behavior of module used to check out playbook repository\&.
.RE
.PP
\fB\-f\fR, \fB\-\-force\fR
.RS 4
Force running of playbook even if unable to update playbook repository\&. This can be useful, for example, to enforce run\-time state when a network connection may not always be up or possible\&.
.RE
.PP
\fB\-i\fR \fIPATH\fR, \fB\-\-inventory=\fR\fIPATH\fR
.RS 4
The
\fIPATH\fR
to the inventory hosts file\&. This can be a relative path within the checkout\&.
.RE
.PP
\fB\-\-purge\fR
.RS 4
Purge the checkout after the playbook is run\&.
.RE
.PP
\fB\-m\fR \fINAME\fR, \fB\-\-module\-name=\fR\fINAME\fR
.RS 4
Module used to checkout playbook repository\&. Defaults to git\&.
.RE
.PP
\fB\-o\fR, \fB\-\-only\-if\-changed\fR
.RS 4
Run the playbook only if the repository has changed
.RE
.SH "AUTHOR"
.sp
Ansible was originally written by Michael DeHaan\&. See the AUTHORS file for a complete list of contributors\&.
.SH "COPYRIGHT"
.sp
Copyright \(co 2012, Michael DeHaan
.sp
Ansible is released under the terms of the GPLv3 License\&.
.SH "SEE ALSO"
.sp
\fBansible\fR(1), \fBansible\-playbook\fR(1), \fBansible\-doc\fR(1)
.sp
Extensive documentation is available in the documentation site: http://docs\&.ansible\&.com\&. IRC and mailing list info can be found in file CONTRIBUTING\&.md, available in: https://github\&.com/ansible/ansible
.SH "AUTHOR"
.PP
\fB:doctype:manpage\fR
.RS 4
Author.
.RE

View File

@ -5,21 +5,21 @@ ansible(1)
:man version: %VERSION%
:man manual: System administration commands
NAME
----
ansible-pull - set up a remote copy of ansible on each managed node
ansible-pull - pull playbooks from VCS server and run them using this machine as the target.
SYNOPSIS
--------
ansible-pull -d DEST -U URL [options] [ <filename.yml> ]
ansible-pull -U URL [options] [ <filename.yml> ]
DESCRIPTION
-----------
*Ansible* is an extra-simple tool/framework/API for doing \'remote things' over
SSH.
*Ansible* is an extra-simple tool/framework/API for doing \'remote things'.
Use ansible-pull to set up a remote copy of ansible on each managed
node, each set to run via cron and update playbook source via
@ -50,19 +50,44 @@ host hostname and finally a playbook named *local.yml*.
OPTIONS
-------
*-d* 'DEST', *--directory=*'DEST'::
*--accept-host-key*::
Directory to checkout repository into. If not provided, a subdirectory of
~/.ansible/pull/ will be used.
Adds the hostkey for the repo URL if not already added.
*-U* 'URL', *--url=*'URL'::
*--ask-become-pass*::
URL of the playbook repository to checkout.
Ask for privilege escalation password.
*-k*, *--ask-pass*::
Prompt for the connection password, if it is needed for the transport used.
For example, using ssh and not having a key-based authentication with ssh-agent.
*--ask-su-pass*::
Prompt for su password, used with --su (deprecated, use become).
*-K*, *--ask-sudo-pass*::
Prompt for the password to use with --sudo, if any (deprecated, use become).
*--ask-vault-pass*::
Prompt for vault password.
*-C* 'CHECKOUT', *--checkout=*'CHECKOUT'::
Branch/Tag/Commit to checkout. If not provided, uses default behavior
of module used to check out playbook repository.
Branch/Tag/Commit to checkout. If not provided, uses default behavior of module used to check out playbook repository.
*-d* 'DEST', *--directory=*'DEST'::
Directory to checkout repository into. If not provided, a subdirectory of ~/.ansible/pull/ will be used.
*-e* 'EXTRA_VARS', *--extra-vars=*'EXTRA_VARS::
Extra variables to inject into a playbook, in key=value key=value format or
as quoted YAML/JSON (hashes and arrays). To load variables from a file, specify
the file preceded by @ (e.g. @vars.yml).
*-f*, *--force*::
@ -70,14 +95,22 @@ Force running of playbook even if unable to update playbook repository. This
can be useful, for example, to enforce run-time state when a network
connection may not always be up or possible.
*--full*::
Do a full clone of the repository. By default ansible-pull will do a shallow clone based on the last revision.
*-h*, *--help*::
Show the help message and exit.
*-i* 'PATH', *--inventory=*'PATH'::
The 'PATH' to the inventory hosts file. This can be a relative path within
the checkout.
The 'PATH' to the inventory, which defaults to '/etc/ansible/hosts'.
Alternatively you can use a comma separated list of hosts or single host with traling comma 'host,'.
*--purge*::
*--private-key=*'PRIVATE_KEY_FILE'::
Purge the checkout after the playbook is run.
Use this file to authenticate the connection.
*-m* 'NAME', *--module-name=*'NAME'::
@ -85,27 +118,107 @@ Module used to checkout playbook repository. Defaults to git.
*-o*, *--only-if-changed*::
Run the playbook only if the repository has changed
Only run the playbook if the repository has been updated.
*--purge*::
Purge the checkout after the playbook is run.
*-s* 'SLEEP', *--sleep=*'SLEEP'::
Sleep for random interval (between 0 and SLEEP number of seconds) before starting. This is a useful way ot disperse git requests.
*--ssh-common-args=*''-o ProxyCommand="ssh -W %h:%p ..." ...''::
Add the specified arguments to any sftp/scp/ssh command-line. Useful to
set a ProxyCommand to use a jump host, but any arguments that are
accepted by all three programs may be specified.
*--sftp-extra-args=*''-f ...''::
Add the specified arguments to any sftp command-line.
*--scp-extra-args=*''-l ...''::
Add the specified arguments to any scp command-line.
*--ssh-extra-args=*''-R ...''::
Add the specified arguments to any ssh command-line.
*-t* 'TAGS', *--tags=*'TAGS'::
Only run plays and tasks tagged with these values.
*-U* 'URL', *--url=*'URL'::
URL of the playbook repository to checkout.
*--vault-password-file=*'VAULT_PASSWORD_FILE'::
Vault password file.
*-v*, *--verbose*::
Pass -vvv to ansible-playbook.
INVENTORY
---------
Ansible stores the hosts it can potentially operate on in an inventory.
This can be an ini-like file, a script, directory or a list.
The ini syntax is one host per line. Groups headers are allowed and
are included on their own line, enclosed in square brackets that start the line.
Ranges of hosts are also supported. For more information and
additional options, see the documentation on http://docs.ansible.com/.
ENVIRONMENT
-----------
The following environment variables may be specified.
ANSIBLE_INVENTORY -- Override the default ansible inventory file
ANSIBLE_LIBRARY -- Override the default ansible module library path
ANSIBLE_CONFIG -- Override the default ansible config file
Many more are available for most options in ansible.cfg
FILES
-----
/etc/ansible/hosts -- Default inventory file
/usr/share/ansible/ -- Default module library
/etc/ansible/ansible.cfg -- Config file, used if present
~/.ansible.cfg -- User config file, overrides the default config if present
AUTHOR
------
Ansible was originally written by Michael DeHaan. See the AUTHORS file
for a complete list of contributors.
Ansible was originally written by Michael DeHaan.
See the AUTHORS file for a complete list of contributors.
COPYRIGHT
---------
Copyright © 2012, Michael DeHaan
Ansible is released under the terms of the GPLv3 License.
SEE ALSO
--------
*ansible*(1), *ansible-playbook*(1), *ansible-doc*(1)
*ansible*(1) *ansible-playbook*(1), *ansible-doc*(1), *ansible-vault*(1), *ansible-galaxy*(1)
Extensive documentation is available in the documentation site:
<http://docs.ansible.com>. IRC and mailing list info can be found

View File

@ -1,103 +0,0 @@
'\" t
.\" Title: ansible-vault
.\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: 03/10/2015
.\" Manual: System administration commands
.\" Source: Ansible 1.9.0
.\" Language: English
.\"
.TH "ANSIBLE\-VAULT" "1" "03/10/2015" "Ansible 1\&.9\&.0" "System administration commands"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
ansible-vault \- manage encrypted YAML data\&.
.SH "SYNOPSIS"
.sp
ansible\-vault [create|decrypt|edit|encrypt|rekey] [\-\-help] [options] file_name
.SH "DESCRIPTION"
.sp
\fBansible\-vault\fR can encrypt any structured data file used by Ansible\&. This can include \fBgroup_vars/\fR or \fBhost_vars/\fR inventory variables, variables loaded by \fBinclude_vars\fR or \fBvars_files\fR, or variable files passed on the ansible\-playbook command line with \fB\-e @file\&.yml\fR or \fB\-e @file\&.json\fR\&. Role variables and defaults are also included!
.sp
Because Ansible tasks, handlers, and so on are also data, these can also be encrypted with vault\&. If you\(cqd like to not betray what variables you are even using, you can go as far to keep an individual task file entirely encrypted\&.
.SH "COMMON OPTIONS"
.sp
The following options are available to all sub\-commands:
.PP
\fB\-\-vault\-password\-file=\fR\fIFILE\fR
.RS 4
A file containing the vault password to be used during the encryption/decryption steps\&. Be sure to keep this file secured if it is used\&.
.RE
.PP
\fB\-h\fR, \fB\-\-help\fR
.RS 4
Show a help message related to the given sub\-command\&.
.RE
.PP
\fB\-\-debug\fR
.RS 4
Enable debugging output for troubleshooting\&.
.RE
.SH "CREATE"
.sp
\fB$ ansible\-vault create [options] FILE\fR
.sp
The \fBcreate\fR sub\-command is used to initialize a new encrypted file\&.
.sp
First you will be prompted for a password\&. The password used with vault currently must be the same for all files you wish to use together at the same time\&.
.sp
After providing a password, the tool will launch whatever editor you have defined with $EDITOR, and defaults to vim\&. Once you are done with the editor session, the file will be saved as encrypted data\&.
.sp
The default cipher is AES (which is shared\-secret based)\&.
.SH "EDIT"
.sp
\fB$ ansible\-vault edit [options] FILE\fR
.sp
The \fBedit\fR sub\-command is used to modify a file which was previously encrypted using ansible\-vault\&.
.sp
This command will decrypt the file to a temporary file and allow you to edit the file, saving it back when done and removing the temporary file\&.
.SH "REKEY"
.sp
*$ ansible\-vault rekey [options] FILE_1 [FILE_2, \&..., FILE_N]
.sp
The \fBrekey\fR command is used to change the password on a vault\-encrypted files\&. This command can update multiple files at once, and will prompt for both the old and new passwords before modifying any data\&.
.SH "ENCRYPT"
.sp
*$ ansible\-vault encrypt [options] FILE_1 [FILE_2, \&..., FILE_N]
.sp
The \fBencrypt\fR sub\-command is used to encrypt pre\-existing data files\&. As with the \fBrekey\fR command, you can specify multiple files in one command\&.
.SH "DECRYPT"
.sp
*$ ansible\-vault decrypt [options] FILE_1 [FILE_2, \&..., FILE_N]
.sp
The \fBdecrypt\fR sub\-command is used to remove all encryption from data files\&. The files will be stored as plain\-text YAML once again, so be sure that you do not run this command on data files with active passwords or other sensitive data\&. In most cases, users will want to use the \fBedit\fR sub\-command to modify the files securely\&.
.SH "AUTHOR"
.sp
Ansible was originally written by Michael DeHaan\&. See the AUTHORS file for a complete list of contributors\&.
.SH "COPYRIGHT"
.sp
Copyright \(co 2014, Michael DeHaan
.sp
Ansible is released under the terms of the GPLv3 License\&.
.SH "SEE ALSO"
.sp
\fBansible\fR(1), \fBansible\-pull\fR(1), \fBansible\-doc\fR(1)
.sp
Extensive documentation is available in the documentation site: http://docs\&.ansible\&.com\&. IRC and mailing list info can be found in file CONTRIBUTING\&.md, available in: https://github\&.com/ansible/ansible

View File

@ -7,7 +7,7 @@ ansible-vault(1)
NAME
----
ansible-vault - manage encrypted YAML data.
ansible-vault - manage encrypted ansible vars files (YAML).
SYNOPSIS
@ -18,15 +18,16 @@ ansible-vault [create|decrypt|edit|encrypt|rekey] [--help] [options] file_name
DESCRIPTION
-----------
*ansible-vault* can encrypt any structured data file used by Ansible. This can include
*group_vars/* or *host_vars/* inventory variables, variables loaded by *include_vars* or
*vars_files*, or variable files passed on the ansible-playbook command line with
*-e @file.yml* or *-e @file.json*. Role variables and defaults are also included!
*ansible-vault* can encrypt any structured data file used by Ansible.
This can include *group_vars/* or *host_vars/* inventory variables,
variables loaded by *include_vars* or *vars_files*, or variable files
passed on the ansible-playbook command line with *-e @file.yml* or *-e @file.json*.
Role variables and defaults are also included!
Because Ansible tasks, handlers, and so on are also data, these can also be encrypted with
vault. If you’d like to not betray what variables you are even using, you can go as far to
keep an individual task file entirely encrypted.
Because Ansible tasks, handlers, and so on are also data, these can also be encrypted with vault.
If you’d like to not betray what variables you are even using, you can go as far to keep an individual task file entirely encrypted.
The password used with vault currently must be the same for all files you wish to use together at the same time.
COMMON OPTIONS
--------------
@ -36,28 +37,33 @@ The following options are available to all sub-commands:
*--vault-password-file=*'FILE'::
A file containing the vault password to be used during the encryption/decryption
steps. Be sure to keep this file secured if it is used.
steps. Be sure to keep this file secured if it is used. If the file is executable,
it will be run and its standard output will be used as the password.
*--new-vault-password-file=*'FILE'::
A file containing the new vault password to be used when rekeying a
file. Be sure to keep this file secured if it is used. If the file
is executable, it will be run and its standard output will be used as
the password.
*-h*, *--help*::
Show a help message related to the given sub-command.
*--debug*::
Enable debugging output for troubleshooting.
If '--valut-password-file' is not supplied ansib-vault will automatically prompt for passwords as required.
CREATE
------
*$ ansible-vault create [options] FILE*
The *create* sub-command is used to initialize a new encrypted file.
The *create* sub-command is used to initialize a new encrypted file.
First you will be prompted for a password. The password used with vault currently
must be the same for all files you wish to use together at the same time.
After providing a password, the tool will launch whatever editor you have defined
with $EDITOR, and defaults to vim. Once you are done with the editor session, the
After providing a password, the tool will launch whatever editor you have defined
with $EDITOR, and defaults to vim. Once you are done with the editor session, the
file will be saved as encrypted data.
The default cipher is AES (which is shared-secret based).
@ -67,39 +73,62 @@ EDIT
*$ ansible-vault edit [options] FILE*
The *edit* sub-command is used to modify a file which was previously encrypted
using ansible-vault.
The *edit* sub-command is used to modify a file which was previously encrypted using ansible-vault.
This command will decrypt the file to a temporary file and allow you to edit the file,
saving it back when done and removing the temporary file.
This command will decrypt the file to a temporary file and allow you to edit the
file, saving it back when done and removing the temporary file.
REKEY
-----
*$ ansible-vault rekey [options] FILE_1 [FILE_2, ..., FILE_N]
*$ ansible-vault rekey [options] FILE_1 [FILE_2, ..., FILE_N]*
The *rekey* command is used to change the password on a vault-encrypted files.
This command can update multiple files at once, and will prompt for both the
old and new passwords before modifying any data.
This command can update multiple files at once.
ENCRYPT
-------
*$ ansible-vault encrypt [options] FILE_1 [FILE_2, ..., FILE_N]
*$ ansible-vault encrypt [options] FILE_1 [FILE_2, ..., FILE_N]*
The *encrypt* sub-command is used to encrypt pre-existing data files. As with the
*rekey* command, you can specify multiple files in one command.
The *encrypt* sub-command is used to encrypt pre-existing data files.
As with the *rekey* command, you can specify multiple files in one command.
The *encrypt* command accepts an *--output FILENAME* option to determine where
encrypted output is stored. With this option, input is read from the (at most one)
filename given on the command line; if no input file is given, input is read from stdin.
Either the input or the output file may be given as '-' for stdin and stdout respectively.
If neither input nor output file is given, the command acts as a filter,
reading plaintext from stdin and writing it to stdout.
Thus any of the following invocations can be used:
*$ ansible-vault encrypt*
*$ ansible-vault encrypt --output OUTFILE*
*$ ansible-vault encrypt INFILE --output OUTFILE*
*$ echo secret|ansible-vault encrypt --output OUTFILE*
Reading from stdin and writing only encrypted output is a good way to prevent
sensitive data from ever hitting disk (either interactively or from a script).
DECRYPT
-------
*$ ansible-vault decrypt [options] FILE_1 [FILE_2, ..., FILE_N]
*$ ansible-vault decrypt [options] FILE_1 [FILE_2, ..., FILE_N]*
The *decrypt* sub-command is used to remove all encryption from data files. The files
will be stored as plain-text YAML once again, so be sure that you do not run this
command on data files with active passwords or other sensitive data. In most cases,
users will want to use the *edit* sub-command to modify the files securely.
The *decrypt* sub-command is used to remove all encryption from data files.
The files will be stored as plain-text YAML once again, so be sure that you do not run this
command on data files with active passwords or other sensitive data.
In most cases, users will want to use the *edit* sub-command to modify the files securely.
As with *encrypt*, the *decrypt* subcommand also accepts the *--output FILENAME*
option to specify where plaintext output is stored, and stdin/stdout is handled
as described above.
AUTHOR
------
@ -119,7 +148,7 @@ Ansible is released under the terms of the GPLv3 License.
SEE ALSO
--------
*ansible*(1), *ansible-pull*(1), *ansible-doc*(1)
*ansible*(1), *ansible-pull*(1), *ansible-doc*(1), *ansible-playbook*(1), *ansible-galaxy*(1)
Extensive documentation is available in the documentation site:
<http://docs.ansible.com>. IRC and mailing list info can be found

View File

@ -1,219 +0,0 @@
'\" t
.\" Title: ansible
.\" Author: :doctype:manpage
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: 03/10/2015
.\" Manual: System administration commands
.\" Source: Ansible 1.9.0
.\" Language: English
.\"
.TH "ANSIBLE" "1" "03/10/2015" "Ansible 1\&.9\&.0" "System administration commands"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
ansible \- run a command somewhere else
.SH "SYNOPSIS"
.sp
ansible <host\-pattern> [\-f forks] [\-m module_name] [\-a args]
.SH "DESCRIPTION"
.sp
\fBAnsible\fR is an extra\-simple tool/framework/API for doing \*(Aqremote things\*(Aq over SSH\&.
.SH "ARGUMENTS"
.PP
\fBhost\-pattern\fR
.RS 4
A name of a group in the inventory file, a shell\-like glob selecting hosts in inventory file, or any combination of the two separated by semicolons\&.
.RE
.SH "OPTIONS"
.PP
\fB\-v\fR, \fB\-\-verbose\fR
.RS 4
Verbose mode, more output from successful actions will be shown\&. Give up to three times for more output\&.
.RE
.PP
\fB\-i\fR \fIPATH\fR, \fB\-\-inventory=\fR\fIPATH\fR
.RS 4
The
\fIPATH\fR
to the inventory hosts file, which defaults to
\fI/etc/ansible/hosts\fR\&.
.RE
.PP
\fB\-f\fR \fINUM\fR, \fB\-\-forks=\fR\fINUM\fR
.RS 4
Level of parallelism\&.
\fINUM\fR
is specified as an integer, the default is 5\&.
.RE
.PP
\fB\-\-private\-key=\fR\fIPRIVATE_KEY_FILE\fR
.RS 4
Use this file to authenticate the connection\&.
.RE
.PP
\fB\-m\fR \fINAME\fR, \fB\-\-module\-name=\fR\fINAME\fR
.RS 4
Execute the module called
\fINAME\fR\&.
.RE
.PP
\fB\-M\fR \fIDIRECTORY\fR, \fB\-\-module\-path=\fR\fIDIRECTORY\fR
.RS 4
The
\fIDIRECTORY\fR
search path to load modules from\&. The default is
\fI/usr/share/ansible\fR\&. This can also be set with the ANSIBLE_LIBRARY environment variable\&.
.RE
.PP
\fB\-a\fR \*(Aq\fIARGUMENTS\fR\*(Aq, \fB\-\-args=\fR\*(Aq\fIARGUMENTS\fR\*(Aq
.RS 4
The
\fIARGUMENTS\fR
to pass to the module\&.
.RE
.PP
\fB\-k\fR, \fB\-\-ask\-pass\fR
.RS 4
Prompt for the SSH password instead of assuming key\-based authentication with ssh\-agent\&.
.RE
.PP
\fB\-K\fR, \fB\-\-ask\-sudo\-pass\fR
.RS 4
Prompt for the password to use with \-\-sudo, if any
.RE
.PP
\fB\-o\fR, \fB\-\-one\-line\fR
.RS 4
Try to output everything on one line\&.
.RE
.PP
\fB\-s\fR, \fB\-\-sudo\fR
.RS 4
Run the command as the user given by \-u and sudo to root\&.
.RE
.PP
\fB\-t\fR \fIDIRECTORY\fR, \fB\-\-tree=\fR\fIDIRECTORY\fR
.RS 4
Save contents in this output
\fIDIRECTORY\fR, with the results saved in a file named after each host\&.
.RE
.PP
\fB\-T\fR \fISECONDS\fR, \fB\-\-timeout=\fR\fISECONDS\fR
.RS 4
Connection timeout to use when trying to talk to hosts, in
\fISECONDS\fR\&.
.RE
.PP
\fB\-B\fR \fINUM\fR, \fB\-\-background=\fR\fINUM\fR
.RS 4
Run commands in the background, killing the task after
\fINUM\fR
seconds\&.
.RE
.PP
\fB\-P\fR \fINUM\fR, \fB\-\-poll=\fR\fINUM\fR
.RS 4
Poll a background job every
\fINUM\fR
seconds\&. Requires
\fB\-B\fR\&.
.RE
.PP
\fB\-u\fR \fIUSERNAME\fR, \fB\-\-user=\fR\fIUSERNAME\fR
.RS 4
Use this remote
\fIUSERNAME\fR
instead of the current user\&.
.RE
.PP
\fB\-U\fR \fISUDO_USERNAME\fR, \fB\-\-sudo\-user=\fR\fISUDO_USERNAME\fR
.RS 4
Sudo to
\fISUDO_USERNAME\fR
instead of root\&. Implies \-\-sudo\&.
.RE
.PP
\fB\-c\fR \fICONNECTION\fR, \fB\-\-connection=\fR\fICONNECTION\fR
.RS 4
Connection type to use\&. Possible options are
\fIparamiko\fR
(SSH),
\fIssh\fR, and
\fIlocal\fR\&.
\fIlocal\fR
is mostly useful for crontab or kickstarts\&.
.RE
.PP
\fB\-l\fR \fISUBSET\fR, \fB\-\-limit=\fR\fISUBSET\fR
.RS 4
Further limits the selected host/group patterns\&.
.RE
.PP
\fB\-l\fR \fI~REGEX\fR, \fB\-\-limit=\fR\fI~REGEX\fR
.RS 4
Further limits hosts with a regex pattern\&.
.RE
.PP
\fB\-\-list\-hosts\fR
.RS 4
Outputs a list of matching hosts; does not execute anything else\&.
.RE
.SH "INVENTORY"
.sp
Ansible stores the hosts it can potentially operate on in an inventory file\&. The syntax is one host per line\&. Groups headers are allowed and are included on their own line, enclosed in square brackets that start the line\&.
.sp
Ranges of hosts are also supported\&. For more information and additional options, see the documentation on http://docs\&.ansible\&.com/\&.
.SH "FILES"
.sp
/etc/ansible/hosts \(em Default inventory file
.sp
/usr/share/ansible/ \(em Default module library
.sp
/etc/ansible/ansible\&.cfg \(em Config file, used if present
.sp
~/\&.ansible\&.cfg \(em User config file, overrides the default config if present
.SH "ENVIRONMENT"
.sp
The following environment variables may be specified\&.
.sp
ANSIBLE_HOSTS \(em Override the default ansible hosts file
.sp
ANSIBLE_LIBRARY \(em Override the default ansible module library path
.sp
ANSIBLE_CONFIG \(em Override the default ansible config file
.SH "AUTHOR"
.sp
Ansible was originally written by Michael DeHaan\&. See the AUTHORS file for a complete list of contributors\&.
.SH "COPYRIGHT"
.sp
Copyright \(co 2012, Michael DeHaan
.sp
Ansible is released under the terms of the GPLv3 License\&.
.SH "SEE ALSO"
.sp
\fBansible\-playbook\fR(1), \fBansible\-pull\fR(1), \fBansible\-doc\fR(1)
.sp
Extensive documentation is available in the documentation site: http://docs\&.ansible\&.com\&. IRC and mailing list info can be found in file CONTRIBUTING\&.md, available in: https://github\&.com/ansible/ansible
.SH "AUTHOR"
.PP
\fB:doctype:manpage\fR
.RS 4
Author.
.RE

View File

@ -7,19 +7,19 @@ ansible(1)
NAME
----
ansible - run a command somewhere else
ansible - run a task on a target host(s)
SYNOPSIS
--------
ansible <host-pattern> [-f forks] [-m module_name] [-a args]
ansible <host-pattern> [-m module_name] [-a args] [options]
DESCRIPTION
-----------
*Ansible* is an extra-simple tool/framework/API for doing \'remote things' over
SSH.
*Ansible* is an extra-simple tool/framework/API for doing \'remote things'.
This is the adhoc command that allows for a \'single task playbook' run.
ARGUMENTS
@ -27,62 +27,144 @@ ARGUMENTS
*host-pattern*::
A name of a group in the inventory file, a shell-like glob selecting
hosts in inventory file, or any combination of the two separated by
semicolons.
A name of a group in the inventory, a shell-like glob selecting
hosts in inventory or any combination of the two separated by commas.
OPTIONS
-------
*-v*, *--verbose*::
*-a* \'_ARGUMENTS_', *--args=*\'_ARGUMENTS_'::
Verbose mode, more output from successful actions will be shown. Give
up to three times for more output.
The 'ARGUMENTS' to pass to the module.
*-i* 'PATH', *--inventory=*'PATH'::
*--ask-become-pass*::
The 'PATH' to the inventory hosts file, which defaults to '/etc/ansible/hosts'.
Ask for privilege escalation password.
*-k*, *--ask-pass*::
Prompt for the connection password, if it is needed for the transport used.
For example, using ssh and not having a key-based authentication with ssh-agent.
*--ask-su-pass*::
Prompt for su password, used with --su (deprecated, use become).
*-K*, *--ask-sudo-pass*::
Prompt for the password to use with --sudo, if any (deprecated, use become).
*--ask-vault-pass*::
Prompt for vault password.
*-B* 'NUM', *--background=*'NUM'::
Run commands in the background, killing the task after 'NUM' seconds.
*--become-method=*'BECOME_METHOD'::
Privilege escalation method to use (default=sudo),
valid choices: [ sudo | su | pbrun | pfexec | runas | doas ]
*--become-user=*'BECOME_USER'::
Run operations as this user (default=root).
*-C*, *--check*::
Do not make any changes on the remote system, but test resources to see what might
have changed. Note this can not scan all possible resource types and is only
a simulation.
*-c* 'CONNECTION', *--connection=*'CONNECTION'::
Connection type to use. Most common options are 'paramiko' (SSH), 'ssh', 'winrm'
and 'local'. 'local' is mostly useful for crontab or kickstarts.
*-e* 'EXTRA_VARS, *--extra-vars=*'EXTRA_VARS'::
Extra variables to inject into a playbook, in key=value key=value format or
as quoted YAML/JSON (hashes and arrays). To load variables from a file, specify
the file preceded by @ (e.g. @vars.yml).
*-f* 'NUM', *--forks=*'NUM'::
Level of parallelism. 'NUM' is specified as an integer, the default is 5.
*--private-key=*'PRIVATE_KEY_FILE'::
*-h*, *--help*::
Use this file to authenticate the connection.
Show help message and exit.
*-i* 'PATH', *--inventory=*'PATH'::
The 'PATH' to the inventory, which defaults to '/etc/ansible/hosts'.
Alternatively you can use a comma separated list of hosts or single host with traling comma 'host,'.
*-l* 'SUBSET', *--limit=*'SUBSET'::
Further limits the selected host/group patterns.
You can prefix it with '~' to indicate that the patter in a regex.
*--list-hosts*::
Outputs a list of matching hosts; does not execute anything else.
*-m* 'NAME', *--module-name=*'NAME'::
Execute the module called 'NAME'.
*-M* 'DIRECTORY', *--module-path=*'DIRECTORY'::
The 'DIRECTORY' search path to load modules from. The default is
'/usr/share/ansible'. This can also be set with the ANSIBLE_LIBRARY
environment variable.
*-a* \'_ARGUMENTS_', *--args=*\'_ARGUMENTS_'::
The 'ARGUMENTS' to pass to the module.
*-k*, *--ask-pass*::
Prompt for the SSH password instead of assuming key-based authentication with ssh-agent.
*-K*, *--ask-sudo-pass*::
Prompt for the password to use with --sudo, if any
*-o*, *--one-line*::
Try to output everything on one line.
*-P* 'NUM', *--poll=*'NUM'::
Poll a background job every 'NUM' seconds. Requires *-B*.
*--private-key=*'PRIVATE_KEY_FILE'::
Use this file to authenticate the connection.
*-S*, *--su*::
Run operations with su (deprecated, use become).
*-R* 'SU_USER', *--se-user=*'SUDO_USER'::
Run operations with su as this user (default=root) (deprecated, use become).
*-s*, *--sudo*::
Run the command as the user given by -u and sudo to root.
Run the command as the user given by -u and sudo to root (deprecated, use become).
*--ssh-common-args=*''-o ProxyCommand="ssh -W %h:%p ..." ...''::
Add the specified arguments to any sftp/scp/ssh command-line. Useful to
set a ProxyCommand to use a jump host, but any arguments that are
accepted by all three programs may be specified.
*--sftp-extra-args=*''-f ...''::
Add the specified arguments to any sftp command-line.
*--scp-extra-args=*''-l ...''::
Add the specified arguments to any scp command-line.
*--ssh-extra-args=*''-R ...''::
Add the specified arguments to any ssh command-line.
*-U* 'SUDO_USERNAME', *--sudo-user=*'SUDO_USERNAME'::
Sudo to 'SUDO_USERNAME' default is root. (deprecated, use become).
*-t* 'DIRECTORY', *--tree=*'DIRECTORY'::
@ -93,50 +175,51 @@ file named after each host.
Connection timeout to use when trying to talk to hosts, in 'SECONDS'.
*-B* 'NUM', *--background=*'NUM'::
Run commands in the background, killing the task after 'NUM' seconds.
*-P* 'NUM', *--poll=*'NUM'::
Poll a background job every 'NUM' seconds. Requires *-B*.
*-u* 'USERNAME', *--user=*'USERNAME'::
Use this remote 'USERNAME' instead of the current user.
Use this 'USERNAME' to login to the target host, instead of the current user.
*-U* 'SUDO_USERNAME', *--sudo-user=*'SUDO_USERNAME'::
*--vault-password-file=*'VAULT_PASSWORD_FILE'::
Sudo to 'SUDO_USERNAME' instead of root. Implies --sudo.
A file containing the vault password to be used during the decryption of vault encrypted files.
Be sure to keep this file secured if it is used. If the file is executable,
it will be run and its standard output will be used as the password.
*-c* 'CONNECTION', *--connection=*'CONNECTION'::
*-v*, *--verbose*::
Connection type to use. Possible options are 'paramiko' (SSH), 'ssh',
and 'local'. 'local' is mostly useful for crontab or kickstarts.
Verbose mode, more output from successful actions will be shown.
Give up to three times for more output.
*-l* 'SUBSET', *--limit=*'SUBSET'::
*--version*::
Further limits the selected host/group patterns.
*-l* '\~REGEX', *--limit=*'~REGEX'::
Further limits hosts with a regex pattern.
*--list-hosts*::
Outputs a list of matching hosts; does not execute anything else.
Show program version number and exit.
INVENTORY
---------
Ansible stores the hosts it can potentially operate on in an inventory
file. The syntax is one host per line. Groups headers are allowed and
are included on their own line, enclosed in square brackets that
start the line.
Ansible stores the hosts it can potentially operate on in an inventory.
This can be an ini-like file, a script, directory or a list.
The ini syntax is one host per line. Groups headers are allowed and
are included on their own line, enclosed in square brackets that start the line.
Ranges of hosts are also supported. For more information and
additional options, see the documentation on http://docs.ansible.com/.
ENVIRONMENT
-----------
The following environment variables may be specified.
ANSIBLE_INVENTORY -- Override the default ansible inventory file
ANSIBLE_LIBRARY -- Override the default ansible module library path
ANSIBLE_CONFIG -- Override the default ansible config file
Many more are available for most options in ansible.cfg
FILES
-----
@ -148,37 +231,25 @@ FILES
~/.ansible.cfg -- User config file, overrides the default config if present
ENVIRONMENT
-----------
The following environment variables may be specified.
ANSIBLE_HOSTS -- Override the default ansible hosts file
ANSIBLE_LIBRARY -- Override the default ansible module library path
ANSIBLE_CONFIG -- Override the default ansible config file
AUTHOR
------
Ansible was originally written by Michael DeHaan. See the AUTHORS file
for a complete list of contributors.
Ansible was originally written by Michael DeHaan.
See the AUTHORS file for a complete list of contributors.
COPYRIGHT
---------
Copyright © 2012, Michael DeHaan
Ansible is released under the terms of the GPLv3 License.
SEE ALSO
--------
*ansible-playbook*(1), *ansible-pull*(1), *ansible-doc*(1)
*ansible-playbook*(1), *ansible-pull*(1), *ansible-doc*(1), *ansible-vault*(1), *ansible-galaxy*(1)
Extensive documentation is available in the documentation site:
<http://docs.ansible.com>. IRC and mailing list info can be found

View File

@ -20,6 +20,8 @@ viewdocs: clean staticmin
htmldocs: staticmin
./build-site.py rst
webdocs: htmldocs
clean:
-rm -rf htmlout
-rm -f .buildinfo

View File

@ -4,7 +4,7 @@ Homepage and documentation source for Ansible
This project hosts the source behind [docs.ansible.com](http://docs.ansible.com/)
Contributions to the documentation are welcome. To make changes, submit a pull request
that changes the reStructuredText files in the "rst/" directory only, and Michael can
that changes the reStructuredText files in the "rst/" directory only, and the core team can
do a docs build and push the static files.
If you wish to verify output from the markup

View File

@ -20,6 +20,6 @@
{%- endif %}
</p>
Ansible docs are generated from <a href="http://github.com/ansible/ansible">GitHub sources</A> using <A HREF="http://sphinx-doc.org/">Sphinx</A> using a theme provided by <a href="http://readthedocs.org">Read the Docs</a>. {% if pagename.endswith("_module") %}. Module documentation is not edited directly, but is generated from the source code for the modules. To submit an update to module docs, edit the 'DOCUMENTATION' metadata in the <A HREF="https://github.com/ansible/ansible-modules-core">core</A> and <A HREF="https://github.com/ansible/ansible-modules-extras">extras</A> modules source repositories. {% endif %}
Ansible docs are generated from <a href="https://github.com/ansible/ansible">GitHub sources</A> using <A HREF="http://sphinx-doc.org/">Sphinx</A> using a theme provided by <a href="http://readthedocs.org">Read the Docs</a>. {% if pagename.endswith("_module") %}. Module documentation is not edited directly, but is generated from the source code for the modules. To submit an update to module docs, edit the 'DOCUMENTATION' metadata in the <A HREF="https://github.com/ansible/ansible-modules-core">core</A> and <A HREF="https://github.com/ansible/ansible-modules-extras">extras</A> modules source repositories. {% endif %}
</footer>

View File

@ -113,23 +113,8 @@
}
</style>
<!-- Google Code for Remarketing Tag -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 972577926;
var google_custom_params = window.google_tag_params;
var google_remarketing_only = true;
/* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt=""
src="//googleads.g.doubleclick.net/pagead/viewthroughconversion/972577926/?value=0&amp;guid=ON&amp;script=0"/>
</div>
</noscript>
<!-- End of Google Code for Remarketing Tag -->
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300'
rel='stylesheet' type='text/css'>
</head>
@ -140,16 +125,32 @@
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-PSB293');</script>
<!-- End Google Tag Manager -->
<a class="DocSite-nav" href="http://docs.ansible.com/">
<img class="DocSiteNav-logo"
src="{{ pathto('_static/', 1) }}images/logo_invert.png"
alt="Ansible Logo">
<div class="DocSiteNav-title">
Documentation
</div>
</a>
<div class="wy-grid-for-nav">
{# SIDE NAV, TOGGLES ON MOBILE #}
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div style='background-color:#64C5C7'>
<br/>
<center><a href="{{ pathto(master_doc) }}"><img src="http://cdn2.hubspot.net/hub/330046/file-445792629-png/ANSI_logotype_web_white.png" style="border-radius:0;background-color:#64C5C7;width:214px;height:26px;margin:'auto auto auto auto'"></a></center>
<br/>
<div style="background-color:#5bbdbf;height=80px;margin:'auto auto auto auto'">
<a class="DocSiteProduct-header DocSiteProduct-header--core"
href="http://docs.ansible.com/ansible/">
<div class="DocSiteProduct-productName">
<div class="DocSiteProduct-logoText">
ANSIBLE
</div>
</div>
</a>
</div>
<div class="wy-side-nav-search" style="background-color:#64C5C7;height=80px;margin:'auto auto auto auto'">
<div class="wy-side-nav-search" style="background-color:#5bbdbf;height=80px;margin:'auto auto auto auto'">
<!-- <a href="{{ pathto(master_doc) }}" class="icon icon-home"> {{ project }}</a> -->
{% include "searchbox.html" %}
</div>
@ -195,17 +196,15 @@
<div class="wy-nav-content">
<div class="rst-content">
<!-- AnsibleFest and free eBook preview stuff -->
<center>
<a href="http://www.ansible.com/tower?utm_source=docs">
<img src="http://www.ansible.com/hubfs/Docs_Ads/TowerDocs.png">
</a>
<a href="https://www.eventbrite.com/e/ansiblefest-nyc-2015-tickets-16058031003">
<img src="http://www.ansible.com/hubfs/Docs_Ads/Untitled_design_1.png">
</a>
<br/>&nbsp;<br/>
<br/>&nbsp;<br/>
</center>
<!-- Tower ads -->
<a class="DocSiteBanner" href="http://www.ansible.com/tower?utm_source=docs">
<div class="DocSiteBanner-imgWrapper">
<img src="{{ pathto('_static/', 1) }}images/banner_ad_1.png">
</div>
<div class="DocSiteBanner-imgWrapper">
<img src="{{ pathto('_static/', 1) }}images/banner_ad_2.png">
</div>
</a>
{% include "breadcrumbs.html" %}
<div id="page-content">

View File

@ -4634,3 +4634,122 @@ span[id*='MathJax-Span'] {
#search-box-id {
padding-right: 25px;
}
.DocSiteProduct-header {
flex: 1;
-webkit-flex: 1;
padding: 20px;
padding-top: 10px;
padding-bottom: 20px;
display: flex;
display: -webkit-flex;
flex-direction: column;
-webkit-flex-direction: column;
align-items: center;
-webkit-align-items: center;
justify-content: flex-start;
-webkit-justify-content: flex-start;
margin-left: 20px;
margin-right: 20px;
text-decoration: none;
font-weight: 400;
font-family: 'Open Sans', sans-serif;
}
.DocSiteProduct-header:active,
.DocSiteProduct-header:focus {
color: #fff;
}
.DocSiteProduct-header:visited {
color: #fff;
}
.DocSiteProduct-header--core {
font-size: 25px;
background-color: #5bbdbf;
border: 2px solid #5bbdbf;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
color: #fff;
}
.DocSiteProduct-headerAlign {
width: 100%;
}
.DocSiteProduct-logo {
width: 60px;
height: 60px;
margin-bottom: -9px;
}
.DocSiteProduct-logoText {
margin-top: 6px;
font-size: 25px;
}
.DocSite-nav {
flex: initial;
-webkit-flex: initial;
display: flex;
display: -webkit-flex;
flex-direction: row;
-webkit-flex-direction: row;
justify-content: flex-start;
-webkit-justify-content: flex-start;
padding: 15px;
background-color: #000;
text-decoration: none;
font-family: 'Open Sans', sans-serif;
}
.DocSiteNav-logo {
width: 28px;
height: 28px;
margin-right: 8px;
}
.DocSiteNav-title {
color: #fff;
font-size: 20px;
}
.wy-menu-vertical a {
padding: 0;
}
.wy-menu-vertical a.reference.internal {
padding: 0.4045em 1.618em;
}
.DocSiteBanner {
width: 100%;
display: flex;
display: -webkit-flex;
flex-wrap: wrap;
-webkit-flex-wrap: wrap;
justify-content: space-between;
-webkit-justify-content: space-between;
background-color: #ff5850;
margin-bottom: 25px;
}
.DocSiteBanner-imgWrapper {
max-width: 100%;
}
@media screen and (max-width: 1403px) {
.DocSiteBanner {
width: 100%;
display: flex;
display: -webkit-flex;
flex-wrap: wrap;
-webkit-flex-wrap: wrap;
justify-content: center;
-webkit-justify-content: center;
background-color: #fff;
margin-bottom: 25px;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Some files were not shown because too many files have changed in this diff Show More