Commit Graph

1123 Commits (5ef077e58ca5bbb208bf942facd6fdf53180abfa)

Author SHA1 Message Date
willthames 5ef077e58c syslog.openlog does not cope with unicode first argument
It seems that os.path.basename(__file__) can return a unicode
string. In this case syslog.openlog fails. Forcing the result
to a string causes the resulting error to go away.
13 years ago
Dag Wieers eb36ff45b9 Make script module use raw module so it does not require python 13 years ago
Dag Wieers 988db558b3 Add return code and error output to raw module
Since we use 'raw' heavily on equipment where 'command' and 'shell' are not (yet) working (and python may need to be installed first using raw) these improvements are necessary in order to write more complex scripts (with return code handling and separated stdout/stderr).

This change includes the following changes:

 - exec_command() now returns the return code of the command
 - _low_level_exec_command() now returns a dict, including 'rc', 'stdout' and 'stderr'
 - all users of the above interfaces have been improved to make use of the above changes
 - all connection plugins have been modified to return rc and stderr
 - fix the newline problem (stdout and stderr would have excess newlines)

In a future commit I intend to add assertions or error handling code to verify the return code in those places where it wasn't done. Since only the output was available, the return code was ignored, even though we expect them to be 0.
13 years ago
Daniel Hokka Zakrisson d4c63e3300 Ensure each basedir is only added to the search path once
Fixes #1790.
13 years ago
Daniel Hokka Zakrisson 3a36c024da Make lookups being fatal up to the caller
Fixes #1769.
13 years ago
Daniel Hokka Zakrisson 97cc384ccf Set basedir to . if there isn't one
This avoids special-casing '' = '.' everywhere the basedir gets used.
Fixes #1729.
13 years ago
Daniel Hokka Zakrisson 0f1706220b Add support for using the Jinja2 built-ins such as range 13 years ago
Michael DeHaan d34e320e12 Merge pull request #1733 from dhozac/lookup-list
Make all lookup plugins accept lists as arguments
13 years ago
Michael DeHaan 04195e202d Merge pull request #1747 from njharman/alpharange
Alphabetic inventory hostname patterns.
13 years ago
Michael DeHaan 4bcdd24688 Merge pull request #1776 from junegunn/inventory-group-var-ws
Allows whitespaces around assignment operators when defining group variables
13 years ago
Junegunn Choi 8896486606 Adds comments on handling quoted group vars 13 years ago
Daniel Hokka Zakrisson c2792a936d Allow parameterized playbook includes to define complex variables
To be used like:
- include: playbook.yml
  vars:
    mylistvar:
    - item1
    - item2
13 years ago
Daniel Hokka Zakrisson b73016b881 Make all lookup plugins work with lists
Lookup plugins should accept a string or a list, and always return
a list, even if it is just one item.
13 years ago
Michael DeHaan 6350dedd7a Merge pull request #1765 from dagwieers/skip-when-no-matches
Change message when a play matches no hosts
13 years ago
Michael DeHaan ad2ab6a5dd Merge pull request #1772 from fdavis/devel
change error message on check_conditional when variable does not exist
13 years ago
Michael DeHaan 29611bdedf Merge pull request #1777 from dominis/devel
fixes #1767 parsing serial from extra_vars
13 years ago
Junegunn Choi 7fbb7e079a Fix hostname expansion bug in inventory parser 13 years ago
Nandor Sivok f31fbdff1f moving int() conversion to the play init 13 years ago
Nandor Sivok e91db5fcdc fixes #1767 parsing serial from extra_vars 13 years ago
Junegunn Choi daf797804b Allows whitespaces around assignment operators
when defining group variables
13 years ago
fdavis 7347e54b70 change error message on check_conditional when variable does not exist 13 years ago
Stephen Fromm ccca5fcd1c Ensure files created by authorized_key have correct selinux context
Three changes:
* Add set_default_selinux_context() to module_common that sets
  a file's context according to the defaults in the policy
* In atomic_replace(), set the default context for the file if
  selinux is enabled and the destination file does not exist.
* In authorized_key, set the default context when creating
  $HOME/.ssh and $HOME/.ssh/authorized_keys.  If these already
  exist, this won't touch them.
13 years ago
Dag Wieers cd930d2e34 Change message when a play matches no hosts
I guess my previous pull request was confusing, by changing the message to something we already do for tasks, it makes it more clear.

Just like we say:

    TASK: [foo bar]
    skipping: [system01]

The message now is more clear:

    PLAY [wagawaga] *******************************
    skipping: no hosts matched

