Commit graph

928 commits

Author SHA1 Message Date
Michael DeHaan
9778eaf4f9 Merge branch 'module_args-argument' of git://github.com/dhozac/ansible into devel 2012-09-24 20:39:48 -04:00
Dag Wieers
4e9a970616 Add an only_if option to vars_prompt to make prompts conditional
Sometimes you may want to allow variables through host_vars or inventory, but prompt for a value if it is not set or if the value does not conform to something specific. This option allows you to specify when you want to offer a prompt.

This patch also moves check_conditional to utils, and adds an is_unset() function which is nicer to read:

    only_if: "not is_set('${var}')"

vs

    only_if: "is_unset('${var}')"
2012-09-24 23:55:54 +02:00
Michael DeHaan
b355dca7dd Merge pull request #1081 from dsummersl/changelabel
Modified 'ok' to 'changed' when a change has occured
2012-09-24 13:46:06 -07:00
Dag Wieers
069feb5d9c Template the variable prompt to customize the message
We have a password-prompt for a configurable login name. Since we require to ask the password for this specific login, it is important to indicate what password needs to be prov ided on the prompt. So the prompt needs to be templated. That's what this patch does.
2012-09-24 22:37:51 +02:00
Dane Summers
04c535b1e9 Modified 'ok' to 'changed' when a change has occured 2012-09-24 16:07:56 -04:00
Daniel Hokka Zakrisson
34f7e6ffa0 Pass module arguments as argument instead of keeping it in runner 2012-09-23 23:38:26 +02:00
Michael DeHaan
3939f7a812 Merge pull request #1076 from SleeplessAnnoyedNerd/Issue-1075
[Issue #1075] Fixing setup module fails if PATH is not set on target hos...
2012-09-23 10:23:18 -07:00
Michael DeHaan
f5f17e98ff Merge pull request #1065 from dhozac/varreplace-include
Allow including files through variables
2012-09-23 10:20:26 -07:00
Dietmar Schinnerl
78b7a3a115 [Issue #1075] Fixing setup module fails if PATH is not set on target host 2012-09-22 17:01:37 +02:00
Daniel Hokka Zakrisson
8d97bb4f8e Add an ansible_ssh_host inventory variable 2012-09-22 00:57:55 +02:00
Michael DeHaan
4ded8cb3b3 Change $FILE{} and $PIPE{} to $FILE() and $PIPE() 2012-09-19 17:58:16 +02:00
Daniel Hokka Zakrisson
cc948f339c Allow including files through variables
$FILE{file} will be replaced with the contents of "file"
$PIPE{cat file} will be replaced with the output of "cat file"
2012-09-19 17:57:17 +02:00
Michael DeHaan
b8c4bb9e6e Revert "Allow including files through variables"
This reverts commit bf47bb4753.

Conflicts:

	lib/ansible/utils.py
	test/TestUtils.py
2012-09-19 10:31:23 -04:00
Michael DeHaan
b2af95e4a6 Change $FILE{} and $PIPE{} to $FILE() and $PIPE() 2012-09-18 21:34:55 -04:00
Michael DeHaan
b25b9fd840 Merge pull request #1058 from jkleint/devel
Support iteration over command output in with_items.
2012-09-18 17:55:40 -07:00
Michael DeHaan
544a8e44d7 Merge pull request #1053 from dhozac/varreplace-include
Allow including files through variables
2012-09-18 17:53:02 -07:00
John Kleint
2a002f5c0b Support iteration over command output in with_items.
When the output of a command is stored in a register, this will create a
stdout_lines field in the result object that contains stdout split into a list
of lines.  This list can then be iterated over using with_items.
2012-09-17 16:57:33 -04:00
Daniel Hokka Zakrisson
dd11b01350 Keep delegate_to so all auxiliary logic based on that works 2012-09-17 20:28:14 +02:00
Daniel Hokka Zakrisson
5bb0f6908b Allow transport on tasks, and use it for local_action 2012-09-17 18:28:37 +02:00
Daniel Hokka Zakrisson
bf47bb4753 Allow including files through variables
$FILE{file} will be replaced with the contents of "file"
$PIPE{cat file} will be replaced with the output of "cat file"
2012-09-17 16:03:59 +02: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
Michael DeHaan
1829d519b5 Merge pull request #1030 from lorin/import-playbook-pathfix
Support import of playbooks in other directories
2012-09-11 14:58:27 -07:00
Michael DeHaan
d7f83471ae Merge pull request #1032 from mavimo/patch-2
Add support for ./ansible.cfg file
2012-09-11 14:56:22 -07:00
John Kleint
1f8696f5c1 Fix inventory.get_hosts when hosts is a list. 2012-09-11 13:00:40 -04:00
Marco Vito Moscaritolo
0cdd081b53 Add support for ./ansible.cfg file
Ansible support configuration in:
```
~/.ansible.cfg
/etc/ansible/ansible.cfg
```

this patch add current user (usefull where user have some different projects) with the oreder:
```
./ansible.cfg
~/.ansible.cfg
/etc/ansible/ansible.cfg
```
2012-09-10 17:57:32 +03:00
Timothy Appnel
9d5a79f586 Made groups.groupname and group_names variables accessible in playbooks.
Also modified code that feeds the groups data structure to templates so
that it resolves groups inside of groups to hostnames.
2012-09-10 10:42:26 -04:00
Lorin Hochstein
b9e100a506 Support import of playbooks in other directories
Previously, importing a playbook in a different directory didn't
work because all of the relative paths were resolved relative to
the top-level playbook.

This patch resolves relative paths on a per-play level instead of
relative to the directory of the top-level playbook.

Also removes the dirname argument from the Play._get_vars method
since this argument wasn't used in the metho dbody.
2012-09-09 22:59:56 -04:00
Michael DeHaan
e795fa1ec2 Merge pull request #1014 from marktheunissen/journald
Fix regex that allows passwords to get into syslog, use journal if available.
2012-09-08 05:22:27 -07:00
Timothy Appnel
20fc6a29d3 Made groups.groupname and group_names variables accessible in playbooks. 2012-09-07 18:07:52 -04:00
Lorin Hochstein
eabbaaec46 Have ansible respect private_key_file option
The ansible command-line tool was ignoring the private_key_file option.
2012-09-07 14:37:32 -04:00
willthames
f456d999a9 Fix templates for non root sudo_user
When using template module, if a restrictive umask is set, the
sudo_user won't be able to read the /tmp/ansible-dir/source file
after it is copied across following _transfer_str

I wonder if this behaviour shouldn't be abstracted somehow (as
this correction also happens after put_file in the copy module too)
2012-09-07 16:35:53 +10:00
Mark Theunissen
c25ead382c Adapt module common code to use the systemd journal if it's available 2012-09-06 17:59:38 -07:00
Michael DeHaan
dc14681530 rename isset to is_set 2012-09-06 20:55:27 -04:00
Michael DeHaan
8621539341 Merge branch 'only_if-isset' of https://github.com/dhozac/ansible into devel 2012-09-06 20:55:11 -04:00
Michael DeHaan
ba97ad13e3 Merge pull request #1010 from tima/yaml-jinja
Added to_yaml and from_yaml filters to Jinja environment.
2012-09-06 17:50:01 -07:00
Michael DeHaan
8a09e1281b Fixup modularized template module 2012-09-06 19:04:27 -04:00
Michael DeHaan
633e513a65 Modular server-side actions (squash merge) 2012-09-06 18:57:04 -04:00
Michael DeHaan
975c323e39 Release version bump 2012-09-06 18:56:38 -04:00
Michael DeHaan
2bf9a92bb6 Don't load plugins starting with "_". 2012-09-06 18:46:15 -04:00
Michael DeHaan
6fb1884a03 Add __init__'s to git 2012-09-06 18:43:28 -04:00
Timothy Appnel
23cd7ad08a Added to_yaml and from_yaml filters to Jinja environment. 2012-09-06 10:19:56 -04:00
Anastasis Andronidis
02510ec2ff --version is now taking the correct head 2012-09-06 15:18:29 +03:00
Daniel Hokka Zakrisson
14db2fa376 Add an isset("$var") function to only_if 2012-09-05 23:18:47 +02:00
Michael DeHaan
f41d3b9bd2 Fix skipped callback 2012-09-04 21:56:32 -04:00
Michael DeHaan
96f257cea1 Fix invocation-output-supression code to still provide invocation data to the callbacks. 2012-09-04 21:16:12 -04:00
Michael DeHaan
2843e31e09 Don't add 'n/a' because if running from source there will be no git 2012-09-04 21:07:29 -04:00
Michael DeHaan
0c386b0514 Merge pull request #993 from andronat/repo-as-submodule
Fixed a parsing HEAD problem, when ansible is checked out as a submodule
2012-09-05 17:04:09 -07:00
Anastasis Andronidis
ba707f56c1 except now returns a 'n/a' version. Some changes in comments 2012-09-05 12:40:14 +03:00
Michael DeHaan
aa704a6111 backuplocal => backup_local for API standardization reasons 2012-09-04 19:49:49 -04:00
Michael DeHaan
b97e2a6f5a Merge branch 'backup-common' of https://github.com/dhozac/ansible into devel 2012-09-04 19:45:39 -04:00
Daniel Hokka Zakrisson
7a201dbb2e Keep result pristine for ignore_errors 2012-09-04 22:40:07 +02:00
Anastasis Andronidis
63b4f8dd80 small typo 2012-09-04 17:12:16 +03:00
Anastasis Andronidis
44a28838db Fault handling for YAML file and gitdir value. 2012-09-04 17:05:00 +03:00
Daniel Hokka Zakrisson
dfcb9d3c2d Move backup to module_common 2012-09-04 16:04:53 +02:00
Anastasis Andronidis
6c8171f6f9 Appended repo_path 2012-09-04 16:28:57 +03:00
Anastasis Andronidis
4e94db3d78 Fixed a parsing HEAD problem, when ansible is checked out as a submodule
Fixed a parsing HEAD problem, when ansible is checked out as a
submodule in git
2012-09-04 16:12:39 +03:00
Michael DeHaan
c04f00e3a6 Fix async callback 2012-09-02 11:20:56 -04:00
Jan-Piet Mens
a37c6ea936 Jinja2 filter from_json added, to_json renamed 2012-08-31 07:30:18 +02: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
Stephen Fromm
6742e9c3f4 Add option required=(True|False) to get_bin_path and update modules
Added required as optional argument to get_bin_path(). It defaults to
false.  Updated following modules to use required=True when calling
get_bin_path():  apt_repository, easy_install, group, pip,
supervisorctl, and user.
Also removed _find_supervisorctl() from supervisorctl module and updated
_is_running() to not need it.
2012-08-30 11:01:37 -07:00
Stephen Fromm
4e7b67a45a Add option to pass list of dirs to get_bin_path in module_common.py
The optional list is prepended to PATH.
Fix get_bin_path() to use os.path.join().
2012-08-29 17:08:45 -07:00
Stephen Fromm
4c62e495eb Add method get_bin_path to module_common.py
This is meant to assist all the modules that look for the full path of
an executable.  If it is found and is X_OK, returns the full path.
Otherwise, it returns None.
2012-08-29 16:24:49 -07:00
Daniel Hokka Zakrisson
2d448f2a34 Invoke cowsay without going through the shell 2012-08-30 00:11:40 +02:00
Michael DeHaan
00c4c5c4a1 If tags "all" is used, don't choke. 2012-08-28 20:33:36 -04:00
Michael DeHaan
7ec0afbebc Merge pull request #956 from tima/jinja-json-filter
Add tojson filter to jinja environment used by the template module.
2012-08-28 17:24:08 -07:00
Timothy Appnel
d306c8debc Add tojson filter to jinja environment used by the template module. 2012-08-28 18:10:19 -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
4002cfbdcd Minor string tweak. 2012-08-27 21:31:20 -04:00
Mark Theunissen
2755602dcb Check to make sure that tags passed as parameters actually exist 2012-08-27 21:27:07 -04:00
Daniel Hokka Zakrisson
89a31b0a2a Allow variable expansion for vars that evaluate to false 2012-08-27 15:42:41 +02:00
Michael DeHaan
98483f5252 Merge pull request #942 from dagwieers/color-capability
Check for terminal capabilities if curses is available
2012-08-24 16:44:29 -07:00
Michael DeHaan
cb18b3eb26 Merge branch 'devel' of github.com:ansible/ansible into devel 2012-08-24 19:30:54 -04:00
Dag Wieërs
47f3be3de0 Check for terminal capabilities if curses is available
Normally curses is part of the standard library, but this was not
always the case in the past.

The ANSIBLE_COLOR environment variable and the tty-check have
priority over the curses method (as they are both faster than
the curses test).
2012-08-25 00:45:14 +02:00
Ludovic Claude
b0a4a9e188 Issue #935: filter out __init__ module from the list of callbacks 2012-08-23 20:26:27 +02:00
Derek Carter
de306922b1 scope error with utils.py branch_path 2012-08-23 12:30:34 -04:00
Michael DeHaan
91a9d0d499 Merge pull request #930 from elventear/version_fix
Fix git version when some head files are missing.
2012-08-22 16:54:17 -07:00
Pepe Barbe
5c4a523148 fix _gitinfo function to avoid ansible crashing in cases where the branch file is missing (e.g. after a gc) 2012-08-22 13:54:25 -05:00
Michael DeHaan
2833f48ed3 Make a particular error about an invalid include statement a bit clearer. 2012-08-21 22:08:08 -04:00
Michael DeHaan
3de4e45741 Move plugin directories 2012-08-21 20:32:21 -04:00
Michael DeHaan
bf92a9e4e0 Store invocation differently from an API perspective, but hide in callbacks 2012-08-20 20:41:53 -04:00
Dave Peticolas
4b4bcdedc1 Fix off-by-one serial count (causing infinite loop for serial == 1). 2012-08-21 13:43:05 -07:00
Grzegorz Nosek
94f56614e7 Fix UTF-8 output when using executable inventory files
The 'hostname' variable is then unicode, which breaks interpolating
stdout etc. contents into the output strings (they are bytes and cannot
be converted to Unicode using ASCII codec)
2012-08-20 18:26:21 -04:00
Grzegorz Nosek
73b0dd4ac0 Enable UTF-8 commands via the raw module
Paramiko does not allow Unicode strings as parameters, so encode
the command to UTF-8.

Test case:

ansible localhost -m raw -a 'echo ą'

(also tested on local and ssh transports without problems)
2012-08-20 18:26:21 -04:00
Grzegorz Nosek
2aef0335cb Handle UTF-8 in templates
This is required to run commands containing non-ASCII characters, e.g.:

ansible localhost -m shell -a 'echo ą'
2012-08-20 18:26:21 -04:00
Tim Bielawa
4121109665 Local actions, they're like aliases for actions with localhost
delegates.

Closes #905
2012-08-20 18:26:21 -04:00
Michael DeHaan
6e79555621 remove stray imports 2012-08-18 20:38:47 -04:00
Michael DeHaan
3cbf885079 Change the order the setup cache is used to update things, such that the example/playbooks/conditional_part1.yml file
works as advertised
2012-08-18 19:49:49 -04:00
Michael DeHaan
3017dc92d9 make callbacks modular 2012-08-18 19:43:08 -04:00
Michael DeHaan
7fd4051857 make connection types pluggable 2012-08-18 10:52:24 -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
e13c33bb86 Moved Runner's ReturnData class to a seperate file. 2012-08-18 09:30:33 -04:00
Michael DeHaan
f07e55c568 Adds 'delegate_to' as a task option which can be used to signal load balancers and outage windows. 2012-08-18 08:46:51 -04:00
Pepe Barbe
e4a2de4f82 Syntax changes necessary to make test-module work with Python 2.4 2012-08-17 10:35:17 -05:00
Michael DeHaan
fe923b9394 Adaptation of fix in #891 to avoid cut on only one md5 call. 2012-08-16 22:45:43 -04:00
Michael DeHaan
5bb5082ed9 Fix failed to parse message handling 2012-08-16 21:47:17 -04:00
Michael DeHaan
0579b8b4e6 The command module was not reporting on errors like the other modules when the module failed
to parse or return other valid output.  This is a slight improvement.
2012-08-16 21:44:59 -04:00
Michael DeHaan
eee2d1afd0 If ANSIBLE_KEEP_REMOTE_FILES=1 is set as an environment file, remote files will not be deleted, which is useful only for development debugging purposes. 2012-08-16 21:34:55 -04:00
Michael DeHaan
de221e6b4b Add vars to host_vars to prevent some suprises 2012-08-14 20:35:01 -04:00
Michael DeHaan
9851066f4d Adding ability to set ssh args from config file 2012-08-14 20:13:02 -04:00
Michael DeHaan
6de8c27085 Load parent groups when processing group_vars 2012-08-14 19:48:33 -04:00
Michael DeHaan
7d50a5c2b7 Merge pull request #865 from jdavisp3/vars-file
Always load group_vars and host_vars.
2012-08-14 04:55:18 -07:00
willthames
c01040ca72 Further fixes for constants following config introduction
Added an ANSIBLE_CONFIG variable to poteentially override
~/.ansible.cfg
Used os.path.expanduser against all paths that might be read in to allow
~ to be used in config files. I'd have preferred it if os.path.expanduser
took None as an argument but it doesn't.

If remote_port *is* set in the ansible config file, then it will be
interpreted as a string (at which point ssh.connect fails with an
obscure message). Most other numeric variables are handled by
the OptionsParser which takes a type variable when setting up the option -
but remote_port is not an option, so never cast to int.

It might be worth adding a type field to get_config that defaults to a string.
That could be e.g. file or int, which then casts it correctly.
2012-08-14 20:22:47 +10:00
Dave Peticolas
b42e835aab Always load group_vars and host_vars. 2012-08-13 21:08:05 -07:00
Michael DeHaan
7ab0d60b1a update config code 2012-08-13 20:17:07 -04:00
Michael DeHaan
62fbbf7653 config file support 2012-08-13 19:17:59 -04:00
Michael DeHaan
00c28e2810 formatting 2012-08-11 18:41:36 -04:00
Michael DeHaan
1e4d45af1e Add module common code to allow it to be easier to indicate whether arguments are mutually exclusive, required in conjunction, or whether one of a list of arguments is required. This simplifies writing Python modules. 2012-08-11 18:13:29 -04:00
Michael DeHaan
deec50fc3c Default -u (user) and "user:" in playbooks to the current user. 2012-08-11 17:33:34 -04:00
Michael DeHaan
3587ffdef3 Allow /bin/ansible to use --limit 2012-08-11 14:05:24 -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
301edb5b52 use StringIO for output concatenation, minor other tweaks to previous commit 2012-08-11 11:59:14 -04:00
Michael DeHaan
3cc564c127 Merge branch 'devel' of https://github.com/SleeplessAnnoyedNerd/ansible into devel 2012-08-11 11:48:57 -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
Dietmar Schinnerl
ac44c36e4f Removed unnecessary string replacements since parse_json already filters garbage lines 2012-08-11 16:57:04 +02:00
Dietmar Schinnerl
6b622beb4d Added filtering of non-JSON lines. 2012-08-11 16:24:16 +02:00
Dietmar Schinnerl
fbdddc7c74 Added utils.last_non_blank_line 2012-08-11 16:14:19 +02:00
Dietmar Schinnerl
993bb5c6f1 Added stub implementation of filters 2012-08-11 15:55:14 +02:00
Dietmar Schinnerl
bfed87df80 Removed leading blanks 2012-08-11 15:49:00 +02:00
Dietmar Schinnerl
6a18075640 Issue #848: Closing stdin after we read from stdout 2012-08-11 15:13:07 +02: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
05a128c2be Add ability to store and access module results later on in the play. See examples/playbooks/register_logic for details. 2012-08-10 01:13:37 -04:00
Michael DeHaan
6c5761a79e Store the ${last_result} for each host to make it usable in only_if conditionals and such. 2012-08-10 00:58:53 -04:00
Michael DeHaan
c7888dd642 Given user report that EL5 sudo does not support '--', remove it, and things seem to still work fine.
let me know if this breaks any other boxes.
2012-08-10 00:15:23 -04:00
Michael DeHaan
02ba5a48e0 Merge branch 'cleanup-imports' of https://github.com/jdavisp3/ansible into devel 2012-08-10 00:05:04 -04:00
Michael DeHaan
a7415e5409 Merge pull request #836 from sfromm/rawfixes
Fixes for raw module usage and failure to open_session()
2012-08-10 17:01:47 -07:00
Sebastien Bocahu
a3ff6b1958 Fix unneeded bashism
Signed-off-by: Sebastien Bocahu <sebastien@ispfr.net>
2012-08-10 15:57:51 +02:00
Stephen Fromm
569d377183 Wrap paramiko open_session() call in try/except
Ran across non-unix host where the call to paramiko's open_session() in
exec_command() would throw a EOFError exception.  This change wraps the
block in a try/except.
2012-08-09 21:47:09 -07:00
Stephen Fromm
f9bdfde614 Fixes for runner and raw module
runner should not try to create or remove tmp paths when using the raw
module.
2012-08-09 21:45:00 -07:00
Dave Peticolas
08272dc25d Remove unused imports. 2012-08-09 21:35:22 -07:00
Michael DeHaan
05d6e74cce Merge branch 'vars_prompt_encrypt' of https://github.com/cocoy/ansible into devel 2012-08-09 21:41:12 -04:00
Michael DeHaan
07f459f3b2 Allow user to be passed in via --extra-vars 2012-08-09 21:14:30 -04:00
Michael DeHaan
98a5565106 Fixing up parameterized task includes such that variables can be easily handed to them. 2012-08-09 21:09:12 -04:00
Sundar Raman
2f754f0284 (Re #829) Fix for sudo_cmd not defined 2012-08-09 18:02:21 -04:00
Rodney Quillo
d1f821361d vars_prompt encrypt from mgw 2012-08-09 22:56:40 +08:00
Tim Bielawa
bf7e83bea6 Update man pages and the message for an exception. 2012-08-09 10:22:43 -04:00
Michael DeHaan
093bbd1c82 Slight version format tweaks 2012-08-08 21:23:33 -04:00
Michael DeHaan
e654f881a8 Merge pull request #812 from willthames/gitversion
Added commit time information to the --version output
2012-08-08 18:50:04 -07:00
willthames
208f2b66ed Added commit time information to the --version output
Now prints date of commit (and timezone offset of commit)
Hopefully resolves #783
2012-08-09 11:24:56 +10:00
Michael DeHaan
40ff3eb106 Catch socket errors so if you control-c a playbook it does not traceback 2012-08-08 21:19:20 -04:00
Michael DeHaan
85ba71a7fe Split -vv from -vvv 2012-08-08 21:16:48 -04:00
Michael DeHaan
cac4effd8f Add module arguments remote modules to -vvv output 2012-08-08 21:13:31 -04:00
Michael DeHaan
846186e2fc Add -vvv support for debugging activity 2012-08-08 21:09:14 -04:00
Michael DeHaan
c82f06258c Only run yum,apt through the with_items loop if there is a list of items. Just a cosmetic fix on return values
for the most part.
2012-08-08 20:43:01 -04:00
Michael DeHaan
2f6d6ccb5a Nicer errors from modules if arguments are not fed key=value 2012-08-08 20:30:20 -04:00
Michael DeHaan
183fce6d99 Detect SFTP disablement in paramiko + changelog updates 2012-08-08 20:27:33 -04:00
Michael DeHaan
51083e48e9 remove duplicate code path as few will have git python installed 2012-08-08 20:19:32 -04:00
Michael DeHaan
fde329fb9e Merge branch 'gitversion' of https://github.com/willthames/ansible into devel 2012-08-08 20:17:18 -04:00
Will Thames
9a50ed9b7b Added git information to version string
Running ansible --version now outputs git information when the
repo lives in .git in the root of the ansible source (coping with the case
where the git info is elsewhere is left as an exercise).

This uses gitpython where installed, otherwise it interrogates the files
in the .git directory to get the same information.

The gitpython path could be removed, but then people might ask 'why did
you do it like this when gitpython exists'
2012-08-09 10:12:04 +10:00
Michael DeHaan
176bf3cbb5 Save extra chmod step if sudoing to root 2012-08-08 19:17:31 -04:00
Will Thames
414eceb138 chmod needs more specific arguments to work with sudo_user
Basically if umask is set to something like 0007 then chmod +r and chmod +x
are not the same as chmod a+r and chmod a+x

Using os.path.basename rather than source.split should make ansible more
portable (and even if never ported, more readable)
2012-08-08 16:12:50 +10:00
Tim Bielawa
3937707117 Add 'polite' YAML syntax validation and hinting. Closes #798 2012-08-07 18:24:47 -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
fd265b40b7 Release bump 2012-08-06 19:55:27 -04:00
Michael DeHaan
08c1f96e4b Fix some subtle behavior of how the get_url module chains into the file module, plus blend the results of daisy chain
operations in the correct order, so the file module results overlay the original module results, not the other way
around (which keeps any failure msg's intact)
2012-08-03 07:02:31 -04:00
Michael DeHaan
ce01c3f7e7 Allow unicode transfer by not base64 encoding. Also: faster 2012-08-02 21:20:43 -04:00
Michael DeHaan
227dfc17f3 fix tree output 2012-08-02 20:42:32 -04:00
Michael DeHaan
05df6464ef Make module args as unicode more or less not choke. 2012-08-02 20:29:18 -04:00
Michael DeHaan
b76efa39be Fix some templating issues, needs testing with anti-unicode safeguard around shlex.split 2012-08-02 20:21:59 -04:00
Seth Vidal
f924c96370 remove the tab I found
DIE TAB DIE
pep8
2012-08-02 17:26:04 -04:00
Michael DeHaan
c192d8a2b2 Revert "Apply templating to module arguments in playbook"
Breaks copy module by introducing unicodeness, among other things

This reverts commit 4fedb17e38.
2012-08-01 23:07:15 -04:00
Michael DeHaan
38ed7ca7df Merge pull request #759 from lorin/error-feedback
If task action is invalid, output the name in error message
2012-08-02 05:39:53 -07:00
Lorin Hochstein
aed6ee7f74 Report only name in task error, all on one line 2012-08-02 08:37:43 -04:00
Lorin Hochstein
fa9fe9d246 If task action is invalid, output the name and action. 2012-08-01 23:51:25 -04:00
Michael DeHaan
fe87a16a3e Make yum module use one-pass with with_items 2012-08-01 22:27:25 -04:00
Will Thames
4fedb17e38 Apply templating to module arguments in playbook
Module arguments should have variable substitution applied
Also, replacing task.action with the templated task.name seems wrong
2012-08-01 22:22:46 -04:00
Will Thames
d43d81a9a4 Raise exception when sudo user does not exist
sudo can fail before getting to the password prompt if a user does not exist
<pre>
[will@tangerine ansible (sudo_missing_user)]$ sudo -u bobbins echo hello
sudo: unknown user: bobbins
sudo: unable to initialize policy plugin
</pre>
Fix raises a distinct exception when that occurs
2012-08-02 16:19:15 +10:00
Michael DeHaan
25acfa8170 Join with_items for the apt module, yum pending, and various fixes to the yum module to support aliases 2012-08-01 20:33:13 -04:00
Michael DeHaan
86ec639176 add error handling if you try to load files in the wrong data format 2012-08-01 19:51:52 -04:00
Michael DeHaan
08c5fe875b yell if input data for host or group vars are not hashes 2012-08-01 19:46:33 -04:00
Michael DeHaan
ed14312ad6 reinstate invalid argument checks where possible, daisy chainee/chained modules turn it off 2012-08-01 19:42:31 -04:00
Petros Moisiadis
2ac4acbf97 fixes for tests 2012-08-01 22:17:16 +03:00
Petros Moisiadis
5f4bf813b1 added an 'ignore_errors' option to tasks
Failed tasks with ignore_errors=True, allow the remaining tasks in the
play to be executed as if no failure happened. A failure notice is still
written to the output as well as an '...ignoring' message.
2012-08-01 19:13:07 +03:00
Michael DeHaan
f60517aa33 temporarily disable failing check on some things 2012-08-01 09:33:20 -04:00
Ahmad Khayyat
6728b6cdda Allow = symbols in variable values in host inventory 2012-07-31 23:36:26 -04:00
Michael DeHaan
8700de964c Teach the common module code to warn users about typo'd arguments and also set everything to None automatically such
that code doesn't have to do a lot of params.get('foo', None) everywhere.
2012-07-31 21:23:34 -04:00
Timothy Appnel
b30f4688cd concatenating stdout and stderr in runner/__init__'s _low_level_exec_command. 2012-07-31 16:59:45 -04:00
u348095
7e279f972e Use sudo_user as an argument in the sudo command 2012-07-31 16:21:24 +10:00
Michael DeHaan
8e60ad986a Do not log login_password params to DB module 2012-07-30 21:21:30 -04:00
Michael DeHaan
da44fb1e43 Fixes #731 by reinstating variables for inventory scripts 2012-07-30 19:26:46 -04:00
Michael DeHaan
ff82f0a168 Further service module tweaks 2012-07-28 16:48:04 -04:00
Peter Sankauskas
0188889aea Making inventory pattern matching handle group names 2012-07-30 12:51:29 -07:00
Michael DeHaan
d0f0315c9d Merge pull request #723 from skvidal/devel
fix trace-creating error in apt module - also make the default setting a...
2012-07-30 10:45:42 -07:00
Seth Vidal
21a35bde00 new patch - adds a 'boolean' function to the module_common class and cleans up
the apt module to use it
2012-07-30 13:41:42 -04:00
Derek Carter
547395a2be added inventory_hostname_short varible 2012-07-30 13:26:48 -04:00
willthames
ad9b8e2312 Output version string when --version is passed using optparse's version argument 2012-07-30 14:19:02 +10:00
Michael DeHaan
17be5537d6 When sudoing to another user, the umask may be set such that the next user might not be able to read/execute
the file.  Deal with this.
2012-07-28 08:48:05 -04:00
Michael DeHaan
fcdc281c28 If sudoing to a user other than root, the home directory of the original user is very unlikely to be readable by the
sudoed to user, so just use tmp.  Data will be readable by others (briefly before deletion) but never writeable.
2012-07-27 20:53:50 -04:00
Michael DeHaan
aa40c5f3b3 remove commented out debug lines 2012-07-27 20:44:55 -04:00
Michael DeHaan
ee5f12cd40 Slight tweaks on vars_prompt upgrades 2012-07-27 19:00:48 -04:00
Petros Moisiadis
c717934b7e Improved 'vars_prompt' syntax to support prompt text and (non-)private input
An example of the new syntax:

vars_prompt:
 - name: 'secret_variable_name"
   prompt: "Enter secret value: "
   private: "yes"
 - name: "nonsecret_variable_name"
   prompt: "Enter non-secret value: "
   private: "no"
2012-07-27 19:00:48 -04:00
Michael DeHaan
a65b4fef97 Fix up chain invocations of template 2012-07-26 00:39:44 -04:00
Michael DeHaan
19fc8eea80 Things that happen inside multiprocessing shouldn't make side effects, ergo append ansible_facts only
in playbook code.

This technically means with_items calls can't continuously add facts I guess, but I can't see anyone
ever trying that.
2012-07-25 21:30:49 -04:00
Michael DeHaan
da4562f495 changes to not clear the setup cache between runs, and also decide to run plays with no tasks
in them if it looks like they are not tagged, because if that is the case, then we may just
be gathering facts about them.
2012-07-25 20:45:51 -04:00
Michael DeHaan
f371092845 rm stray comment 2012-07-25 20:31:57 -04:00
Michael DeHaan
e035ce97ce blue on black, tears on a river, push on a shove, it don't mean much
(make colorized playbook runs not suck on black terminals)
2012-07-25 20:31:26 -04:00
Lorin Hochstein
b63a3bd0c7 Save module name and args when processing list of items.
This is necessary because daisy-chained modules will overwrite
these values.
2012-07-25 13:26:07 -04:00
Michael DeHaan
8d7f526df6 importing/not-importing methods should be colorized 2012-07-24 20:41:24 -04:00
Michael DeHaan
d3e8e8ff54 Fix output message 2012-07-24 20:37:27 -04:00