Commit Graph

70 Commits (b749af0b103c57c5a6f13719f6e25b7e35c1d8b8)

Author SHA1 Message Date
Daniel Hokka Zakrisson 6f9099c51d Merge pull request #1898 from silviud/fix_inventory_list_groups
Inventory class - lambda fails on attribute access - g.name is a string not the group obje...
2013-01-25 08:35:03 -08:00
Michel Blanc e28e538c6e Adds user-selectable hash merging support in vars
Hash variables are currently overriden if they are redefined. This
doesn't let the user refine hash entries or overriding selected keys,
which can, for some, be a desirable feature.
This patch let the user force hash merging by setting the
hash_behaviour value to "merge" (without the quotes) in ansible.cfg

However, by default, ansible behaves like it always did and if any value
besides "merge" is used ("replace" is suggested in the example ansible.cfg
file), it will also behave as always.
2013-01-23 21:39:34 +01:00
Silviu Dicu f7694ac433 lambda fails on attribute access - g.name is a string not the group object 2013-01-23 11:44:23 -05:00
Daniel Hokka Zakrisson c23eda82c2 Allow pattern[0] to address a single node
Replaces erroring out on it and requiring the abysmal pattern[0-0]
instead.
2013-01-07 18:20:09 +01:00
Michael DeHaan 04195e202d Merge pull request #1747 from njharman/alpharange
Alphabetic inventory hostname patterns.
2012-12-17 16:52:11 -08:00
Michael DeHaan 4bcdd24688 Merge pull request #1776 from junegunn/inventory-group-var-ws
Allows whitespaces around assignment operators when defining group variables
2012-12-17 16:51:49 -08:00
Junegunn Choi 8896486606 Adds comments on handling quoted group vars 2012-12-16 10:32:05 +09:00
Junegunn Choi 7fbb7e079a Fix hostname expansion bug in inventory parser 2012-12-16 01:49:12 +09:00
Junegunn Choi daf797804b Allows whitespaces around assignment operators
when defining group variables
2012-12-14 20:43:29 +09:00
Michael DeHaan 70bb7d1e54 Merge pull request #1696 from gregorg/enhance_limit
Allow regex to be used to select hosts in addition to fnmatch pattern
2012-12-12 14:51:44 -08:00
Daniel Hokka Zakrisson 54b45e9bd4 Allow intersecting host patterns by using &
This allows patterns such as webservers:!debian:&datacenter1 to target
hosts in the webservers group, that are not in the debian group, but are
in the datacenter1 group. It also parses patterns left to right.
2012-12-12 11:36:12 +01:00
Norman J. Harman Jr 6603737e4d Alphabetic inventory hostname patterns.
- Code, docs, tests.
  - Also added test of large range 000-142 to verify alpha range did not
    break this.
2012-12-10 20:48:38 -06:00
Daniel Hokka Zakrisson 8d309e0fa3 Allow inventory scripts to define groups of groups and group vars 2012-11-28 23:37:29 +01:00
Gregory Duchatelet dde01dabc3 Squashed commit of the following:
commit 48069adf0f47b09f675a9ba59360ca216b695ceb
Author: Gregory Duchatelet <skygreg@gmail.com>
Date:   Tue Nov 27 10:13:08 2012 +0100

    Removing this plugin from this branch.

commit 15400fffe643ad3e66d6b5a296fe62d36d9a617a
Author: Gregory Duchatelet <skygreg@gmail.com>
Date:   Tue Nov 27 09:53:16 2012 +0100

    Enhance _match function in inventory with regex.
    --limit ~regex could be used to filter hosts or group with a regex.
    Tested on cli and ansible-playbook.

commit 63c1b2e17ec6daa282e0a3af2249bda8f734dcd3
Author: Gregory Duchatelet <skygreg@gmail.com>
Date:   Tue Nov 27 09:03:41 2012 +0100

    Revert pull request #1684

commit 7c2c6fee3a856c52c1960b96ec2e7ca1112c35a1
Merge: f023a2f dd5a847
Author: Gregory Duchatelet <skygreg@gmail.com>
Date:   Tue Nov 27 08:52:53 2012 +0100

    Merge remote branch 'upstream/devel' into devel

commit f023a2f3df4a4c2ab2dfcc5aa42c57c02358a47a
Author: Gregory Duchatelet <skygreg@gmail.com>
Date:   Mon Nov 26 20:52:27 2012 +0100

    Add an inventory plugin to fetch groups and host from our CMDB.

commit c64193b4c67053e6e197b89c7143b9770cf71f23
Author: Gregory Duchatelet <skygreg@gmail.com>
Date:   Mon Nov 26 20:43:30 2012 +0100

    Added possibility to filter hosts from a group, with a regex, separating
    groupname and regex with a ~
    Usage in group pattern: group~filterpattern
    Samples:
    ansible group~server-0[1236] -m ping
    ansible web~proxy -m ping
    ansible web~(proxy|frontend) -m ping
2012-11-27 16:36:58 +01:00
Daniel Hokka Zakrisson 0c70abfaa9 Make sure any existing groups gets reused 2012-11-25 12:42:30 +01:00
Daniel Hokka Zakrisson 5504f13c68 Create groups in the first run through the file
Fixes #1208.
2012-11-25 01:00:14 +01:00
Daniel Hokka Zakrisson 2bfb7deec0 Set all in the returned dict
Otherwise the group is lost, and group_vars/all isn't used.
2012-11-25 00:15:22 +01:00
Daniel Hokka Zakrisson 715d875dcb Group should only return its own variables
Otherwise, a host in two groups, A and B, using a variable defined
in group A and all will get the value of all, as B's variables will
include the all variable.

