Commit graph

6940 commits

Author SHA1 Message Date
camradal
be87cd8c26 Fix logging into vCloud Director and expose verify_certs argument (#15533) 2016-05-05 09:48:54 -04:00
Andrew Taumoefolau
bc81c76f86 Apply inventory host restrictions by host name rather than UUID.
Issue #15633 observes that a meta: inventory_refresh task causes the playbook
to exit. An inventory refresh flushes all caches and rebuilds all host
objects, assigning new UUIDs to each. These new host UUIDs currently fail to
match those on host objects stored for restrictions in the inventory, causing
the playbook to exit for having no hosts to run further tasks against.

This changeset attempts to address this issue by storing host restrictions
by name, and comparing inventory host names against these names when applying
restrictions in get_hosts.
2016-05-05 22:32:58 +10:00
Robin Roth
56ba10365c better fix for arch version detection (#15705)
* better fix for arch version detection

fixes  #15696

* be extra safe about tracebacks in facts.py

* add comments to explain the setup
* make allowempty more conservative, ignore file content
* wrap function call in try/except
  * should never happen, but if it happens the bug should be distribtion=N/A and not a traceback
2016-05-04 12:32:08 -07:00
nitzmahone
6373f2b045 error message cleanup 2016-05-04 09:43:41 -07:00
Toshio Kuratomi
ae9ddf0c1c Submodule updates to fix documentation 2016-05-03 10:12:02 -07:00
Tobias Wolf
87648f7bdf actionable.py: Do not print next task banner in handler callback (#15698)
Fix actionable callback plugin to not print the banner of the previous
task.

When a handler is executed there is no task banner, so in case it is run,
it will reference the banner from the preceding task.

**Author:** @hvhaugwitz

Test case:

      ---

      - name: actionable filter
        hosts: all
        handlers:
          - name: handler
            command: "true"
        tasks:
          - name: task 1
            file: path=/tmp/test state=touch
            notify: handler
          - name: task 2
            file: path=/tmp/test state=absent
          - name: task 3
            file: path=/tmp/test state=absent
          - name: task 4
            file: path=/tmp/test state=absent
          - name: task 5
            file: path=/tmp/test state=absent
          - name: task 6
            file: path=/tmp/test state=absent

Example output:

BEFORE
------

      PLAY [actionable filter] *******************************************************

      TASK [task 1] ******************************************************************
      changed: [localhost]

      TASK [task 2] ******************************************************************
      changed: [localhost]

      RUNNING HANDLER [handler] ******************************************************

      TASK [task 6] ******************************************************************
      changed: [localhost]

      PLAY RECAP *********************************************************************
      localhost                  : ok=8    changed=3    unreachable=0    failed=0

AFTER
-----

      PLAY [actionable filter] *******************************************************

      TASK [task 1] ******************************************************************
      changed: [localhost]

      TASK [task 2] ******************************************************************
      changed: [localhost]

      RUNNING HANDLER [handler] ******************************************************
      changed: [localhost]

      PLAY RECAP *********************************************************************
      localhost                  : ok=8    changed=3    unreachable=0    failed=0
2016-05-03 11:25:46 -04:00
James Pic
d72a03deae Add get_distribution_Archlinux (#15696) 2016-05-03 08:20:08 -07:00
Toshio Kuratomi
fff94551a1 Update core submodule ref to fix docs build 2016-05-03 07:53:27 -07:00
Toshio Kuratomi
3f104dcee9 Add a jsonarg type to arg spec (#15701)
This makes sure that if we get a list or dict that it is turned into
a jsonified string.
2016-05-03 10:21:00 -04:00
Brian Coca
e0573d3099 make vi the default editor if no EDITOR
fixes #15577
2016-05-03 09:39:19 -04:00
James Cammarata
c6a9d20b5c Merge pull request #15689 from axelspringer/include_fix
Restore Ansible 2.0 compatibility for include:
2016-05-03 09:18:13 -04:00
Martin Matuska
5ee38617b9 Treat "static: yes/no" with higher priority than "task_includes_static" in ansible.cfg 2016-05-03 12:15:13 +02:00
Toshio Kuratomi
c42501cfe7 Update submodule refs 2016-05-02 11:31:06 -07:00
Toshio Kuratomi
81019e03fc Update submodule refs 2016-05-02 10:05:02 -07:00
Martin Matuska
438ed70a43 Restore Ansible 2.0 compatibility for includes 2016-05-02 17:50:42 +02:00
jctanner
eb31faa7f5 Remove the ziploader provided pythonpaths from the env inside run_com… (#15674)
Remove the ziploader provided pythonpaths from the env inside run_command.

Fixes #15655
2016-05-02 11:29:35 -04:00
James Cammarata
1fc44e4103 Don't fail hosts when using any_errors_fatal when ignoring errors
Fixes #15431
2016-05-01 12:40:09 -04:00
Yannig
3901556b35 When var name is the same as var content, try to template it before reporting that var is not defined. (#13629)
* When var name is the same as var content, try to template it before reporting that var is not defined.
Add asserts in test_var_blending to check this special corner case.

* Fix integration tests when using debug with list or dict.
2016-05-01 06:42:09 -07:00
Toshio Kuratomi
f39ad1f13a Get rid of logentries.to_unicode.
It wasn't doing anything that a literal couldn't do and used
unicode_escape which only understands latin1 (The author of the code
seems to have thought it took an encoding argument but it looks like
that was silently ignored.)
2016-04-30 07:45:51 -07:00
Toshio Kuratomi
aec74b4b65 Fix inventory on python3 2016-04-30 07:28:41 -07:00
Toshio Kuratomi
b8a988e922 bytes when passing to os.path.* and opening the file, text at other times
Fixes #15644
2016-04-29 22:20:22 -07:00
Toshio Kuratomi
f61dd8c7fc Update submodule refs 2016-04-29 22:00:57 -07:00
Toshio Kuratomi
98feafb411 Fix the mapping of module_name to Locks
This was reinitialized every time we forked before so we weren't sharing
the same Locks.  It also was not accounting for modules which were
directly invoked by an action plugin instead of going through the
strategy plguins.
2016-04-29 20:47:51 -07:00
Robin Roth
1d6608e84f Dist version fix for Red Hat and more tests (#15663)
* add tests for centos6, rhel6 and rhel7

* gen_distribution_version_testcase with python2.6

* remove unused imports

* fix redhat/vmware/... parsing

* add centos7 test case
2016-04-29 13:18:50 -07:00
Brian Coca
6f4f8e6e79 fix typo 2016-04-29 15:01:25 -04:00
Toshio Kuratomi
1b78fd57b1 Merge pull request #15656 from abadger/ziploader-namespace
Fix ziploader for the cornercase of ansible invoking ansible.
2016-04-29 11:12:11 -07:00
Brian Coca
d53c4b8ae7 fixed method signature as per #15668 2016-04-29 13:13:01 -04:00
Toshio Kuratomi
487e6562ca Fix ziploader for the cornercase of ansible invoking ansible.
* Make ziploader's ansible and ansible.module_utils libraries into
  namespace packages.
* Move __version__ and __author__ from ansible/__init__ to
  ansible/release.py.  This is because namespace packages only load one
  __init__.py.  If that is not the __init__.py with the author and
  version info then those won't be available.
* In ziplaoder, move the version ito ANSIBLE_CONSTANTS.
* Change PluginLoader to properly construct the path to the plugins even
  when namespace packages are present.
2016-04-29 08:47:49 -07:00
Chris Houseknecht
361ee9d7a6 Merge pull request #15618 from chouseknecht/docker_doc_frag
Docker doc frag
2016-04-29 01:27:57 -04:00
Brian Coca
941564b366 API now connects to server lazily (#15632)
This should fix most issues with offline operation.

Fixes #14486
Fixes #13991

Alternate to #15363 and #15593
2016-04-28 23:28:02 -04:00
Dag Wieers
7af47a3886 Rename function bool() as it is a Python built-in function (#15651) 2016-04-28 14:39:35 -04:00
Toshio Kuratomi
8016f8a638 Update submodule refs 2016-04-28 07:21:05 -07:00
Toshio Kuratomi
01cd4fd06f Handle "/usr/bin/env python" style ansible_*interpreter settings.
Fixes #15635
2016-04-27 20:22:31 -07:00
Brian Coca
60c1155d50 added common azure tags fragment 2016-04-27 16:55:41 -04:00
Toshio Kuratomi
13532027ff Update submodules ref 2016-04-27 07:17:32 -07:00
Toshio Kuratomi
2583f2774d Some beginning python3 porting for urls.py 2016-04-27 07:15:51 -07:00
Toshio Kuratomi
c2efb0b7e6 Update submodule refs 2016-04-27 06:49:17 -07:00
Toshio Kuratomi
a0f397eb6c Fix traceback in fetch_urls when status code is in info as well as the error. 2016-04-27 06:49:12 -07:00
chouseknecht
9ddcf13661
Add aliases 2016-04-27 04:12:47 -04:00
chouseknecht
2e19a1d86a
Updated doc fragment to be consistent with the getting started guide. 2016-04-27 04:02:15 -04:00
Robin Roth
b861083dfb move machine_id back to Facts class 2016-04-27 09:29:39 +02:00
Robin Roth
5626c540ce refactor distribution version parsing
* split code as separate class
* split different distributions as individual functions
* keep program logic mostly identical (for now)
* increase readability, reduce complexity/indentation
* make future testing/refactoring easier
* step towards making distribution parsing independent of the Facts class
* add some changes to make facts.py python3 parsable
2016-04-27 09:15:01 +02:00
James Cammarata
8103793b55 Version bump to 2.2.0 for devel 2016-04-26 16:29:52 -04:00
nitzmahone
8c27018038 update submodule refs 2016-04-26 09:51:16 -07:00
Brian Coca
0652fa0ce6 ran dos2unix and renamed tags cannonical option 2016-04-26 11:27:01 -04:00
Toshio Kuratomi
008bde91a8 Update submodule refs 2016-04-26 07:24:27 -07:00
Rob
bc859eec7e Add shared functionality to return list of security group IDs from list of names (#15054)
* Add shared functionality to return list of security group IDs from list of security group names - this functionality can be used by nearly all ec2 modules

* Improved doc string for get_ec2_security_group_ids_from_names function
2016-04-26 09:17:36 -04:00
Chris Houseknecht
2790929e73 Fix bugs from API version 1.20 testing. (#15586) 2016-04-25 16:07:24 -04:00
Nathaniel Case
250b975704 Clarify exception handling in net modules (#15507)
* Clarify exception handling in EOS

Also modify to EOS to standardize modules. It makes vimdiff a lot less angry

* Move IOS exception handling into Cli

* Move IOS-XR exception handling into Cli

* Move JUNOS exception handling into Cli

* Move NXOS exception handling into Cli

And reorganize to make it match the other modules

* Move OpenSwitch exception handling into Cli

More speculative restructuring here
2016-04-25 16:04:19 -04:00
James Cammarata
50792f46a5 Submodule pointer update 2016-04-25 15:58:44 -04:00
Jonathan Davila
1999e71658 Added basic auth argument spec to utils (#15585) 2016-04-25 14:55:39 -04:00
Matt Davis
8bf1c53b21 winrm connection tweaks for pywinrm (#15584)
added warnings for invalid kwargs
sniff supported authtypes (for new pywinrm)
use default authtypes (for old pywinrm)
error on unsupported authtype
allow no username/password to be specified (kerb SSO)
tested w/ old and new pywinrm
hacky CLIXML parsing of stderr
2016-04-25 14:20:27 -04:00
René Moser
4e0013d161 playbook, include: fix Unexpected Exception: 'NoneType' object has no attribute 'strip' (#15574)
If `include:` statement is used without argument, we get a traceback.
2016-04-25 13:40:49 -04:00
Olivier GROSJEANNE
4647e8b74e HTTPError can also function as a non-exceptional file-like return value (#14915)
* HTTPError can also function as a non-exceptional file-like return value (the same thing that urlopen() returns)

* HTTPError - adding response to info dictionnary

* HTTPError - adding response to info dictionnary

* HTTPError - adding body response to info dictionnary
2016-04-25 13:21:45 -04:00
Jonathan Davila
f296d74329 Documentation fragment. To be used with modules that use basic auth. (#15582)
Supplies a doc fragment for:
- api_username
- api_password
- api_url
- validate_certs
2016-04-25 12:54:11 -04:00
Toshio Kuratomi
2fd7f194c8 Convert byte strings to unicode strings in our task results (#15581)
Fixes #15367
2016-04-25 12:35:25 -04:00
Robin Roth
f7c589b049 get ssh_keys without using distribution info (#15301)
* use list of possible directories directly instead of checking distribution info
* this could fail if someone has keys in one of the other directories, but there could also be custom ssh key directories, which
  are not checked at all
* this is work towards separating Facts from Distribution in facts.py
2016-04-25 12:15:35 -04:00
Darragh Bailey
be17ba67b2 Prevent race in key setup for accelerate daemon (#15299)
Ensure that initial setup in creating the key directory for ansible
accelerate mode keys, and generation/storage of the key for a
particular host are completed in a multiprocess safe manner.

Creating directories/files and then assigning permissions and contents
to them means that paths may exist and satisfy the os.path.exists()
method in python for other processes before they are usable.

Use a combination of locking around operations with use of unique named
files and an OS file system move to ensure that the conditions of
checking whether a file or directory exists, where it is potentially
created by another thread, will only succeed when the file has both the
correct contents and permissions.

Fixes #13850
2016-04-25 12:13:42 -04:00
Matt Davis
2becd79e5f Merge pull request #15314 from nitzmahone/win_reboot
add win_reboot action
2016-04-25 09:13:18 -07:00
Peter Sprygada
2f411c9aa9 fix default REST ports for http and https in openswitch (#15580)
properly uses the right default ports for http (80) and https (443)
2016-04-25 11:42:28 -04:00
Tegan Snyder
bf0da4aa3c add centrify dzdo escalation (#15219)
add dzdo context, and test
2016-04-25 11:24:26 -04:00
Adam Hamsik
2424d57868 Add sas_address and sas_device_handle to ansible disk device facts (#15201) 2016-04-25 11:22:46 -04:00
James Cammarata
1211a0fa12 Fixing the way we iterate over child states for tasks
Previously we were first checking the fail/run state of the child
state for tasks/rescue/always portions of the block. Instead we are now
always recursively iterating over the child state and then evaluating
whether the child state is failed or complete before changing the failed/
run state within the current block.

Fixes #14324
2016-04-25 11:13:44 -04:00
Brian Coca
0f9eaedfa9 added missing alias to docker doc fragment 2016-04-25 10:20:59 -04:00
Toshio Kuratomi
87d2345cf5 Merge pull request #15562 from abadger/ziploader-minor
Quite a few individually minor changes to ziploader
2016-04-25 06:59:22 -07:00
Toshio Kuratomi
bdd73e31dc Have test-module clean up the local temp dir when it exits
Get test-module's debugger switch to do something useful with ziploader modules
2016-04-24 20:44:42 -07:00
Toshio Kuratomi
3ffd55ce7f Don't include "ansible" in the module output as there are a few files in the upper directory (args and the module) 2016-04-24 20:42:14 -07:00
Toshio Kuratomi
3c135ef3f2 Push debug files into a subdirectory to keep things cleaner.
We now have the ansible module directory, ansible_module_*.py script
file and the args file.  Makes sense to push them all into a separate
subdir.
2016-04-24 20:42:14 -07:00
Toshio Kuratomi
e9553c975f Add debug usage to comments in the ziploader wrapper and don't strip comments if ANSIBLE_KEEP_REMOTE_FILES=1 2016-04-24 20:42:13 -07:00
Peter Sprygada
03a77e025d Merge pull request #15569 from privateip/local_action_junos_template
updates action plugin junos_template to guess file format
2016-04-24 13:13:34 -04:00
Peter Sprygada
a1a732e24d updates action plugin junos_template to guess file format
This update will attempt to guess the file format based on the template
extension if the format argument isnt set.  It will also set the commit
comment to the task name if the comment isnt' explicitly defined.
2016-04-24 11:41:00 -04:00
Peter Sprygada
ffd42118d9 Revert "add new action plugin junos_config" 2016-04-24 10:34:29 -04:00
Peter Sprygada
cea6d858bc Merge pull request #15566 from privateip/junos
adds config_format to junos shared module
2016-04-24 08:57:08 -04:00
Peter Sprygada
c4bd1c5a33 Merge pull request #15553 from privateip/local_action_junos_config
add new action plugin junos_config
2016-04-24 08:25:30 -04:00
Peter Sprygada
c87300f9e7 adds check on config_format kwarg in junos
This adds a check to validate the arugment for config_format kwarg in
get_config.  If the specified format is not a valid option, the shared
module will call fail_json
2016-04-24 08:20:14 -04:00
Peter Sprygada
61baf41edc Merge pull request #5 from dgarros/pyez
Add options to get_config to accept format (text, set or xml)
2016-04-24 08:18:10 -04:00
Peter Sprygada
2c90472609 Merge pull request #15410 from privateip/junos
adds support for netconf to junos shared module
2016-04-24 06:57:18 -04:00
Toshio Kuratomi
44e21f7062 Allow AnsibleModules to be instantiated more than once in a module
Fix SELINUX monkeypatch in test_basic
2016-04-23 14:04:45 -07:00
chouseknecht
dc9b784432
Update per PR comments. 2016-04-23 12:47:16 -04:00
chouseknecht
8dc04770b6 Fix syntax error 2016-04-23 12:46:47 -04:00
chouseknecht
48a2165310 Adding docker_common util module. 2016-04-23 12:46:47 -04:00
Toshio Kuratomi
d7189a442e ziploader currently needs absolute imports to know whether to include another module 2016-04-23 07:25:21 -07:00
Yannig Perre
72f17f3ff3 New get_all_subclasses function in basic modules and use it in fact modules. 2016-04-23 07:24:26 -07:00
Yannig Perre
eb18767f91 Visit all network class not just direct sub classes.
Fix for https://github.com/ansible/ansible/issues/15446
2016-04-23 07:24:26 -07:00
Toshio Kuratomi
09605ce806 Fix facts for the FieldAttribute list change in 30a38f9 2016-04-22 16:31:53 -07:00
Peter Sprygada
edbdf0d955 add new action plugin junos_config
This adds a new action plugin for junos for working with the junos configuration
file on the remote device
2016-04-22 15:48:51 -04:00
Peter Sprygada
32329b493d adds support for netconf to junos shared module
Netconf support is provided using the junos-eznc library and the shared
module depends on junos-eznc to be installed on the local Ansible host.  This
commit also adds changes to the netcfg library to handle receiving messages
over netconf.

To use netconf, specify transport=netconf for junos module.  Be sure that
netconf has been enabled on the remote device.
2016-04-22 15:28:53 -04:00
James Cammarata
30a38f94ce Create a special class of list FieldAttribute for splitting on commas
Which we're use on a case-by-case basis if we find people were actually
using comma-separated strings for list values outside of hosts. Support
for doing so is now deprecated and users should instead use the full
YAML syntax for lists of values.

Fixes #15291
2016-04-22 14:21:14 -04:00
Toshio Kuratomi
fcd6d7010d Fixup perms dont rely on privileged user named root (#15482)
* Don't rely on username to check for root privileges

The SSH username isn't a reliable way to check if we've got root privileges on
the remote system (think "toor" on FreeBSD). Because of this check, Ansible
previously tried to use the fallback solutions for granting file access (ACLs,
world-readable files) even on systems where it had root privileges when the
remote username didn't match the literal string "root".

Instead of running checks on the username, just try using `chmod` in any case
and fall back to the previous "non-root" solution when that fails.

* Fail if we are root and changing ownership failed

Since this code is security sensitive we document exactly the expected
permissions of the temporary files once this function has run.  That way
if a flaw is found in one end-result we know more precisely what scenarios
are affected and which are not.
2016-04-22 08:40:34 -07:00
jctanner
76f73dc81f Change the raw module's detection of environment settings. (#15535)
The task_vars datastructure always contains an environment key,
so use the _task.environment property to look for a non-empty
list instead.
2016-04-21 22:58:07 -04:00
chouseknecht
a79e9182e1
Set the name of the user_agent in each mangement client. 2016-04-21 17:51:28 -04:00
Kei Nohguchi
9d5b4fe212 openswitch.py: Use new ops.dc declarative Config(DC) module (#15489)
Instead of using the old OpenSwitch runconfig, we'll use
Mir's new ops.dc declarative config for the DC interaction
with OpenSwitch.  This gives us the clearer separation between
ansible and the OpenSwitch, as well as the performance
improvement done inside the ops.dc module itself.

Squashed the original Mir's change into single commit.

Tested-by: Kei Nohguchi <kei@nohguchi.com>
2016-04-21 17:23:43 -04:00
Brian Coca
a76531ca3a submodule ref update 2016-04-21 16:30:27 -04:00
chouseknecht
af5e4abf66
Rename azure inventory script. Fix bug preventing AD user login via environment vars. 2016-04-21 14:34:08 -04:00
James Cammarata
772d659929 Updating CHANGELOG and extras submodule pointer for new kubernetes module 2016-04-21 13:23:32 -04:00
Toshio Kuratomi
bac47f6281 Update submodule refs 2016-04-21 07:42:08 -07:00
Chris Houseknecht
ba74f5f3e5 Adding docker doc frag (#15494) 2016-04-20 13:56:19 -04:00
Brian Coca
a5d79a39d5 Ensure action plugins remove tmp dirs created (#15501)
fixes #14917
2016-04-20 13:39:12 -04:00
Matt Davis
67e6bd18e4 Merge pull request #15488 from jctanner/AMC-32
WARN if the play or the task attempts to pass environment to the raw module
2016-04-20 10:03:17 -07:00
Toshio Kuratomi
6520312a65 Update submodule refs 2016-04-20 09:17:19 -07:00