It makes it clear that we are skipping the play, just as is done for a task when a condition is not met.
13 years ago
Michael DeHaan 70bb7d1e54 Merge pull request #1696 from gregorg/enhance_limit
Allow regex to be used to select hosts in addition to fnmatch pattern
13 years ago
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.
13 years ago
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.
13 years ago
Dag Wieers dd4ac46397 Import errno to avoid 'NameError: global name 'errno' is not defined'
I hit the following exception because errno is referenced but not imported.

```
fatal: [system01] => failed to parse: Traceback (most recent call last):
  File "/root/.ansible/tmp/ansible-1354644532.37-246102819320352/copy", line 782, in <module>
    main()
  File "/root/.ansible/tmp/ansible-1354644532.37-246102819320352/copy", line 117, in main
    module.atomic_replace(dest_tmp, dest)
  File "/root/.ansible/tmp/ansible-1354644532.37-246102819320352/copy", line 772, in atomic_replace
    if e.errno != errno.EPERM:
NameError: global name 'errno' is not defined
```
13 years ago
Michael DeHaan dbf5a57a5a Merge pull request #1683 from bcoca/template_override
Template override
13 years ago
Daniel Hokka Zakrisson e54b4b1c9a Ignore arguments when checking for interpreter, and re-add before use 13 years ago
Daniel Hokka Zakrisson d5a456fbcf Merge pull request #1697 from bcoca/mint
Implements multiple interpreter overrides
13 years ago
Daniel Hokka Zakrisson ffac7ce2f9 Merge pull request #1687 from dhozac/allow-grouping-in-external-inventory
Allow inventory scripts to define groups of groups and group vars
13 years ago
Dag Wieers c65c00cb34 Updated ansible version to align with RPM package 13 years ago
Michael DeHaan 5890a2a9da Release stuff 13 years ago
Michael DeHaan 9afb7c1ed0 Get ready to release 0.9 13 years ago
Jan-Piet Mens 17f31a2a79 CLI: ansible-doc shows lists of modules & module docs on command-line
check path is directory
added manpage & setup
small cleanup
shut up module_formatter in utils to avoid trace print on crud files in library
13 years ago
Daniel Hokka Zakrisson 8d309e0fa3 Allow inventory scripts to define groups of groups and group vars 13 years ago
Daniel Hokka Zakrisson b8d6dec5ad Reset notified_by list per serialized batch
Fixes the case where a handler attempts to run for every batch after any
batch has notified it, regardless of whether the current batch did.
13 years ago
Daniel Hokka Zakrisson a56e1f31fa Properly restrict hosts after 9070875 13 years ago
Daniel Hokka Zakrisson f6245e17c1 Skip evaluating only_if for BYPASS_HOST_LOOP plugins 13 years ago
Daniel Hokka Zakrisson bda08c8a1b Avoid creating temporary directory for some action plugins
This ensures we don't litter remote systems with temporary directories
that don't get cleaned up, as well as speeds things up from not having
to touch every node.
13 years ago
Daniel Hokka Zakrisson f6e7381a71 Evaluate only_if in group_by 13 years ago
Daniel Hokka Zakrisson 9070875a6f Move available hosts gathering to a common function 13 years ago
Daniel Hokka Zakrisson 5065103017 Skip already failed hosts
Fixes #1699.
13 years ago
Daniel Hokka Zakrisson c948c65bcd Template the name of the task
Broken by 1e0295c. Fixes #1698.
13 years ago
Brian Coca 2f2bd87b06 multiple _interpreter overrides with ansible_<bin>_interpreter variables, not
just for python anymore
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
13 years ago
Gregory Duchatelet dde01dabc3 Squashed commit of the following:
commit 48069adf0f
Author: Gregory Duchatelet <skygreg@gmail.com>
Date:   Tue Nov 27 10:13:08 2012 +0100

    Removing this plugin from this branch.

commit 15400fffe6
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 63c1b2e17e
Author: Gregory Duchatelet <skygreg@gmail.com>
Date:   Tue Nov 27 09:03:41 2012 +0100

    Revert pull request #1684

commit 7c2c6fee3a
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 f023a2f3df
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 c64193b4c6
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
13 years ago
Daniel Hokka Zakrisson 900790af41 Reuse inventory object created by ansible-playbook in playbook
This reduces the amount of times an inventory script has to be invoked.
13 years ago
Daniel Hokka Zakrisson d703f92077 Disable authentication methods that weren't specified 13 years ago
Stephen Fromm 6a68d3813f Set LANG in module_common.py
Add constant DEFAULT_MODULE_LANG that defaults to C.  Can be set via
environment variable ANSIBLE_MODULE_LANG or configuration variable
module_lang.  Updated test-module to have same behavior.
13 years ago
Michael DeHaan da90c5f75e Document 'when' and tweak the code to be a little more comprehensive on what is false. 13 years ago