Nathan A. Feger
9feb26ab28
Better error messaging in utils
...
When a command responds with json that is unparseable, dump that unpareseable response instead of swallowing it.
2012-06-14 13:17:38 -05:00
Michael DeHaan
2a8d1f07d4
Merge branch 'mktemp-vanish' of https://github.com/dagwieers/ansible into devel
...
Conflicts:
lib/ansible/runner/__init__.py
2012-06-13 22:39:58 -04:00
Michael DeHaan
27c949ade9
Merge pull request #462 from tima/more-env-defaults
...
Most constants can be overriden with environment variables.
2012-06-13 19:20:33 -07:00
Michael DeHaan
2a49438c37
Merge pull request #461 from dhozac/only_if-early
...
Evaluate only_if early
2012-06-13 19:19:25 -07:00
Michael DeHaan
bd893b765b
Merge pull request #459 from dhozac/with_items-variable
...
Allow a variable in with_items
2012-06-13 19:18:51 -07:00
Stephen Fromm
9cf182c225
Add assemble module
...
This adds a module that concatenates (ie. assembles) a file from
fragments in a directory in alphabetical order. It chains the file
module afterward to fix up ownership and permission. This also adds
tests for the assemble module with fragments in assemble.d.
2012-06-11 23:09:54 -07:00
Timothy Appnel
5ea8ad2d94
Most constants can be overriden with environment variables. Reserved doing anything with the connection options for further review.
2012-06-11 18:07:44 -04:00
Daniel Hokka Zakrisson
7942570411
Fix on_unreachable invocation with non-existing variable
2012-06-11 15:15:29 +02:00
Daniel Hokka Zakrisson
eba81ee36f
Evaluate only_if early to do as little work as possible
2012-06-11 15:15:29 +02:00
Matt Goodall
c1b38f62c8
Search multiple paths for modules.
...
Minimal change to allow a list of paths (separated by the typical path
separator) to be searched in sequence for the named module.
2012-06-10 16:22:59 +01:00
Daniel Hokka Zakrisson
a05da2d312
Allow with_items to specify a variable
2012-06-09 21:59:22 +02:00
Daniel Hokka Zakrisson
933b5e8631
Reduce code duplication
2012-06-09 21:50:46 +02:00
Michael DeHaan
e8e6c98016
Merge pull request #455 from dhozac/vars_files-non-list
...
Expand vars_files identically for lists and non-lists
2012-06-08 12:19:47 -07:00
Michael DeHaan
01387520e9
Merge pull request #451 from phred/fix-fetch-module
...
Make 'fetch' test for local directories before creating. Fixes issue #450
2012-06-08 12:06:02 -07:00
Michael DeHaan
e265cdfa1d
Merge pull request #454 from jhoekx/configure-python-interpreter
...
Introduce ansible_python_interpreter variable.
2012-06-08 12:03:40 -07:00
Michael DeHaan
b1c2820a32
Merge pull request #456 from dhozac/notify-variable
...
Allow variables in notify list
2012-06-08 11:59:39 -07:00
Daniel Hokka Zakrisson
d0d036fd3f
Expand $item for copy and fetch
2012-06-08 01:36:52 +02:00
Daniel Hokka Zakrisson
ad7b744764
Allow variables in notify list
2012-06-08 01:35:23 +02:00
Daniel Hokka Zakrisson
dff8d7be04
Expand vars_files identically for lists and non-lists
2012-06-08 01:32:56 +02:00
Jeroen Hoekx
1f63c47738
Introduce ansible_python_interpreter variable.
...
This allows configuration of the correct python interpreter on the managed system.
2012-06-07 09:50:38 +02:00
Dag Wieërs
b3b22c41e9
Get rid of mktemp dependency to support AIX
...
The function call has been renamed to better reflect what it does, and we
reduced the number of calls from two to one in case the remote user is not
root.
This patch also fixes a string concatenation in _copy_module() that
should use os.path.join() instead.
This closes #436
2012-06-06 14:47:47 +02:00
Fred Alger
bee04de26a
Fix exception in fetch module when src or dest parameter omitted.
2012-06-05 11:35:19 -04:00
Fred Alger
d0c4f4015c
Fix remote md5 in fetch module, related to Issue #450
2012-06-05 11:35:19 -04:00
Fred Alger
51b460e8c6
Make 'fetch' test for local directories before creating. Fixes issue #450
2012-06-05 10:38:12 -04:00
John Kleint
e9f770fa11
More helpful message when ssh fails.
2012-06-01 17:16:02 -04:00
Michael DeHaan
1ee7ff2f7b
To allow plays using different user accounts in the same playbook to function, clear the setup cache
...
between plays.
2012-05-31 22:08:00 -04:00
Michael DeHaan
16f0d7b333
Revert "Get rid of mktemp dependency to support AIX"
...
This reverts commit 4ad1b57b52d735393f6c6bcbd5524b947134fbf9.
2012-05-31 21:59:31 -04:00
Michael DeHaan
99430fa0a3
Fix for older version of sudo + some changes to imports so tests are happy
2012-05-31 21:44:56 -04:00
Michael DeHaan
634cf9aaba
Merge pull request #437 from dagwieers/mktemp-vanish
...
Get rid of mktemp dependency to support AIX
2012-05-31 18:37:28 -07:00
John Kleint
70837469c6
Properly template list of hosts in playbooks.
...
In playbooks, hosts can be a YAML list. We templated the list before
converting it to a semicolon-separated string, which actually templated its
repr. This converts to a string first. A basic unit test is included.
2012-05-31 16:06:21 -04:00
Dag Wieers
a8fd6ee9c3
Get rid of mktemp dependency to support AIX
...
The function call has been renamed to better reflect what it does, and we
reduced the number of calls from two to one in case the remote user is not
root.
This patch also fixes a string concatenation in _copy_module() that
should use os.path.join()
This closes #436
2012-05-31 17:02:10 +02:00
Michael DeHaan
6034b5b0f3
Split connection code into submodules.
2012-05-30 20:16:31 -04:00
Michael DeHaan
0972b761de
Leverage cowsay if installed.
2012-05-30 19:44:00 -04:00
Brad Olson
c34921fe7b
Removed legacy comment.
2012-05-30 15:37:14 -04: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
af9651f015
Merge pull request #420 from bradobro/fix_no_varfiles
...
Test for play.vars_files == None, avoiding nasty traceback.
2012-05-29 08:32:47 -07:00
Brad Olson
7ea4a0e895
Avoid traceback when vars file has no vars items. Could warn or fail instead.
2012-05-29 10:23:09 -04:00
Brad Olson
32b9ea689a
Test for play.vars_files == None, avoiding nasty traceback. Ignores for now. Could warn.
...
Playbook test for no vars_files with len(), but that excepts if play.vars_files==None, as can happen when there's a vars_files section with no vars files listed. What is the ansible way: ignore, warn, or fail with message (instead of traceback)?
2012-05-29 10:09:38 -04:00
Cosmin Luță
74bfd7eb81
Removed line that caused stacktrace
2012-05-27 14:15:30 +03:00
Michael DeHaan
4664e354c3
Get with_items to work with new play/task architecture.
2012-05-26 01:49:23 -04:00
Michael DeHaan
ecb944892d
Tweaks on previous refactoring of playbook, version bump a 0.4 reference, remove some debug, etc
2012-05-26 01:20:53 -04:00
Michael DeHaan
b9b53d1941
Playbook refactoring -- work in progress.
2012-05-26 00:37:34 -04:00
Michael DeHaan
cf9ddf3a30
Reorganizing file structure. Not done.
2012-05-25 19:34:13 -04:00
Michael DeHaan
6f114a2e2c
Delete poller code from runner.py now that it is moved.
2012-05-25 19:20:01 -04:00
Michael DeHaan
db1d5b154a
Fix casing/underscore convention in method name, split polling logic away from runner.
2012-05-25 19:18:02 -04:00
Michael DeHaan
6d580aea02
As part of a precursor to other refactoring, make returns less list-like throughout runner.
2012-05-25 18:44:29 -04:00
Matt Goodall
639763c138
Allow "=" in k-v values.
2012-05-23 00:58:05 +01:00
Matthew Williams
7bbcf5d2d5
template path for handlers: include
2012-05-21 21:40:07 -07:00
Michael DeHaan
1125ca548a
Merge pull request #411 from mgwilliams/bug-fetch-module
...
Fetch module: run dwim on dest after templating, not before
2012-05-20 07:01:11 -07:00
Matthew Williams
effd931031
dim fetch dest after templating
2012-05-19 18:59:23 -07:00
Michael DeHaan
8e88667f82
Fix hosts being in multiple groups, and duplicate host references in the same inventory file.
2012-05-19 17:24:54 -04:00
Michael DeHaan
7302b7bbc4
Merge pull request #402 from denen99/devel
...
updated connection.py to have the same interface for exec_command on both LocalConnection and ParamikoConnection classes
2012-05-17 04:06:02 -07:00
Adam Denenberg
3dfd240b86
updated connection.py to have the same interface for exec_command on both LocalConnection and ParamikoConnection classes
2012-05-17 00:11:50 -04:00
Jeroen Hoekx
3eff44a2b0
Arguments to setup module should be json.
2012-05-15 17:43:01 +02:00
Seth Vidal
d80fd74b64
make sure private_key_file is hooked up in playbooks, too
2012-05-14 16:52:48 -04:00
Seth Vidal
96ef6482c5
add --private-key option and related infrastructure to make paramiko work
...
with a private key file - not just an agent or pw
2012-05-14 16:14:38 -04:00
Daniel Néri
e4991d1a61
In the template module, use utils.template_from_file instead of reimplementing it inline
2012-05-13 20:57:01 +02:00
Daniel Néri
f8b17ef8d3
For utils.template_from_file, change 'no_engine' default to True
...
This now follows the other template functions, and implicitly also
fixes that playbook handler includes were still processed by Jinja2.
2012-05-13 20:42:11 +02:00
Daniel Néri
4b0480dd9d
Set 'hostvars' before performing variable replacements
2012-05-13 20:36:08 +02:00
Michael DeHaan
60d44e1a01
Squashed commit of the following, plus some streamlining (MPD).
...
commit e00368e7c65c65bed11fcaaf83fe8b093dbf492e
Merge: 2ea7110 c039aa0
Author: Michael DeHaan <michael.dehaan@gmail.com>
Date: Thu May 10 01:43:10 2012 -0400
Merge branch 'devel' of https://github.com/weaselkeeper/ansible into weaselkeeper-devel
commit c039aa091582cd31e206692df6f4f148394b41d6
Author: Jim Richardson <weaselkeeper@gmail.com>
Date: Fri May 11 17:55:13 2012 -0700
cleanup and simplification of ANSIBLE_REMOTE_TMP feature
commit d87f15b796b799c375808edc7cc0932d7809d325
Merge: 5917aba 4c2fd25
Author: Jim Richardson <weaselkeeper@gmail.com>
Date: Fri May 11 17:30:16 2012 -0700
Merge branch 'devel' of github.com:weaselkeeper/ansible into devel
commit 5917aba761af2e4163772d2d74e7efc0d169273a
Author: Jim Richardson <jrichardson@classmates.com>
Date: Wed May 9 11:25:45 2012 -0700
ANSIBLE_REMOTE_TMP environment variable sets where ansible will stuf tmp files on remote host. Default is /var/tmp for root, and $HOME/.ansible/tmp for non-root
commit 4c2fd2577769a6392187585828168bcb4a1476da
Author: Jim Richardson <jrichardson@classmates.com>
Date: Wed May 9 11:25:45 2012 -0700
ANSIBLE_REMOTE_TMP environment variable sets where ansible will stuf tmp files on remote host. Default is /var/tmp for root, and $HOME/.ansible/tmp for non-root
2012-05-10 01:50:22 -04:00
Michael DeHaan
ccab8ac2c0
Reinstate raw module
2012-05-10 01:14:30 -04:00
Michael DeHaan
b7bb0ab225
Do not read user's SSH config file because only reading it partially is confusing to everyone :)
2012-05-09 23:45:37 -04:00
Michael DeHaan
e060b06081
Allow hosts not in inventory to override inventory with -i "host1,host2:port" etc, which is the original intent
...
of --override-hosts.
2012-05-09 23:26:45 -04:00
Michael DeHaan
f8807da57b
Merge pull request #363 from jhoekx/template-only-if
...
Fix correct variable expansion in includes only_if.
2012-05-11 15:55:09 -07:00
Jeroen Hoekx
cd9f926b5f
Fix correct variable expansion in includes only_if.
...
There's not need to run the complete include through the templating engine.
Several variables were not included before the conditional was evaluated.
2012-05-11 15:55:33 +02:00
Michael DeHaan
dab50574e0
Merge pull request #356 from jkleint/singleton-notify
...
Support single handlers for notify.
2012-05-10 17:04:54 -07:00
John Kleint
d9427db14b
Support single handlers for notify.
2012-05-10 15:37:30 -04:00
John Kleint
4cf0c5550e
Fix YAML hosts list.
2012-05-10 15:13:32 -04:00
Jeroen Hoekx
3cbc229990
Support list indexing in varReplace.
2012-05-10 19:25:28 +02:00
Michael DeHaan
4819ce4989
Merge pull request #349 from jhoekx/template-unicode-fixes
...
Fixup unicode varReplace templating.
2012-05-10 05:05:50 -07:00
cocoy
c1fd1348b1
Fix for bug #264
2012-05-10 18:53:24 +08:00
Jeroen Hoekx
74e21e6154
Fixup unicode varReplace templating.
...
The original patches should have conflicted?
53bde0bf517d1302c80f80180f85995efa36a00e vs efde61e53729964f3e740dcbb9c52f889186719d
2012-05-10 10:11:14 +02:00
Stephen Fromm
fa9bfbba13
Fix for sudo to another non-root user (issue #353 )
...
mktemp creates the temp directory 700 only. If the sudo-user is not
root, the other user will not be able to run the command (Permission
denied error). This adds the executable bit for all on the temp
directory.
2012-05-11 11:48:31 -07:00
Michael DeHaan
36639186e0
Merge pull request #362 from jhoekx/uppercase-vars
...
Allow camelCase variables in varReplace.
2012-05-11 10:06:21 -07:00
John Kleint
fba2bdcf0c
Don't read from Paramiko's stderr since there isn't one.
2012-05-11 10:53:35 -04:00
Jeroen Hoekx
dc60f2d844
Allow camelCase variables in varreplace.
2012-05-11 14:14:53 +02:00
Michael DeHaan
262b35e7d3
override-hosts is gone since we can't load inventory for hosts (so it's not an whitelist), but we can
...
still support hosts outside of inventory if you pass in an array of hosts. Ports are supported,
but not much other info.
2012-05-09 21:53:09 -04:00
Michael DeHaan
cb6f0f4284
Merge pull request #346 from jhoekx/improve-varreplace
...
Support nested variables in varReplace
2012-05-09 17:25:07 -07:00
Jeroen Hoekx
2bbc05185e
Make no_engine the default templating action.
2012-05-09 16:15:43 +02:00
Jeroen Hoekx
82144fd543
Support nested variables in varReplace.
2012-05-09 16:15:43 +02:00
Jeroen Hoekx
98f93fcc07
Preserve trailing newline after templating.
...
Jinja seems to eat trailing whitespace. A lot of tools complain about this: iptables-restore, iscsid...
2012-05-09 10:31:32 +02:00
Matthew Williams
e56023b8bb
Template dest and src parameters
2012-05-08 07:12:30 -07:00
Michael DeHaan
d149c1823a
Merge pull request #339 from mgwilliams/feature-unicode
...
Allow unicode (utf8) in templates
2012-05-09 17:16:59 -07:00
Matthew Williams
43b1727f6a
removed debug code
2012-05-08 16:05:43 -07:00
Matthew Williams
39a92f9cd6
allow unicode (utf8) characters in jinja templates
2012-05-08 16:03:51 -07:00
Michael DeHaan
0894206467
Be able to use --extra-vars to set the hosts variable
2012-05-07 23:37:09 -04:00
Michael DeHaan
07508ad535
Since host variables are becoming important, it did not make sense to sustain --override-hosts, with the ability
...
to create hosts that didn't have inventory information, but also existed, in various groups.
2012-05-07 23:16:20 -04:00
Michael DeHaan
fc300723da
Revert "fix indentation"
...
This reverts commit 42b55a07cd132c1b55379908d4c353edeae648cb.
2012-05-07 21:46:45 -04:00
Michael DeHaan
e1914a0e62
Revert "fix the get_hosts() error in get_groups returning a dict not a list of group objects"
...
This reverts commit f41fb90d78fa464e9ad90b63a64bbd48e240c8c2.
2012-05-07 21:46:36 -04:00
Michael DeHaan
121d7c4ece
Merge pull request #329 from skvidal/devel
...
inventory and indentation
2012-05-08 03:54:41 -07:00
Jeroen Hoekx
e09572a8e1
Inventory: undefined group -> ungrouped.
...
Also change test name collision.
2012-05-08 09:44:59 +02:00
Jeroen Hoekx
d419a13ca7
Inventory: support list of vars in host.
2012-05-08 09:44:29 +02:00
John Kleint
710d085def
Fix non-sudo execution, add --sudo-user to ansible-playbook.
2012-05-07 19:58:16 -04:00
Seth Vidal
cd28d82639
fix indentation
2012-05-07 18:10:52 -04:00
Seth Vidal
279e5e4522
fix the get_hosts() error in get_groups returning a dict not a list of group objects
2012-05-07 18:09:57 -04:00
Michael DeHaan
05545e3735
Fixup the previous sudo_user support patch to work with playbooks.
2012-05-06 18:24:45 -04:00
Jim Richardson
5582e6a4f1
sudo -u works now. Needs testing and maybe a bit of cleanup
2012-05-06 18:24:45 -04:00
Jim Richardson
2cd8d7b5e4
first bit of getting sudo -u functionality
2012-05-06 18:24:45 -04:00
Jim Richardson
8d39ae709c
sudo -u works now. Needs testing and maybe a bit of cleanup
2012-05-06 18:24:44 -04:00
Jim Richardson
93a20a33e9
first bit of getting sudo -u functionality
2012-05-06 18:24:44 -04:00
Michael DeHaan
f718fc99b7
Add missing file
2012-05-06 18:02:53 -04:00
Michael DeHaan
157d21b1c3
Add tests for new advanced inventory features (groups of groups, group variables) in the default INI format file.
2012-05-06 18:01:11 -04:00
Michael DeHaan
1a00e2635e
Further work on making the YAML inventory parser use the new inventory objects.
2012-05-06 17:03:17 -04:00
Michael DeHaan
a8f0b5fd06
Fix playbooks such that they work with external inventory scripts. We really want to find out why the 'all'
...
group isn't available, but group vars don't make sense for external inventory anyway.
2012-05-06 15:00:17 -04:00
Michael DeHaan
256377166a
Reinstate external inventory script support this time using the new more OO-ey inventory system.
...
Next up: YAML format.
2012-05-06 14:47:05 -04:00
Michael DeHaan
5730a29814
missing files
2012-05-05 16:37:28 -04:00
Michael DeHaan
0669ce858a
Refactored inventory to make it object oriented, need to make YAML format and executable script
...
format compatible with this still, and add some tests for INI-style groups of groups
and variables.
2012-05-05 16:31:03 -04:00
Michael DeHaan
b300aac551
Include files are no longer to be considered Jinja2 templates, but individual THINGS
...
in included files can still be templated just like top level playbooks. Resolves
some issues about statements being evaluated before facts were available
2012-05-02 00:28:19 -04:00
Michael DeHaan
02efcdced6
Merge branch 'devel' of https://github.com/skvidal/ansible into skvidal-devel
2012-05-01 22:58:47 -04:00
Seth Vidal
38ea61054f
if a playbook has no vars - still include the global vars
2012-05-03 15:52:02 -04:00
Seth Vidal
dc35dd99c0
inventory group 'all' variables are global variables
...
applied to every host and available all over
they are read in so that ones defined first can be used to define
the later ones.
2012-05-02 18:30:58 -04:00
Jeroen Hoekx
03541baba7
Define 'inventory_hostname' variable for hosts.
2012-05-02 09:56:58 +02:00
John Kleint
cbbaee8a9f
Remove command timeout.
2012-05-02 16:25:04 -04:00
Jeroen Hoekx
f14c1e3e91
Async: print one poll message per polling cycle.
...
Instead of one per host per polling cycle.
2012-05-01 18:38:26 -04:00
Jeroen Hoekx
029fe1273c
Modify /usr/bin/ansible and playbooks to use the new async API.
2012-05-01 18:38:26 -04:00
Jeroen Hoekx
ce9a8c9ffc
Introduce Async API in Runner.
2012-05-01 18:38:26 -04:00
Jeroen Hoekx
b87710a1df
Introduce group_names in template variables.
...
This is a list of all the groups a host is in.
2012-04-28 18:23:44 +02:00
Michael DeHaan
6341361a5b
Clarify that stderr WILL crash your module. Can't redirect because if we do we lose tracebacks
...
from modules remotely when they fail to parse, and this is VERY useful data.
2012-04-27 01:36:31 -04:00
Michael DeHaan
36e454c52f
Because paramiko using a pty can't distinguish stderr and stdout, remove handling that
...
treated -D as a way to show stderr, and make sure modules don't include things on stderr.
Update docs and test module script to come into line.
2012-04-27 01:25:38 -04:00
Michael DeHaan
076f1bc169
Revert "Revert "Unify normal and sudo remote command execution. Breaks stderr/stdout handling"
...
This reverts commit 40f603539c
.
2012-04-27 00:46:26 -04:00
Michael DeHaan
0d5bee2dfa
Revert "Revert "Actually wait for password prompt in remote sudo execution. Totally breaks stderr debugging"
...
This reverts commit e16114034c
.
Conflicts:
lib/ansible/connection.py
2012-04-27 00:46:17 -04:00
Michael DeHaan
40f603539c
Revert "Unify normal and sudo remote command execution. Breaks stderr/stdout handling
...
This reverts commit 44486223ed
.
2012-04-27 00:33:48 -04:00
Michael DeHaan
e16114034c
Revert "Actually wait for password prompt in remote sudo execution. Totally breaks stderr debugging
...
and various modules.
This reverts commit 6341a9547f
.
2012-04-27 00:31:18 -04:00
Michael DeHaan
f939f3fdaf
Playbook can now take a 'name' which it will show when starting the play
2012-04-27 00:08:06 -04:00
Michael DeHaan
67d1169674
fix code handling if module_vars is None
2012-04-26 23:18:29 -04:00
Michael DeHaan
aa8ae85070
Add playbook example for first_available_file
2012-04-26 23:03:14 -04:00
Michael DeHaan
3804910187
Some tweaks to first_available_file mostly in terms of error handling and not trying src= to be present
...
as it is not used here.
2012-04-26 23:00:33 -04:00
Seth Vidal
72fd971822
fall through file source list: first_available_file support
...
add first_available_file look up to _execute_template and _execute_copy
to runner.
add this data to playbook handler so it can be included into module_vars
2012-04-27 16:43:55 -04:00
Michael DeHaan
40f5469869
minor personal style preference on 'not'
2012-04-26 20:42:20 -04:00
Reed Murphy
abf524405a
shlex.split() tries to read from stdin if passed None
2012-04-27 11:25:43 +10:00
Michael DeHaan
b9982fc17b
Reinstate --extra-vars, which can do things in playbooks like:
...
ansible-playbook release-my-app.yml --extra-vars="version=123"
And make $version available in the playbook without re-editing the file
2012-04-26 19:57:07 -04:00
Michael DeHaan
5aa5a48f7f
Merge pull request #250 from jkleint/devel
...
Service module crashes if args has no "=".
2012-04-26 16:22:56 -07:00
Michael DeHaan
a4b3b7a2cf
Local connection doesn't need a port.
2012-04-26 19:19:34 -04:00
jkleint
6341a9547f
Actually wait for password prompt in remote sudo execution.
...
When running on lots of hosts with a large login banner on a slow network, it was still possible that the first recv() didn't to pull in the sudo password prompt, and sudo would fail intermittently. This patch tells sudo to use a specific, randomly-generated prompt and then reads until it finds that prompt (or times out). Only then is the password sent. It also catches `socket.timeout` and thunks it to a more useful `AnsbileError` with the output of sudo so if something goes wrong you can see what's up.
2012-04-26 15:01:20 -03:00
cocoy
1220a46e3a
Bugfix for issue #245 .
...
Do not override the value of user and hostname.
Get port and identityfile only.
2012-04-26 14:46:32 +08:00
jkleint
44486223ed
Unify normal and sudo remote command execution.
...
Commit SHA: 87b1cf45
that put temp files in `$HOME/.ansible` instead of `/home/<user>/.ansible` was producing a directory literally called `$HOME` (no expansion) with non-sudo remote execution. I'll take the blame for this one, as `ParamikoConnection.exec_command()` was not using the shell for non-sudo commands. This does sudo and non-sudo execution the same way, using the shell, so environment variables should get expanded.
2012-04-25 13:40:21 -03:00
Seth Vidal
fa2aebc8a6
fix for issue #230 - handle template taking 3 args
2012-04-25 11:59:19 -04:00
Michael DeHaan
87b1cf45a4
Merge pull request #226 from cread/make-osx-tests-pass
...
Use the $HOME env var instead of hard coding /home/<username>
2012-04-24 15:22:43 -07:00
jkleint
4e1bc43645
Support YAML lists of hosts in playbooks.
...
Reading the docs, I was a bit confused as to how to specify multiple hosts/groups in a playbook. Being YAML, I assumed a normal YAML list would work:
---
- hosts: [host1, host2]
But this crashes when inventory._matches() assumes hosts is a string. This patch just checks if hosts is a list, and turns it into a string joined by ';'.
2012-04-24 17:54:00 -03:00
Chris Read
dbb4afff50
Use the /Users/cread env var instead of hard coding /home/<username>
2012-04-24 21:45:54 +01:00
jkleint
b50c50748e
_chain_file_module() calls .get() on error string
...
runner._return_from_module() normally returns a list (?) of `[str,bool,dict,str]`, but on error it returns `[str,bool,str,str]`. runner._chain_file_module() then tries to call .get() on the third item (`data2`), which fails when it's a string. This patch only accesses `data2` if the return value was `ok`. It might be better to return consistent types in both cases, but I'm not sure where/how else the return value is used.
2012-04-24 17:21:01 -03:00
Seth Vidal
41619278e5
handle issues when the hostlist is inadvertently set executable
...
and/or executing it fails. This produces a nicer error message than
a traceback
2012-04-24 11:03:14 -04:00
Michael DeHaan
02abb5a83b
Merge pull request #217 from jhoekx/connection-fixes
...
Expand user in ssh identity file
2012-04-24 07:40:33 -07:00
Jeroen Hoekx
973b1fe02e
Fix incorrect merge of custom-facts branch.
...
This fixes #216 .
2012-04-24 16:11:56 +02:00
Jeroen Hoekx
c2f1aefaf1
Expand user in SSH identity file.
2012-04-24 15:56:46 +02:00
Jeroen Hoekx
1804df0bae
Whitespace fixes in connection.py
2012-04-24 15:56:04 +02:00
Matt Coddington
d34160ed26
cast ssh port number as integer
2012-04-24 00:38:24 -04:00
Michael DeHaan
89c013035e
Merge branch 'integration' of https://github.com/cocoy/ansible into cocoy-integration
2012-04-23 21:30:44 -04:00
Michael DeHaan
bced4c9db1
Merge branch 'jhoekx-custom-facts' into devel
2012-04-23 21:25:26 -04:00
Michael DeHaan
49cca98f1e
Merge branch 'custom-facts' of https://github.com/jhoekx/ansible into jhoekx-custom-facts
...
Conflicts:
lib/ansible/runner.py
2012-04-23 21:24:52 -04:00
Michael DeHaan
346df537b4
Merge branch 'integration' of https://github.com/jkleint/ansible into jkleint-integration
2012-04-23 21:21:43 -04:00
Michael DeHaan
7de90c4e64
Version bump for integration branch (soon to be renamed 'devel'), didn't update package
...
changelogs yet since this isn't released yet (but 0.3 is)
2012-04-23 21:14:48 -04:00
Michael DeHaan
4d62510997
Version bump for 0.3 release
2012-04-23 21:11:43 -04:00
Michael DeHaan
a8707e48e8
Fix merge issue
2012-04-23 21:06:47 -04:00
Michael DeHaan
c00699d0ef
Merge branch 'integration'
...
Conflicts:
lib/ansible/playbook.py
lib/ansible/runner.py
library/apt
2012-04-23 21:05:06 -04:00
Michael DeHaan
321ed53e3a
Fetch module doesn't set invocation parameter as it invokes nothing, so don't let that be an error.
2012-04-23 21:02:39 -04:00
jkleint
e69e078569
More robust remote sudo.
...
The basic idea is sudo /bin/sh -c 'quoted_command'. We use Paramiko's low-level API to set a timeout, get a pseudo tty, execute sudo and the (shell quoted) command atomically, wait just until sudo is ready to accept the password before sending it down the pipe, and then return the command's stdout and stderr.
This should be faster, as there are no unneeded sleeps. There are no permissions issues reading the output. It will raise socket.timeout if the command takes too long. However, this is a per-read timeout, not a total execution timeout, so as long as the command is writing output and you are reading it, it will not time out.
Local and non-sudo commands remain unchanged, but should probably adopt a similar approach.
Since this is a significant change, it needs a lot of testing. Also, someone smarter than I should double-check the quoting and execution, since it is a security issue.
2012-04-23 17:32:08 -03:00
Jeroen Hoekx
2dc9a563ef
Allow modules to return facts.
...
If the module result contains "ansible_facts", that will be added to the setup
cache.
2012-04-23 21:28:12 +02:00
cocoy
c844a2d072
Fix to skip /.ssh/config if don't exist rather than raise an error.
2012-04-23 14:32:57 +08:00
cocoy
645b7a2dff
Add .ssh/config support
2012-04-23 09:48:42 +08:00
Michael DeHaan
533c2c6126
Make it possible to use facts from hosts in templates for other hosts.
...
It works like this:
{{ hostvars['127.0.0.1']['ansible_eth0']['ipv4']['address'] }}
2012-04-21 12:45:37 -04:00
Michael DeHaan
767282df2a
Small style fixes for indentation and spacing.
2012-04-21 12:06:54 -04:00
Michael DeHaan
bed5da6086
Remove unused assignment
2012-04-21 12:03:29 -04:00
Michael DeHaan
ddc0342920
Unused import
2012-04-21 12:01:37 -04:00
Michael DeHaan
1e7b60b9a5
Unused import
2012-04-21 12:01:26 -04:00
Michael DeHaan
9d0f2a6e9b
Unused import
2012-04-21 12:01:15 -04:00
Michael DeHaan
3081bb93f1
Use /var/tmp for root by default to avoid /tmp being mounted noexec, and segregate tmp files for other users
...
into their home directories.
2012-04-21 11:38:39 -04:00
Michael DeHaan
3d72260887
Make it such that modules with no arguments work fine in playbooks (like ping, which is
...
non-sensical, but also if the user wrote a module that took none)
2012-04-21 11:26:48 -04:00
Michael DeHaan
c6b8e1621d
A better fix for slurp, expand path in the module.
2012-04-20 07:54:38 -04:00
Michael DeHaan
13ba31231e
Fixup slurp module usage when not running as root, fix error handling path in slurp module.
2012-04-19 11:38:44 -04:00
Michael DeHaan
8a433ecb96
Merge branch 'align-vars-syntax' of https://github.com/jhoekx/ansible into jhoekx-align-vars-syntax
2012-04-19 09:15:48 -04:00
Jeroen Hoekx
cdb8213dcc
Supported 'listed' vars in playbooks.
2012-04-19 09:40:17 +02:00
Jeroen Hoekx
903e4f6eae
Support dicts in inventory vars.
2012-04-19 09:40:17 +02:00
Michael DeHaan
9cd492befe
make all templating happen locally, so no jinja2 deps are ever required
2012-04-18 22:43:17 -04:00
Michael DeHaan
30d06dbcea
Don't force down ansible facts back to setup, the setup module won't like parsing them on input and that
...
data is already there.
2012-04-18 22:23:33 -04:00
Michael DeHaan
5fa3d9b148
Teach playbooks to template locally to eliminate the need for Jinja2 on remote nodes.
...
You still need jinja2 if using /usr/bin/ansible vs /usr/bin/ansible-playbook though
this could change later by fetching the ansible file with a 'slurp' module.
2012-04-18 22:19:25 -04:00
Michael DeHaan
da0209dbc4
The fetch module really should preserve the whole directory structure being fetched to allow subsequent calls,
...
particularly in playbook, to recreate the host tree structure. Making it thus.
2012-04-18 21:12:48 -04:00
Jeroen Hoekx
22ff8282a8
Template template module source.
2012-04-18 14:26:33 +02:00
Jeroen Hoekx
b678cf783c
Template the source file of the copy module.
2012-04-18 11:40:15 +02:00
Michael DeHaan
de70277173
No need to save setup files to disk, this is what SETUP_CACHE effectively does.
2012-04-17 19:39:11 -04:00
Jeroen Hoekx
aa555b8b16
Inventory: AnsibleError is not global...
2012-04-17 15:29:59 +02:00
Michael DeHaan
da6cb1ca6e
Less scrolling over constructor params now that documentation follows
2012-04-16 23:51:03 -04:00
Michael DeHaan
3f26a1c7f6
verbose option is not being used, so remove it. debug variable still exists.
2012-04-16 23:47:41 -04:00
Michael DeHaan
78b5cd64d0
Add pydoc for constructors. Some arguments can be trimmed as we plan to remove the need for them (like setup_cache and
...
maybe module_vars) with various pending refactoring.
2012-04-16 23:45:15 -04:00
Michael DeHaan
9ce27be878
Remove extra_vars tests
2012-04-16 23:03:04 -04:00
Michael DeHaan
35fdf6636b
Allow --user for playbooks, no need for port setting as can specify in inventory file now.
2012-04-16 22:15:55 -04:00
Michael DeHaan
08468dcb0c
Fixes to make ports DWIM.
2012-04-16 21:52:15 -04:00
Michael DeHaan
957867e088
Merge branch 'yaml-inventory' of https://github.com/jhoekx/ansible into jhoekx-yaml-inventory
...
Conflicts:
lib/ansible/runner.py
2012-04-16 21:14:44 -04:00
Michael DeHaan
a5cb16c9d7
Use correct user to determine host files path, do not reuse .ansible
...
which is already taken for ansible management ops.
2012-04-16 21:12:54 -04:00
Michael DeHaan
6307267cf3
As part of the support for access to external nodes information, save fact data into /var/lib/ansible/setup_data
...
OR a per-user directory when running from playbooks. Technically this info is also available via the SETUP_CACHE
but that is a bit more complex of a construct and it would be better to not cross the streams.
2012-04-16 21:12:54 -04:00
Jeroen Hoekx
8c3206c99f
Return a copy of the host variables.
2012-04-16 10:59:34 +02:00
Jeroen Hoekx
961ccdb2f4
List hosts in no group in the ungrouped group.
2012-04-16 10:55:08 +02:00
Jeroen Hoekx
3a24aa9a70
Add YAML inventory format.
...
See test/yaml_hosts for an example.
Hosts can be part of multiple groups.
Groups can also have variables, inherited by the hosts.
There is no variable scope, last variable seen wins.
2012-04-16 10:38:35 +02:00
Jeroen Hoekx
54f4526160
Export SSH port number as host variable.
2012-04-16 09:16:29 +02:00
Jeroen Hoekx
f04041b37d
Ignore port numbers in simple inventory format
2012-04-16 09:16:29 +02:00
Jeroen Hoekx
746f1b92ae
Reimplement the class method on Runner.
2012-04-16 09:16:29 +02:00
Jeroen Hoekx
c5cae87eca
Refactor inventory code out of Runner.
...
This introduces the Inventory class.
Playbook uses the internals of Runner to limit the number of hosts to poll
asynchronously. To accomodate this, Inventory can be restricted to specific
hosts.
2012-04-16 09:16:28 +02:00
Michael DeHaan
d8f9d7c6c9
Use correct user to determine host files path, do not reuse .ansible
...
which is already taken for ansible management ops.
2012-04-14 16:08:04 -04:00
Rafal Lewczuk
a87c77958c
clean exec bits from lib/ansible/*.py, ignore Eclipse/PyDev files
2012-04-14 21:35:51 +02:00
Michael DeHaan
3454fa9950
As part of the support for access to external nodes information, save fact data into /var/lib/ansible/setup_data
...
OR a per-user directory when running from playbooks. Technically this info is also available via the SETUP_CACHE
but that is a bit more complex of a construct and it would be better to not cross the streams.
2012-04-14 11:58:08 -04:00