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
Michael DeHaan
6db87a5018
Minor style fix, update test to match quote fix patch
2012-03-30 21:57:34 -04:00
Matthew Williams
ec6f488d1f
shell quoting fixes
...
(edited author's original commit comment -- MPD)
2012-03-30 21:57:33 -04:00
Matthew Williams
99d5796605
support for quotes strings in command module (via posix=False), related fixes to keep other things from breaking
2012-03-30 21:57:33 -04:00
Michael DeHaan
2372a3b734
Sudo support operational in both playbooks and main program. Implementation could use some cleanup.
2012-03-29 22:59:29 -04:00
Michael DeHaan
81e3496037
Added preliminary support for --sudo to ansible, playbook support and further testing pending.
2012-03-29 01:37:06 -04:00
Michael DeHaan
72cc99722d
sudo tweaks
2012-03-28 23:30:31 -04:00
Michael DeHaan
7ae75eb14b
Default sudo is false
2012-03-28 22:55:59 -04:00
Michael DeHaan
c2a6e2f97b
Work in progress on sudo, hitting some issues with paramiko saying the connection is closed.
2012-03-28 22:51:16 -04:00
Michael DeHaan
7133734d87
Remove debug statements (WIP on sudo)
2012-03-28 20:58:34 -04:00
Michael DeHaan
4971101f27
Handler doesn't take this param.
2012-03-28 20:33:44 -04:00
Michael DeHaan
706ba9fd9a
Add paramiko/pycrypto atfork workaround (can back out later if not useful), tweak error
...
message text per skvidal's suggestion
2012-03-28 20:32:04 -04:00
Michael DeHaan
b30ddc4520
Expose remote_port option in playbook
2012-03-28 19:31:17 -04:00
Christopher Johnston
68818ad1fe
add support for remote ports in playbooks
2012-03-28 15:02:50 -07:00
Christopher Johnston
15e781eb51
add exception check for paramiko if older then 1.7
2012-03-28 14:09:11 -07:00
Christopher Johnston
f06ec76fdb
add support for using an alternate remote port
2012-03-28 14:05:31 -07:00
Michael DeHaan
b1471bf857
Add more comments to the callbacks file
2012-03-26 22:05:11 -04:00
Michael DeHaan
95670ce6b5
remove unused function
2012-03-26 21:58:28 -04:00
Michael DeHaan
f9da7cb180
remove functions that are no longer used
2012-03-26 21:56:18 -04:00
Michael DeHaan
35d77d0433
Make it an error to try to hit a change handler that doesn't exist
2012-03-26 21:31:48 -04:00
Michael DeHaan
f693759252
Style fixes from pep8 makefile target
2012-03-26 21:25:43 -04:00
Michael DeHaan
f074f1c4c4
Fixes from pyflakes
2012-03-26 21:23:28 -04:00
Michael DeHaan
35c8750bbb
Fix tree view to work with callbacks
2012-03-26 21:18:48 -04:00
Michael DeHaan
45a455a805
Make /usr/bin/ansible output realtime and also delete some code!
2012-03-26 21:17:11 -04:00
Michael DeHaan
eb67a91c57
Merge remote branch 'public/master'
2012-03-26 19:36:03 -04:00
Michael DeHaan
aaafd12b59
rm FIXMEs
2012-03-26 19:35:53 -04:00
Jeroen Hoekx
a370261dce
Playbook: create one task per include instead of per argument.
2012-03-26 10:30:48 +02:00
Michael DeHaan
6dda6f12dc
Applying callback model to runner, and using that in playbooks, so output can be more immediate in playbooks.
...
(Runner still does not use callbacks for default output)
2012-03-25 19:05:27 -04:00
Michael DeHaan
ab55fa4266
Revert "Only override the pattern if it is ommitted"
...
This reverts commit bb0bf9eef4
.
2012-03-24 16:21:44 -04:00
Michael DeHaan
bb0bf9eef4
Only override the pattern if it is ommitted
2012-03-24 16:20:47 -04:00
Michael DeHaan
9df612f007
Add a "-o" override option so hosts not in a playbook can still be managed by a playbook.
2012-03-24 16:19:38 -04:00
Michael DeHaan
292ac4aad2
Make it such that the 'name' element of each playbook line is optional.
2012-03-23 21:06:54 -04:00
Michael DeHaan
44d4dede92
Split conditional imports in playbook into subfunction, fix small bug in event reporting on playbook
...
actions.
2012-03-23 21:03:25 -04:00
Michael DeHaan
b43019f3a1
In playbooks, a return code (rc) of non-zero should fail the playbook.
2012-03-23 20:53:57 -04:00
Michael DeHaan
6ab615c724
Code cleanup for playbooks, also added 'on_skipped' callback
2012-03-23 20:51:26 -04:00
Seth Vidal
53446d6d45
make sure the setup step in a playbook has the sshpass included
2012-03-23 16:41:44 -04:00
Seth Vidal
89d4bc542c
fix up minor type - AnsibleException should be AnsibleError
2012-03-23 11:59:08 -04:00
Michael DeHaan
a8c921cbcc
Allow groups to be passed to runner API to make parse_hosts optional, misc fixes as a result of refactoring in Runner.
...
Cleanup in Playbooks module is next.
2012-03-22 00:30:05 -04:00
Michael DeHaan
94605b811b
Fixes from refactoring
2012-03-21 23:47:58 -04:00
Michael DeHaan
6a7aac38c5
misc cleanup in the runner module, splitting some things out into utils, breaking up functions into smaller functions.
2012-03-21 23:39:09 -04:00
Michael DeHaan
7ed734dfb2
move callbacks to seperate file, anticipating callbacks for Runner() as well
2012-03-21 22:18:57 -04:00
Michael DeHaan
7883f414ce
unused module
2012-03-21 21:03:32 -04:00
Michael DeHaan
e6406fa5a7
Allow variable expressions to be stored as variables themselves, do some things to allow setup strings
...
to more easily contain spaces without being mangled, which is neccessary because of the above.
2012-03-21 20:00:48 -04:00
Michael DeHaan
a5f4ca50b8
Ratchet up logging a few notches prior to controlling w/ verbosity settings
2012-03-20 22:29:21 -04:00
Michael DeHaan
b5c62ec068
Enhance logging, way to gate verbosity levels pending.
2012-03-20 21:44:01 -04:00
Michael DeHaan
dfbe591cc0
Add "only_if" capability, which allows task steps to be skipped if they do not match a conditional.
2012-03-20 19:55:04 -04:00
Michael DeHaan
149cc57b0f
remove unneeded code
2012-03-19 23:54:47 -04:00
Michael DeHaan
c05e7fd83e
Fix typing issue
2012-03-19 22:46:54 -04:00
Michael DeHaan
4de7bbb169
Allow conditional imports, see examples/playbook3.yml comments for a full explanation. Extensive
...
refactoring of playbooks now warranted, which we'll do before we move on. This variable assignment
system makes nearly all possible magic possible, for we can use these variables however we like,
even as module names!
2012-03-19 22:42:31 -04:00
Michael DeHaan
5ed2b894d9
Add an additional way to dereference a variable in a playbook, $foo
...
(Using varReplace function originally from yum, thanks Seth)
2012-03-19 19:32:38 -04:00
Michael DeHaan
af9596307d
Move templating into a utils function. Reuse is our friend.
2012-03-19 19:23:14 -04:00
Michael DeHaan
c1fe0dd719
Quote long variables in playbooks when feeding them to the setup command
2012-03-18 19:50:22 -04:00
Michael DeHaan
5371a9e497
Regression tests for playbooks, logging the events they call via callbacks.
2012-03-18 19:25:56 -04:00
Michael DeHaan
45abe3c16b
Add unit tests for playbooks, and fix an error caught by one
2012-03-18 18:29:11 -04:00
Michael DeHaan
9c5ec886a6
Import cleanup, plus have /bin/ansible remind you if no hosts were matched by a pattern (for instance, assume
...
there was a typo in the pattern)
2012-03-18 17:53:58 -04:00
Michael DeHaan
9e07b24239
Fix indentation
2012-03-18 17:25:22 -04:00
Michael DeHaan
6777268f4c
Fixup the code that allows facter/ohai/other data to bubble up and be used in future action lines. It's a niche
...
case compared to usage in templates but it should work and will be wanted later for conditional support.
2012-03-18 17:24:09 -04:00
Michael DeHaan
c861e0de55
Fix "import *" and resultant new things detectable from "make pyflakes"
2012-03-18 17:16:12 -04:00
Michael DeHaan
33aa50eae7
Inside of runner, do not 'import *' from utils, so we can more easily tell where functions come from
2012-03-18 17:04:07 -04:00
Michael DeHaan
9837a616eb
Preserve changed data on file and template ops when the mode operations don't result in a change but the files
...
were still replaced.
2012-03-18 16:58:00 -04:00
Michael DeHaan
5905974737
Fix variable referenced before assignment when not using external variables script
2012-03-31 11:03:29 -04:00
Michael DeHaan
3495d402c7
Default for class variable
2012-03-31 11:02:10 -04:00
Michael DeHaan
9f6d98844e
If the inventory file is EXECUTABLE, treat it as a file returning JSON, if called directly, return the host
...
and groups list. If called with an argument of a host name, return the key=value data for that particular
host.
2012-03-30 19:06:14 -04:00
Michael DeHaan
f39944b89b
Update example to use correct service state; minor pep8 indent/spacing fixes
2012-03-15 23:10:03 -04:00
Michael DeHaan
24923c2e17
Purge unused imports per pyflakes
2012-03-15 23:06:59 -04:00
Michael DeHaan
63818000b4
auto call the file module after copy/template module usage in runner
...
note some changed=True/False detection bits in file module still need tweaking
2012-03-15 22:32:14 -04:00
Michael DeHaan
be55145a1e
Initial crack at the file module
2012-03-15 21:53:14 -04:00
Michael DeHaan
1a0672fd1e
Fix exception type
2012-03-14 12:51:26 -04:00
Michael DeHaan
c909b66864
use iteritems vs items(), probably doesn't matter that much
2012-03-14 21:56:49 -04:00
Michael DeHaan
4bde4926c3
Modules don't have to return JSON, key=value pairs is ok.
2012-03-14 21:16:15 -04:00
Michael DeHaan
40fd778e2c
'shell' is a magic module that executes the command module with shell=True
2012-03-14 20:40:06 -04:00
Michael DeHaan
e8751baaf3
Remove remote log function as it's only used in one place now
2012-03-14 20:00:09 -04:00
Michael DeHaan
696b67f935
Fix async to use the new argfiles method (wrapping brain around rock, really must write module development guide)
2012-03-14 19:57:56 -04:00
Michael DeHaan
3ea9174ed7
Split argsfile handling into subfunction, attempt to apply argsfile logic to setup
2012-03-14 19:05:19 -04:00
Seth Vidal
a9948f97c6
convert runner to use an args file rather than just arguments passed
...
on the command line
2012-03-14 18:46:33 -04:00
Michael DeHaan
e3b4981feb
Various additions to make sure timed out and failed hosts are taken out of the playbook even if failed
...
during setup, async tasks, or poll operations. This introduced some redundancy so I've made some
notes in the code where things need to be refactored to remove them.
2012-03-13 21:30:34 -04:00
Michael DeHaan
4ae98ed92d
Upgrades to error handling, now general try/catch available.
2012-03-13 20:59:05 -04:00
Michael DeHaan
09a7119e74
Annotate more files, fix missing imports messing with playbooks. Hey Tim, please test your stuff :)
2012-03-13 19:19:54 -04:00
Tim Bielawa
dfd2c6dce3
Implement friendlier error handling.
...
Generic AnsibleError exception + host inventory missing exception.
First shot at catching these in a generic way in bin/ansible*.
2012-03-12 23:11:54 -04:00
Michael DeHaan
ce85222fa6
What we are running is actually a "play" (multiple plays per playbook) so rename the function to make it more clear
2012-03-12 22:05:51 -04:00
Michael DeHaan
adf1492da2
Add external vars example
2012-03-12 22:03:20 -04:00
Michael DeHaan
e582bd5ec5
Add fire and forget example
2012-03-12 21:02:38 -04:00
Michael DeHaan
86e19cd8c8
This adds async poll support to playbooks. See examples. Some more testing due + docs
...
but this is more or less a mirror of what /bin/ansible does. It also has a 'fire and
forget' mode if the poll interval is left off or set to 0.
2012-03-12 20:53:10 -04:00
Michael DeHaan
db7ba87111
Add polling logic in runner such that all actions get kicked off everywhere then polling
...
happens only on needed hosts, allowing some hosts to fail and drop out of the running.
2012-03-11 20:54:54 -04:00
Michael DeHaan
49a636d8a0
Fixed up async and polling logic.
2012-03-11 19:27:43 -04:00
Michael DeHaan
5be1a612d3
Add async polling logic to runner. Will add to playbook shortly, have to diagnose why paramiko
...
is not letting async_wrapper daemonize itself when it does work fine when directly executed.
2012-03-11 18:40:35 -04:00
Michael DeHaan
60a13cf540
Ignore commented out lines in the ansible setup files.
2012-03-10 21:19:41 -05:00
Michael DeHaan
4c9dd972b4
Fixes for output formatting
2012-03-10 13:40:08 -05:00
Michael DeHaan
bb5e4fad48
Abstracted out transport from implementation so it can be pluggable. Also fixes for output format.
2012-03-10 13:35:46 -05:00