Commit graph

20383 commits

Author SHA1 Message Date
James Cammarata
b617d62203 Don't use an unset playbook basedir when searching for hostgroup vars
The flag new_pb_basedir is not being utilized in Inventory._get_hostgroup_vars,
leading to the situation where an inventory with no playbook basedir set will
read host/group vars from the $CWD, regardless of the inventory and/or playbook
relative location. This patch corrects that by not using the playbook basedir
if it is unset (None).

This patch also corrects a bug in which the VariableManager would accumulate
host/group vars files, which could lead to incorrect vars files being used when
playbooks are run from different directories containing their own group/host vars
directories.

Fixes #16953
2016-08-17 16:28:48 -05:00
Brian Coca
dac5af63cb corrected typo, expanded server types 2016-08-17 15:49:40 -04:00
Brian Coca
b581780283 dont do it 2016-08-17 15:45:31 -04:00
sam-at-github
a2d0bbed8c Handlers are triggered at the play level, not playbook. (#17121) 2016-08-17 10:36:33 -04:00
James Cammarata
732d722a7f Catch a missing include_vars filename
Related to ansible/ansible-modules-core#4445
2016-08-17 09:35:37 -05:00
sam-at-github
16426ad795 I think that is a better analogy. 2016-08-17 19:20:13 +10:00
Matt Davis
e0bdb502e3 raw now returns changed: true (#17112)
for consistency w/ shell/command/script "non-idempotent" modules.

Updated tests, changelog.
2016-08-16 20:39:23 -07:00
Senthil Kumar Ganesan
48df950a75 Added Dell Networking Modules to the Roadmap 2016-08-16 18:27:54 -07:00
Josh Smift
81d7e132f9 force deletion of .pyc files (#17109) 2016-08-17 00:43:10 +02:00
James Cammarata
f4237b2151 Rework the way params are assigned to TaskIncludes when they're dynamic
Copying the TaskInclude task (which is the parent) before loading the blocks
makes the code much more simple and clean, and fixes a bug introduced during
the performance improvement changes (and specifically the change which moved
things to a single-parent model).

Fixes #17064
2016-08-16 15:45:24 -05:00
Nathaniel Case
cada4fb8d1 Relicense netcfg.py to BSD (#17110)
As with #17025. The caveat regarding machilde's (now obsoleted) commit has been addressed, so netcfg.py is able to be easily relicensed.
2016-08-16 16:32:02 -04:00
Olaf Alders
8681df4b58 s/shutdown/shut down/ (#17107)
shutdown is a noun.  In the task name you really want a verb.
2016-08-16 21:02:25 +02:00
Brian Coca
297e2d8266 added bits and bytes arg types (#17102)
* added bits and bytes arg types

* changed function alias method as per feedback

* use enumerate vs managing i myself
2016-08-16 13:45:41 -04:00
Brian Coca
b1410fa278 fixed tests to accoutn for new parameter 2016-08-16 13:11:58 -04:00
Brian Coca
5fe9d3c3d5 make parsed param private and explicit (#17104)
* make parsed param private and explicit

* fixed missed parsed
2016-08-16 11:59:30 -04:00
Ryan S. Brown
30268f6bd0 Pass keyword arguments from modules to _boto3_conn 2016-08-16 07:56:20 -04:00
Scott Butler
124c1e3d27 Added substitution definitions and references for version number, etc 2016-08-15 17:48:46 -07:00
James Tanner
f62df4e78d Update submodule refs 2016-08-15 20:01:24 -04:00
scottb
89ce1fc917 Merge pull request #17051 from ferrants/patch-2
Update playbooks_lookups.rst
2016-08-15 12:30:44 -07:00
James Cammarata
f722d41eab Allow notifies to be sent to the top level includes when they were static
Since we introduced static includes in 2.1, this broke the functionality
where a notify could be sent to a named include statement, triggering all
handlers contained within the include. This patch fixes that by adding a
search through the parents of a handler for any TaskIncludes which match.

Fixes #15915
2016-08-15 14:22:35 -05:00
Ryan Brown
c5cc6edb93 Merge pull request #16606 from ryansb/rds-cluster-inventory-aioue
Support RDS clusters in AWS dynamic inventory script
2016-08-15 15:08:55 -04:00
Ryan S. Brown
0783c172d7 Paginate DB cluster responses in AWS RDS dynamic inventory 2016-08-15 14:27:48 -04:00
David Shrewsbury
bf8c871801 Fix async logic when parsing fails (#17091)
We want to NOT consider the async task as failed if the result is
not parsed, which was the intent of:

  https://github.com/ansible/ansible/pull/16458

However, the logic doesn't actually do that because we default
the 'parsed' value to True. It should default to False so that
we continue waiting, as intended.
2016-08-15 13:29:06 -04:00
James Tanner
1f5552f586 Update submodule refs 2016-08-15 13:02:07 -04:00
James Cammarata
daf6eb97d3 Make sure includes for handlers in roles look in the correct subdir 2016-08-15 10:08:11 -05:00
Brian Coca
64a8d24b72 slightly better presentation docs
- description items are now separated
- choices/defaults start at their own line
2016-08-15 11:00:29 -04:00
Tim Whittington
b3c686f4c5 Note that to_nice_yaml(indent=X) was new in 2.2 (#17085)
The ability to pass indent parameter to to_nice_yaml was introduced in 2.2, but this is not noted in the docs.
2016-08-15 10:41:55 -04:00
Ted Timmons
f4bd38a153 document what glob style is used (#17080)
Took some digging to find that `with_fileglob` calls a method named `fileglob()`, which uses Python's `glob` library.
2016-08-15 09:38:27 -04:00
Brian Coca
4c034fd002 updated container detection to new lxc (#17063)
fixes #17030
2016-08-15 09:15:01 -04:00
Peter Sprygada
8620fda947 Merge pull request #17077 from agaffney/junos_doc_fix
Update junos docs fragment to note the default port for transport=netconf
2016-08-15 05:19:22 -04:00
John R Barker
a8a8ef4682 2.1 has been released
Also link to new feature documentation - We need to do more of this

Thanks to kustodian for suggesting this
2016-08-15 10:10:22 +01:00
James Cammarata
3c65c03a67 Changing license on module_utils/splitter.py to BSD 2016-08-13 09:56:12 -05:00
Andrew Gaffney
fdabfb6821 Update junos docs fragment to note the default port for transport=netconf 2016-08-13 14:52:06 +00:00
James Cammarata
c669a381d1 Don't immediately return failed for any_errors_fatal tasks
Instead of immediately returning a failed code (indicating a break in
the play execution), we internally 'or' that failure code with the result
(now an integer flag instead of a boolean) so that we can properly handle
the rescue/always portions of blocks and still remember that the break
condition was hit.

Fixes #16937
2016-08-12 14:18:50 -05:00
Matt Clay
b44eb402bd Update ansible-core-ci endpoint. (#17071) 2016-08-12 12:07:41 -07:00
scottb
7eed464db0 Merge pull request #17061 from nickmisasi13/patch-1
Update developing_inventory.rst
2016-08-12 11:25:24 -07:00
Dag Wieers
cb5675a29f Remove a useless section, only act on 'shell' (#16205) 2016-08-12 10:13:02 -07:00
Matt Clay
4cee67452b Update submodule refs. 2016-08-12 07:20:01 -07:00
jctanner
da23700b15 Update submodule refs (#17062) 2016-08-12 10:05:06 -04:00
Dag Wieers
56148291e9 Emit warnings when safe_eval() raises a SyntaxError or other Exception (#14304)
This change is related to reported issue #14291 and pull request #14293.

Without the fix from #14293, this change will emit a warning as shown below, on the following playbook:

``yaml
---
- hosts: localhost
  gather_facts: no
  vars:
    works:
      key1: 'string'
      key2: 1234
    fails:
      key1: 'string'
      key2: 1234
      key3: false
  tasks:
  - debug: msg={{ works | to_json }}
  - debug: msg={{ fails | to_json }}
```

On error, this results in a proper warning:

```
[dag@moria ansible.dag]$ ansible-playbook test49.yml

PLAY ***************************************************************************

TASK [debug] *******************************************************************
ok: [localhost] => {
    "msg": {
        "key1": "string",
        "key2": 1234
    }
}

TASK [debug] *******************************************************************
 [WARNING]: Error in expression "{"key3": false, "key2": 1234, "key1": "string"}". (name 'false' is not defined)

ok: [localhost] => {
    "msg": "{\"key3\": false, \"key2\": 1234, \"key1\": \"string\"}"
}

PLAY RECAP *********************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=0
```
2016-08-12 09:29:54 -04:00
nickmisasi13
85dd9aa4ec Update developing_inventory.rst
Changed a misleading line from returning to printing
2016-08-12 08:49:30 -04:00
Dag Wieers
1268f4778d Introduce new 'filetree' lookup plugin (#14332)
* Introduce new 'filetree' lookup plugin

The new "filetree" lookup plugin makes it possible to recurse over a tree of files within the task loop. This makes it possible to e.g. template a complete tree of files to a target system with little effort while retaining permissions and ownership.

The module supports directories, files and symlinks.

The item dictionary consists of:
 - src
 - root
 - path
 - mode
 - state
 - owner
 - group
 - seuser
 - serole
 - setype
 - selevel
 - uid
 - gid
 - size
 - mtime
 - ctime

EXAMPLES:
Here is an example of how we use with_filetree within a role:

```yaml
 - name: Create directories
   file:
     path: /web/{{ item.path }}
     state: directory
     mode: '{{ item.mode }}'
     owner: '{{ item.owner }}'
     group: '{{ item.group }}'
     force: yes
   with_filetree: web/
   when: item.state == 'directory'

 - name: Template complete tree
   file:
     src: '{{ item.src }}'
     dest: /web/{{ item.path }}
     state: 'link'
     mode: '{{ item.mode }}'
     owner: '{{ item.owner }}'
     group: '{{ item.group }}'
   with_filetree: web/
   when: item.state == 'link'

 - name: Template complete tree
   template:
     src: '{{ item.src }}'
     dest: /web/{{ item.path }}
     mode: '{{ item.mode }}'
     owner: '{{ item.owner }}'
     group: '{{ item.group }}'
     force: yes
   with_filetree: web/
   when: item.state == 'file'
```

SPECIAL USE:
The following properties also have its special use:

 - root: Makes it possible to filter by original location
 - path: Is the relative path to root
 - uid, gid: Makes it possible to force-create by exact id, rather than by name
 - size, mtime, ctime: Makes it possible to filter out files by size, mtime or ctime

TODO:
 - Add snippets to documentation

* Small fixes for Python 3

* Return the portion of the file’s mode that can be set by os.chmod()

And remove the exists=True, which is redundant.

* Use lstat() instead of stat() since we support symlinks

* Avoid a few possible stat() calls

* Bring in line with v1.9 and hybrid plugin

* Remove glob module since we no longer use it

* Included suggestions from @RussellLuo

- Two blank lines will be better. See PEP 8
- I think if props is not None is more conventional 😄

* Support failed pwd/grp lookups

* Implement first-found functionality in the path-order
2016-08-11 23:33:54 -04:00
Jim Ladd
329a134cb3 Increase local version for unofficial rpms (#17026) 2016-08-11 17:36:03 -07:00
Matt Davis
525c0469d2 tweak hacking/env-setup to work under ash (#17054) 2016-08-11 16:58:08 -07:00
jctanner
39d764c7ad Restore previous behavior of ignoring missing files via with_fileglob (#17053)
Fixes #16801
2016-08-11 19:55:21 -04:00
Matt Clay
901042f458 Generate test script to file instead of stdout. 2016-08-11 15:42:43 -07:00
Matt Clay
2b0d63b0d8 Flush stderr to avoid lost output. 2016-08-11 15:14:22 -07:00
James Cammarata
925b0ff9e9 cleaning up some debug statements in _queue_task() 2016-08-11 14:26:28 -05:00
James Cammarata
1c7e0c73c9 Several fixes for includes
* when including statically, make sure that all parents were also included
  statically (issue #16990)
* properly resolve nested static include paths
* print a message when a file is statically included

Fixes #16990
2016-08-11 14:07:49 -05:00
Toshio Kuratomi
854d47826c Fix classes that select a subclass based on platform (#17034)
When unittesting this we found that the platform selecting class
hierarchies weren't working in all cases.  If the subclass was directly
created (ie: LinuxHardware()), then it would use its inherited __new__()
to try to create itself.  The inherited __new__ would look for
subclasses and end up calling its own __new__() again.  This would
recurse endlessly.  The new code detects when we want to find a subclass
to create (when the base class is used, ie: Hardware()) vs when to
create the class itself (when the subclass is used, ie:
LinuxHardware()).
2016-08-11 13:26:17 -04:00