Partially fixes #1647.
2012-11-23 00:54:07 +01:00
Daniel Hokka Zakrisson bd7e02d629 Get all groups' variables in order of depth
Fixes all not being processed, as well as the order of the variable
precedence
2012-11-23 00:20:52 +01:00
Daniel Hokka Zakrisson 5dd2ec2cae Add a way to add directories to just one type of loader 2012-11-18 19:08:59 +01:00
Daniel Hokka Zakrisson 17e4ce97a4 Create a set of all the hosts in a group to prevent duplicates
Fixes #1516.
2012-11-14 13:35:21 +01:00
Dag Wieers c9e62d7061 Fix for an exception when for whatever reason the inventory script fails
This avoids a traceback that gave no clue as to what was happening.

This is in line with the change from #1535
2012-11-07 15:16:00 +01:00
Dag Wieers 89206a6b68 Fix for an exception when for whatever reason the inventory script fails
This avoids a traceback that gave no clue as to what was happening.
2012-11-06 16:39:10 +01:00
Daniel Hokka Zakrisson e05e514861 Create a plugin loader system 2012-11-02 01:24:14 +01:00
Michael DeHaan c0747b7baa pep8 fixes 2012-10-30 20:42:07 -04:00
Michael DeHaan 9a12873166 Merge pull request #1477 from skvidal/devel
add check that vars plugins are not handing back None
2012-10-29 16:02:26 -07:00
Seth Vidal 3fcc591f18 add check that vars plugins are not handing back None 2012-10-29 12:11:57 -04:00
Dag Wieers 3728b2f459 Missing errors-import causes traceback 2012-10-29 15:16:26 +01:00
Michael DeHaan 6ba30170dd Make group_vars and host_vars available to usr/bin/ansible, and make vars_plugins exist 2012-10-26 19:55:59 -04:00
Seth Vidal d63fa6f026 make --limit take a , as a separator as well as ; or : 2012-10-22 21:24:25 -04:00
Daniel Hokka Zakrisson b8021f12e0 Raise error for missing hosts in inventory scripts as well 2012-10-19 16:26:12 +02:00
Michael DeHaan a69e59ab2b Allows delegate_to to use inventory host/port info. 2012-10-16 20:57:37 -04:00
Jeroen Hoekx 23a62f5a78 Return multiple groups from inventory API. 2012-10-10 18:35:45 +02:00
Peter Sankauskas 8a4e969b93 Getting negative host pattern matching to work with external inventory
(same as commit 4caf85e37b, but for
excluded hosts as well as subsets)
2012-09-25 16:16:25 -07:00
Michael Lambert 29ac1a8efc Replace os.access with stat calls for determining the executability of a given path. 2012-09-24 21:03:45 -04:00
Michael DeHaan 58ad934283 Merge pull request #1024 from tima/groups-pb
Made $groups and $group_names variables accessible in with_items
2012-09-11 14:59:05 -07:00
John Kleint 1f8696f5c1 Fix inventory.get_hosts when hosts is a list. 2012-09-11 13:00:40 -04:00
Timothy Appnel 20fc6a29d3 Made groups.groupname and group_names variables accessible in playbooks. 2012-09-07 18:07:52 -04:00
Michael DeHaan f140332ff6 Make it possible in the inventory file to have spaces in host variables 2012-08-30 19:51:46 -04:00
Michael DeHaan 4caf85e37b Fix --limit for external inventory scripts, slight variant on fix from pull #949 2012-08-27 21:49:12 -04:00
Michael DeHaan 898d7676f7 Adds the 'serial' keyword to a playbook which controls how many hosts can be running through a playbook at a single time.
The default is 0, which means all hosts.  If set to 1, each host would run a playbook all the way through before moving
on the next host.  Fact gathering is still parallel, regardless of the serial setting.
2012-08-18 09:52:13 -04:00
Michael DeHaan 6de8c27085 Load parent groups when processing group_vars 2012-08-14 19:48:33 -04:00
Michael DeHaan 9041adddaa Add support for ranged patterns like webservers[0-49] for hitting the first 50 webservers. 2012-08-11 13:49:18 -04:00
Michael DeHaan 72faf8eb0a fix indents 2012-08-11 12:20:16 -04:00
Michael DeHaan d1ad1d2508 remove stray print 2012-08-11 11:41:40 -04:00
Michael DeHaan 259f2dc4de Various retooling of the internal code behind inventory pattern matching in support of pending support
for host ranges.
2012-08-11 11:36:59 -04:00
Michael DeHaan 1c81ddf8d4 add the limit option, which can be used to further confine the patterns selected by "hosts:" in ansible-playbooks
to an additional pattern (a subset) specified on the command line.  For instance, a playbook could be reusable
and target "webservers" and "dbservers", but you want to test only in the stage environment, or a few boxes at a time.
2012-08-10 02:45:29 -04:00
Dave Peticolas 08272dc25d Remove unused imports. 2012-08-09 21:35:22 -07:00
Michael DeHaan faed4b5a33 whitespace + remove deprecated YAML parser (migration script lives in examples/scripts and warning was added
in 0.6 release)
2012-08-06 20:07:02 -04:00
Ahmad Khayyat 6728b6cdda Allow = symbols in variable values in host inventory 2012-07-31 23:36:26 -04:00