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 c039aa0915
Author: Jim Richardson <weaselkeeper@gmail.com>
Date: Fri May 11 17:55:13 2012 -0700
cleanup and simplification of ANSIBLE_REMOTE_TMP feature
commit d87f15b796
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 5917aba761
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 4c2fd25777
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?
53bde0bf51
vs efde61e537
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 42b55a07cd
.
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 f41fb90d78
.
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
Michael DeHaan
31d4ee32d1
Looping! With items! See examples/playbook/loop_with_items.yml for details
2012-04-14 09:55:24 -04:00
Michael DeHaan
347637339c
Merge remote branch 'public/integration' into integration
2012-04-13 19:33:57 -04:00
Michael DeHaan
c3cad50075
Update manpages, fix missing variable assignment
2012-04-13 19:33:19 -04:00
Michael DeHaan
f2465e0571
Add support for specifying sudo passwords to both ansible & playbook. Nopasswd sudo is no longer required.
2012-04-13 19:06:11 -04:00
Jeroen Hoekx
a975852f66
Module_arguments can be unicode.
2012-04-13 15:32:33 +02:00
Michael DeHaan
6b50078881
Add defaults to command help to avoid a certain class of user questions.
2012-04-12 21:30:49 -04:00
Michael DeHaan
6129574290
Include default value for connection in help.
2012-04-12 21:20:37 -04:00
Michael DeHaan
09a0b9bea8
If the module return is not parsed, always show stderr information even if -D (debug)
...
is not specified. This will help for users that don't have prerequisites installed
(like python-simplejson on old RHEL) and do not know to run -D.
2012-04-12 21:18:09 -04:00
Stephen Fromm
0675f2511b
Merge branch 'master' into localconnection
...
Merge the SortedOptParser bits and debug attribute commits into
localconnection.
Conflicts:
bin/ansible
lib/ansible/playbook.py
lib/ansible/runner.py
lib/ansible/utils.py
2012-04-12 11:18:35 -07:00
Michael DeHaan
08c593bee1
Warn if no hosts matched
2012-04-11 21:05:46 -04:00
Michael DeHaan
f3489a53cd
English error messages if src and dest are left off the copy, template, or fetch modules
2012-04-11 20:57:41 -04:00
Michael DeHaan
a0480a1bc5
Block some paramiko warnings that are not relevant.
2012-04-11 20:20:55 -04:00
Michael DeHaan
95e045d153
Remove remote logging as we're going to move this logging to the modules for performance reasons.
2012-04-11 20:15:17 -04:00
Michael DeHaan
245aa9bf8e
Some tweaks to the fetch module. 'err' return was for stderr, so that should be empty string.
...
Some minor code shortening. Added a test to TestRunner.
2012-04-11 20:12:01 -04:00
Michael DeHaan
62224271e9
Merge pull request #131 from mgwilliams/feature-fetch-module
...
Fetch Module
2012-04-11 16:55:51 -07:00
Stephen Fromm
40fc9a3249
Update playbook to be transport aware
...
This adds transport variable to playbook.py. It can be set with
'connection' in the playbook file.
2012-04-11 09:39:04 -07:00
Matthew Williams
31d3f52b28
fetch to host specific directory
2012-04-11 09:14:36 -07:00
Matthew Williams
611e3fec4c
fetch 'module' -- working with paramiko and local connections
2012-04-10 20:23:25 -07:00
Michael DeHaan
4c75b7f3ad
Merge commit '8ae71cc' into integration
...
Conflicts:
bin/ansible
bin/ansible-playbook
lib/ansible/utils.py
2012-04-10 21:13:01 -04:00
Michael DeHaan
1d75a29ec9
Allow variables coming in from the playbook and the API to be expressed as dictionaries throughout their full life cycle
...
such that nested data can be made available in templates and playbooks.
2012-04-10 20:58:40 -04:00
Stephen Fromm
b5061bb62e
Verify that effective uid == remote_user when transport is local
...
Raise exception if effective uid of process is not the same as
remote_user.
2012-04-10 16:27:19 -07:00
Stephen Fromm
5d74fedeb9
Update Runner to default to C.DEFAULT_TRANSPORT
...
This also uses self.transport when instantiating Connection object.
2012-04-10 16:17:39 -07:00
Stephen Fromm
1391481523
Add support for -c, --connection argument to specify connection type
...
Adds support to specify connection type to use. The option -c,
--connection is added when connect_opts is set to True. connect_opts is
added to make_parser() and base_parser_options().
2012-04-10 16:13:18 -07:00
Stephen Fromm
896f8de446
Add DEFAULT_TRANSPORT and DEFAULT_TRANSPORT_OPTS constants
...
DEFAULT_TRANSPORT is set to paramiko. DEFAULT_TRANSPORT_OPTS is a list
of possible transport options; it is set to local and paramiko.
2012-04-10 16:09:20 -07:00
Stephen Fromm
9213cf896e
Change to transport is local *and* is localhost
...
Connection.connect() now requires that, in order to use LocalConnection,
you specify transport is local and that the hostname is localhost.
2012-04-10 13:20:03 -07:00
Seth Vidal
8ae71cc7b1
go back to using a normal optparser to add options instead of the dict
...
interface.
add very small subclass of OptionParser to sort the options so mdehaan is happy
2012-04-10 13:51:58 -04:00
Brad Olson
f840c0d167
Wired in Michael's usage string optparse style.
2012-04-09 23:12:05 +00:00
Michael DeHaan
6749903e57
Allow explicit request of the local connection.
2012-04-07 14:51:00 -04:00
Michael DeHaan
da9d4eb29a
Merge pull request #123 from sfromm/localconnection
...
Add LocalConnection class to connection.py
2012-04-07 11:41:13 -07:00
Stephen Fromm
70a3fab79f
Add LocalConnection class to connection.py
...
This creates a LocalConnection class for the case when operating on the
localhost. If the host, argument to Connection.connect(), matches
127.0.0.1, localhost, or the name of the host as returned by
os.uname()[1], Connection.connect() will opt to use LocalConnection
instead of ParamikoConnection. LocalConnection implements connect(),
exec_command(), put_file(), and close().
2012-04-06 16:38:27 -07:00
Michael DeHaan
7b9856bc0e
Modification on top of skvidal's common options patch to keep options to command line tools sorted.
2012-04-06 10:59:15 -04:00
Seth Vidal
7e50d170a8
move the bulk of the opt parsing out of ansible/ansible-playbook and into utils
...
for other scripts to use.
2012-04-05 17:06:23 -04:00
Jeroen Hoekx
ab86726a15
Introduce per task variables and push them to templates.
2012-04-04 13:39:03 +02:00
Jeroen Hoekx
edd5baad8b
Refactor _transfer_argsfile to generic string transfer function.
2012-04-04 13:36:21 +02:00
Michael DeHaan
09e690fd7c
Indentation error causing forks to not be parallel. Ahem :)
2012-04-03 20:20:55 -04:00
Michael DeHaan
778fe8755f
Merge pull request #110 from jhoekx/remote-vars
...
Always add vars to a play.
2012-04-03 17:07:00 -07:00
Michael DeHaan
eae1fdd734
Merge pull request #109 from jeckersb/version-0.0.2
...
Bump release to 0.0.2
2012-04-03 17:06:09 -07:00
Jeroen Hoekx
e38ae18627
Always add vars to a play.
...
A play without vars section would fail to use variables given in an include. They would be added to the dict returned by play.get, but the dict would not be added to the play.
2012-04-03 17:35:05 +02:00
John Eckersberg
82b781925c
pep8 fix
2012-04-03 09:58:00 -04:00
John Eckersberg
5aad4bacc7
Bump release to 0.0.2
2012-04-03 09:51:05 -04:00
Michael DeHaan
e5d5b072db
Merge remote branch 'public/integration'
2012-04-02 20:02:46 -04:00
Michael DeHaan
59a1ff31db
Merge pull request #103 from jeckersb/no-shebang-on-callbacks.py
...
Remove shebang from callbacks.py
2012-04-02 16:58:41 -07:00
Michael DeHaan
2f1f0d44b4
Merge pull request #106 from mgwilliams/honor-hostfile-returncode
...
raise error if executable host file execution fails
2012-04-02 16:58:20 -07:00
Matthew Williams
461a4e78c2
raise error if executable host file execution fails
2012-04-02 15:00:28 -07:00
Matthew Williams
c742b8eb0b
bugfix for extra-vars
2012-04-02 14:57:37 -07:00
Seth Vidal
bcef25f7eb
add vars_prompt to playbooks
...
- this allows some vars to be prompted for at the start of the playbook
setup
- defaults to no output since this would mostly be used for passwords
2012-04-02 17:46:02 -04:00
John Eckersberg
2dad8cc27c
Remove shebang from callbacks.py
...
It is not +x, and has no __main__. It draws ire of rpmlint.
2012-04-02 17:19:05 -04:00
Seth Vidal
04aecdcf34
before we run the actual module/command - emit what that would be to the logs
2012-04-02 13:29:12 -04:00
Michael DeHaan
2511992659
Surface module debug (-D) to /usr/bin/ansible also
2012-03-31 11:45:29 -04:00
Michael DeHaan
4a8dc50249
Merge pull request #97 from jhoekx/stderr-logging
...
Stderr logging
2012-03-31 08:01:48 -07:00
Jeroen Hoekx
74ae4b29ad
Add a debug attribute to Runner/Playbook.
...
This prints the stderr of the executed modules on local stderr.
Most methods on Runner now return a fourth "err" parameter.
2012-03-31 09:32:13 +02:00
Jeroen Hoekx
fb1a313974
Correct default user and port in playbook.
...
They are set in the constructor.
2012-03-31 09:11:07 +02:00
Michael DeHaan
6275e57718
pyflakes: Unused import / unused var
2012-03-30 23:04:02 -04:00
Michael DeHaan
9569be8bdb
Need for quoting/unquoting problems go away once module_args are all treated as strings throughout.
2012-03-30 22:52:38 -04:00
Michael DeHaan
3ded27fe35
Treat module args as strings everywhere to avoid unneccessary shlex and requoting
2012-03-30 22:47:58 -04:00
Michael DeHaan
f11de2f5c9
--extra-vars option for ansible-playbook
...
Conflicts:
lib/ansible/playbook.py
Removed unneccessary shlex and replaced with basic split, some repurcussions in runner
that can be eliminated once we consistently pass args as a string (soon).
2012-03-30 22:29:06 -04:00