Commit Graph

87 Commits (89c091d689e32d4b2075b9fe0277baa6306f5e1f)

Author SHA1 Message Date
James Tanner ba0fec4f42 Force command action to not be executed by the shell unless specifically enabled 2014-03-10 16:13:30 -05:00
Richard C Isaacson af616fe15e Rename flatten funciton.
flatten(x) is used a lot in the various lookup plugins where in each it is slightly different. This is to make this name slightly more unique.
2014-02-25 14:59:06 -06:00
Kent R. Spillner 1fcc9ff666 lookup_plugins: loop over hashes
Create a lookup plugin named dict that can be used to loop over hashes.
It converts a dict into a list of key-value pairs, with attributes named
"key" and "value."  Also adds a brief explanation and simple example to
the docs.

Signed-off-by: Kent R. Spillner <kspillner@acm.org>
2014-02-25 11:20:15 -06:00
Timur Batyrshin 658c15930e reword "except Error as e:" into "except Error, e:" to be compatible with Python 2.5 (#5852) 2014-02-03 13:00:40 -06:00
Brian Coca ff024b65b2 now with_items also accepts sets
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
2014-02-01 17:55:38 -05:00
jctanner 671b0454c6 Merge pull request #4987 from jpmens/lookup-csvfile
New lookup plugin csvreader
2014-01-14 07:17:52 -08:00
Levi Gross dc6a26123b
Fixed syntax error and removed unused imports 2013-12-25 11:04:47 -05:00
Michael DeHaan 643690ffec Remove depedency of lookup plugin on setting in ansible.cfg 2013-12-21 08:49:08 -05:00
James Tanner b8146e3bc7 Fixes #4979 Check for the correct context when inside the inventory_hostnames plugin 2013-11-25 10:57:10 -05:00
Jan-Piet Mens 252a51be91 New lookup plugin csvreader 2013-11-21 09:39:52 +01:00
James Tanner b815a09529 Fix pep8 error in password lookup 2013-11-19 16:36:18 -05:00
James Tanner f31cb7c6e8 Merge pull request #4664 from jpmens/ansible
Lookup plugin for etcd

with support for configurable etcd URL in ansible.cfg (and environment)
2013-11-12 15:29:05 -05:00
James Tanner 6e49ee6cfc Remove commented code block 2013-11-11 14:44:13 -05:00
James Tanner 288c33e286 Merge pull request #4078 from mkaluza/ansible
add 'chars' parameter to password plugin to allow custom character set
2013-11-11 14:30:49 -05:00
Alan Fairless 0824f004d9 Revised patch for more password entropy 2013-11-01 09:51:35 -05:00
Jan-Piet Mens bd5cd8e652 Lookup plugin for etcd
with support for configurable etcd URL in ansible.cfg (and environment)
2013-10-24 21:28:48 +02:00
James Tanner 242f20c297 Fixes #4402 wrong order for isinstance parameters in dnstxt.py 2013-10-17 15:43:39 -04:00
Michael DeHaan 3f968ff46a Check one more skipped scenario in with_subelements. 2013-10-09 17:14:42 -04:00
Michael DeHaan 2078518735 Allow subelements to work right with skipped results. 2013-10-09 15:55:47 -04:00
Michael DeHaan a7adc8ef4d Allow doing things like "groups.groupname" in with_nested.
Fixes #3858
2013-10-07 16:58:29 -04:00
Marcin Kałuża 6786773797 filter out qoutes since they cause random errors 2013-09-10 15:00:29 +02:00
Marcin Kałuża aab445a28f add 'chars' parameter to password plugin to allow custom character set
It accepts comma separated list of names that are
either string module attributes (ascii_letters,digits, etc)
or are used literally

To enter comma use two commas ',,' somewhere - preferably at the end
Qoutes and double qoutes are not supported
2013-09-10 11:59:16 +02:00
Serge van Ginderachter 4f9af7efad subelements lookup plugin 2013-09-09 23:45:55 +02:00
Abhijit Menon-Sen 1a90d01ba9 Fix some typos discovered during casual reading 2013-08-11 18:41:23 +05:30
Michael DeHaan 76fd769704 Merge pull request #3685 from mspaulding06/indexed_items
Indexed items lookup plugin
2013-08-03 11:36:51 -07:00
Michael DeHaan c0ab417ef9 Don't iterate across strings in with_nested. 2013-08-03 14:22:18 -04:00
Matt Spaulding 5d15515bbf Add indexed_items lookup plugin 2013-07-28 13:54:17 -07:00
Vincent Hardion 09ef7751e1 Fix nested loop for more than 3 elements
- combine flatten list for each nested level instead once at the end
2013-07-24 14:19:13 +02:00
Serge van Ginderachter b40295910d also rename plugin name in error message 2013-07-22 16:47:36 +02:00
Michael DeHaan 0cf5e5cec3 Merge branch 'devel' of git://github.com/bradleyy/ansible into together 2013-07-21 11:47:05 -04:00
Michael DeHaan f7dec4f8f4 Rename plugin. 2013-07-20 11:02:16 -04:00
Serge van Ginderachter 730b368259 Introduce flat_list lookup plugin
- hosts: localhost
    gather_facts: False
    tasks:
    - debug: msg="{{item}}"
      with_flat_list:
      - a
      - - b
        - c
        - d
        - - e
        - f
        - - g
          - h
      - i
      - j
      - - k
        - l

  # note: main list or list (sub)items can also be set as a variable

  TASK: [debug msg="{{item}}"] **************************************************
  ok: [localhost] => (item=a) => {"item": "a", "msg": "a"}
  ok: [localhost] => (item=b) => {"item": "b", "msg": "b"}
  ok: [localhost] => (item=c) => {"item": "c", "msg": "c"}
  ok: [localhost] => (item=d) => {"item": "d", "msg": "d"}
  ok: [localhost] => (item=e) => {"item": "e", "msg": "e"}
  ok: [localhost] => (item=f) => {"item": "f", "msg": "f"}
  ok: [localhost] => (item=g) => {"item": "g", "msg": "g"}
  ok: [localhost] => (item=h) => {"item": "h", "msg": "h"}
  ok: [localhost] => (item=i) => {"item": "i", "msg": "i"}
  ok: [localhost] => (item=j) => {"item": "j", "msg": "j"}
  ok: [localhost] => (item=k) => {"item": "k", "msg": "k"}
  ok: [localhost] => (item=l) => {"item": "l", "msg": "l"}
2013-07-17 13:59:41 +02:00
Bradley Young 23557b6e5a change the name from transpose to "together". Change to use itertools.izip_longest() rather than method cribbed from nested.py 2013-07-14 16:31:37 -07:00
Bradley Young ea93a36b10 Adding transpose lookup method. This will matrix transpose arrays that are passed in, and then work like items over the resulting list of lists. e.g.:
Transpose a list of arrays:
    [1, 2, 3], [4, 5, 6] -> [1, 4], [2, 5], [3, 6]
    Replace any empty spots in 2nd array with "":
    [1, 2], [3] -> [1, 3], [2, ""]
2013-07-11 23:45:03 -07:00
Michael DeHaan fc45470162 Merge branch 'with_inventory_hostnames' of git://github.com/sdossett/ansible into inv_hostnames 2013-06-19 22:01:57 -04:00
trbs 87c7fa9138 enable use of multiple terms in first_found 2013-06-19 16:37:29 +02:00
Steven Dossett e0a15d0c50 Updated to support inventory options from command line 2013-06-03 12:42:52 -04:00
Michael DeHaan b8a66ce5bb Lookup plugins in included files now look in paths relative to their files, allowing role usage. 2013-06-01 18:15:38 -04:00
Steven Dossett 1ff93e6b08 Plugin with_inventory_hostnames - loops generated from groups or
hosts in inventory
2013-06-01 11:42:44 -04:00
Maykel Moya 45f5447f9f Fix name in copyright 2013-05-16 18:49:35 +02:00
Maykel Moya 96afc3f462 Add support for crypted passwords to password lookup
Added new parameter 'encrypt' with same semantics from that of
vars_prompt. When encryption is requested a random salt will be
generated and stored along the password in the form:
'<password> salt=<salt>'.

Also store passwords with an ending '\n' for easier looking at files
with console tools. File content was being already rstripped so this
is harmless.
2013-05-16 13:24:54 +02:00
Serge van Ginderachter 7eeab168bc bug fix in first_found search path assembly 2013-05-13 13:48:56 +02:00
Michael DeHaan a78edbb45c More pep8 2013-05-11 17:26:06 -04:00
Serge van Ginderachter 53a7ab74c8 use os.path.join instead of hardcoded unix separator in first_found lookup plugin 2013-05-02 13:58:23 +02:00
Kahlil (Kal) Hodgson 9f90f0e856 fix arguments to isinstance() in env lookup 2013-04-28 14:58:26 +10:00
Michael DeHaan bd0c22868e With fileglob should return full paths as in 1.1 2013-04-23 00:54:39 -04:00
Michael DeHaan 5cced79cf3 Allow variables to be used raw in with_nested 2013-04-22 21:35:09 -04:00
Seth Vidal 7b8cec3f59 clean up first_found to fix a few issues:
- add a skip option so it won't raise an exception if you don't match anything
 - make it work as a drop-in replacement for first_available_file
 - document in the module comments all of the above cases
2013-04-18 16:47:10 -04:00
C. Morgan Hamill 88eb5516eb Fix 'sequence' plugin error.
If 'terms' is a string, replace it with a single item list.
2013-04-17 11:45:28 -04:00
C. Morgan Hamill 663d37b537 Fix errors in lookup plugins.
Lookup plugins 'sequence' and 'template' now import 'ansible.utils'
appropriately in order to use the 'listify_lookup_plugin_terms'
function.

Also, 'dnstxt' and 'env' now check to see if 'terms' is a string;
without this calls like '{{ lookup('env', 'HOME') }}' fail.
2013-04-17 11:31:38 -04:00