Commit Graph

44 Commits (647cd0141cf1fff6817ed0de5c22f15c6179d3d2)

Author SHA1 Message Date
Daniel Hokka Zakrisson 647cd0141c Move all inventory script code into the script parser 2013-03-01 23:22:52 +01:00
Michael DeHaan a894791767 Slightly friendlier error on missing hosts file, slightly friendlier error on inventory script returning invalid syntax
(or if inventory is non-script and accidentally executable).
2013-02-09 11:37:55 -05:00
Brian Coca ca5f52b825 now missing hosts file gives nice message and no traceback
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
2013-02-09 11:32:18 -05: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 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
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 5dd2ec2cae Add a way to add directories to just one type of loader 2012-11-18 19:08:59 +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
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
Seth Vidal 3fcc591f18 add check that vars plugins are not handing back None 2012-10-29 12:11:57 -04: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
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 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
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
Michael DeHaan da44fb1e43 Fixes #731 by reinstating variables for inventory scripts 2012-07-30 19:26:46 -04:00
Peter Sankauskas 0188889aea Making inventory pattern matching handle group names 2012-07-30 12:51:29 -07:00
Derek Carter 547395a2be added inventory_hostname_short varible 2012-07-30 13:26:48 -04:00
Michael DeHaan 617f9dc942 Added some caching logic to improve external inventory scripts, removed some debug statements. 2012-07-22 11:53:19 -04:00
Michael DeHaan 57f12ac9e3 Using __slots__ in more places, in particular, hosts and groups, where we are apt to create a fair amount of objects. 2012-07-22 11:40:02 -04:00
Michael DeHaan ba3466af95 The following paths are now implict and optional in vars_files:
./group_vars/groupname.yml (for all groups the host is in)
./host_vars/hostname.yml (for the hostname given in the inventory)

This requires an actual inventory file, not script and the paths are relative
to the directory of the inventory file.
2012-07-20 09:43:45 -04:00
Seth Vidal 5ad9bc8833 when using -i"hostname," on the cli - don't complain about the host named "" not being a host - just clip it from the list 2012-07-18 16:56:41 -04:00
Michael DeHaan 1d8bb17785 misc code cleanup 2012-07-15 10:57:22 -04:00
Michael DeHaan 68a9adc1be Indentation cleanup (partial) 2012-07-15 09:32:47 -04:00
Daniel Hokka Zakrisson 3d5c93bf44 Allow exclusion of hosts/groups 2012-06-15 11:01:30 +02:00
Brad Olson 81591009ea Fixed Inventory.get_hosts() ignoring restriction when there are no hosts left.
get_hosts() was treating [] (meaning complete restriction, no hosts allowed)
the same as None (meaning no restriction, all hosts allowed). Fixed logic.
2012-05-30 15:34:21 -04:00
Michael DeHaan cf9ddf3a30 Reorganizing file structure. Not done. 2012-05-25 19:34:13 -04:00