Commit Graph

10545 Commits (c60954605b00f188e2b86c5a957ab177abd887e5)

Author SHA1 Message Date
Michael DeHaan 028f216689 Error handling and magic around with_items, to let you know when variables are usable inside it and when not. 13 years ago
Michael DeHaan 102b22be1f Make the logic behind vars_files smarter, so host specific vars go into the setup cache, but other variables
are usable top level.  This allows vars_files data to be used, most of the time, just fine in with_items,
(error handling pending) but is mostly a memory and efficiency thing.
13 years ago
Michael DeHaan 15b2b3a020 Warn if something loaded by vars_files is not a dictionary 13 years ago
Michael DeHaan 279b5965b8 Much streamlining around setup steps in playbooks, now only run setup once per play. 13 years ago
Michael DeHaan 931f9f1a61 Setup module no longer saves to disk, as templates are mostly useful in playbooks and this allows lots of simplifications
around file pathing and removes occasional permissions conflicts depending on how things are used.
13 years ago
Michael DeHaan 60f295f7a0 Squashed commit of the following:
commit 4430ce3eefcdff0b0ceffea0ef66ea8e876a807d
Merge: 631783b 649963c
Author: Michael DeHaan <michael.dehaan@gmail.com>
Date:   Thu Jul 12 01:28:43 2012 -0400

    Merge branch 'host-groups' of https://github.com/dagwieers/ansible into daggroups

commit 649963ca2c
Author: Dag Wieërs <dag@wieers.com>
Date:   Thu Jul 12 23:01:00 2012 +0200

    Added comments in the example yaml file as requested

commit 7f9718f185
Author: Dag Wieërs <dag@wieers.com>
Date:   Thu Jul 12 22:49:38 2012 +0200

    Add the default nose color too, to test specific overrides

commit eb63b9e899
Author: Dag Wieërs <dag@wieers.com>
Date:   Thu Jul 12 22:44:35 2012 +0200

    Introduce comics and cartoons to test yaml groups defined on a per-node basis

commit aa13d23307
Author: Dag Wieërs <dag@wieers.com>
Date:   Thu Jul 12 19:33:15 2012 +0200

    A small fix to revert to old state

commit 264ebaa77c
Author: Dag Wieërs <dag@wieers.com>
Date:   Thu Jul 12 19:31:51 2012 +0200

    Combine both yaml unit tests into one example file

commit 7db49a8048
Author: Dag Wieërs <dag@wieers.com>
Date:   Thu Jul 12 16:46:53 2012 +0200

    Might as well fix this too

commit f36c6c8c5b
Author: Dag Wieërs <dag@wieers.com>
Date:   Thu Jul 12 16:42:00 2012 +0200

    Added unit tests for host-groups patch

    For the unit test I chose to keep the original yaml file in place as a reference.

    This patch also includes a fix.

commit a96f681352
Author: Dag Wieërs <dag@wieers.com>
Date:   Thu Jul 12 12:30:43 2012 +0200

    Allow groups to be defined on a per-host basis

    This makes it possible to define on a per-host basis what groups a host is in.
    When managing a large set of systems it makes it easier to ensure each of the
    systems is defined in a set of groups (e.g. production/qa/development,
    linux/solaris/aix) rather than having to add systems to multiple disconnected
    groups.

    ----
      - host: system01

      - host: system02

      - host: system03

      - group: linux
        hosts:
        - system01
        - system02

      - group: solaris
        hosts:
        - system03

      - group: production
        hosts:
        - system01
        - system03

      - group: qa
        - system02

      - group: dbserver
        hosts:
        - system01

      - group: ntpserver
        hosts:
        - system02

      - group: webserver
        - system03
    ----

    Can be redefined as:

    ----
      - host: system01
        groups: [ linux, production, dbserver ]

      - host: system02
        groups: [ linux, qa, ntpserver ]

      - host: system03
        groups: [ solaris, production, webserver ]
    ----
13 years ago
Michael DeHaan 611e5b0c90 Make adding tags to a playbook work as shorthand to tagging all tasks in the play. 13 years ago
Michael DeHaan cf313cde96 Soft import of paramiko since we have the SSH and local connection types now. Packaging will still
require it.
13 years ago
Michael DeHaan a765deccce Allow top level playbook files to import other playbook files, added some basic
playbook structure checking.
13 years ago
Dag Wieërs cb40778b84 Wrong evaluation of a local file before fetching the remote file 13 years ago
Timothy Appnel 84fa9dcaee The default private key file was getting set incorrectly from environment variables. My bad. 13 years ago
Ingo Gottwald 26aa4e2469 Enabled cowsay support for Ubuntu 13 years ago
Michael DeHaan dc4ebab345 Merge pull request #576 from davehatton/adjust_playbook_output_formating
improve output formating for playbook
13 years ago
Michael DeHaan 969c3feb13 Allow include statements from plays to specify tags (see tags.yml example file).
Also be smart and don't run a play at all if no tasks in the play match any of the tags specified.  This includes not running the setup actions!
13 years ago
Michael DeHaan 83f23ef861 Basic support for tagging tasks and selecting a subset of tasks to run with --tags. 13 years ago
Dave Hatton 7ecdb83800 improve output formating for playbook 13 years ago
John Kleint 375a1eaf43 Use iterative MD5 hashing. 13 years ago
Dave Hatton 55694db7c3 switch to hashlib.md5 or md5 instead of OS md5 commands 13 years ago
Michael DeHaan 0d28466b22 When sudo'ing to root, keep the setup file location as /etc/ansible/setup 13 years ago
Michael DeHaan c2b8fabf66 Take a remote md5sum before a file transfer to decide whether to transfer the file or not.
Allows for efficient transfer of large files.  Templates do not sample first because they are small.
13 years ago
Michael DeHaan 8220d57690 Clean up md5 functions + make the fetch module stay happy if the remote file does not exist. 13 years ago
Michael DeHaan b551eba6d4 Comment uncommented methods in utils 13 years ago
Michael DeHaan a490213d45 Release bump to start development on 0.6 13 years ago
Michael DeHaan e3aba7770f Merge pull request #518 from brainpage/devel
adds 'groups' variable, essentially making hosts file accessible as a var
13 years ago
Daniel Hokka Zakrisson 9882dd56f6 Allow variables in variables in templates 13 years ago
alex f72b1f4fd7 Fixed: pathname for tmp 13 years ago
alex bbf2939063 Fixed: executing templates outside playbooks 13 years ago
Jonathan Palley cedbcfcc0a adds 'groups' variable, essentially making hosts file accessible as a variable 13 years ago
Michael DeHaan a5dd280149 Fix up the output of the raw module when run within /usr/bin/ansible 13 years ago
Michael DeHaan efac68b636 Remove the -D module debug flag, which no longer is functional due to sudo pty requirements, and replace with -v/--verbose.
This flag will show playbook output from non-failing commands.  -v is also added to /usr/bin/ansible, but not  yet used.

I also gutted some internals code dealing with 'invocations' which allowed the callback to know what module invoked
it.  This is not something 0.5 does or needed, so callbacks have been simplified.
13 years ago
Jeroen Hoekx d592e15dcc Correctly add ungrouped hosts to 'ungrouped' in YAML inventory. 13 years ago
Michael DeHaan afb2e3e5ac Merge pull request #511 from dsummersl/devel
added ability to ovverride all ssh settings via ANSIBLE_SSH_ARGS
13 years ago
Dane Summers 37fce9c0f6 added ability to ovverride all ssh settings via ANSIBLE_SSH_ARGS 13 years ago
Michael DeHaan 8468e2255b Merge pull request #507 from jhoekx/convention-library-path
Add ./library to module search path.
13 years ago
Jeroen Hoekx 879ddddf6f Add ./library to module search path.
It allows for custom modules in the best practices directory structure.
Bundling custom modules along with playbooks in packages is useful.
13 years ago
Jeroen Hoekx 6c92d2fa88 Import ansible errors in Poller. 13 years ago
Michael DeHaan 618924a24f Merge pull request #497 from davehatton/change_constants
shouldn't need a (slash) before /home/daveh
13 years ago
Dave Hatton d42df3a82e change to STDOUT from PIPE to get ssh connection module working 13 years ago
Dave Hatton d28bbe14ed shouldn't need a (slash) before /home/daveh 13 years ago
Dave Hatton 30d4f070a1 change STDOUT to PIPE to get ssh connection module working 13 years ago
Daniel Hokka Zakrisson fa887bc90f Merge stdout and stderr for non-sudo 13 years ago
Daniel Hokka Zakrisson 7884bc02ea Wait for process to finish and then parse output 13 years ago
Seth Vidal dca75033fe add -q to handle stdout/stderr being combined, add catch for ControlPersist not existing in ssh for rhel6, etc 13 years ago
Michael DeHaan 9662902c31 Merge pull request #492 from dhozac/unnecessary-parse_json
Remove unnecessary parse_json invocation
13 years ago
Michael DeHaan 071978a2e7 Merge pull request #493 from dhozac/ssh-merge-stdouterr
Merge stdout and stderr as that is what is expected
13 years ago
Daniel Hokka Zakrisson f5ecd075f7 Remove unnecessary parse_json invocation 13 years ago
Michael DeHaan bd653c8f3c Merge pull request #488 from dhozac/jinja2-env
Create a Jinja2 environment allowing includes
13 years ago
Michael DeHaan e0f12292d8 Merge pull request #489 from dhozac/ssh-args-default
Default to using a ControlMaster connection
13 years ago
Daniel Hokka Zakrisson 7f6359b143 Default to using a ControlMaster connection 13 years ago
Daniel Hokka Zakrisson d08ba12a42 Merge stdout and stderr as that is what is expected
Should also fix problems where something might output an error
before the sudo prompt.
13 years ago
Seth Vidal 1ec518543e make Runner options conflict errors raise AnsibleErrors not traceback in general
add catch if -c ssh and -k are passed at the same time since the ssh connection type doesn't
support passwords
13 years ago
Daniel Hokka Zakrisson 9f93839d13 Create a Jinja2 environment allowing includes 13 years ago
Daniel Hokka Zakrisson ab08fea1aa Add an ssh command wrapper transport 13 years ago
Daniel Hokka Zakrisson 13b814a33c Run templating function until the text doesn't change
This allows variables to contain other variables.
13 years ago
Michael DeHaan dad9695ac7 Merge pull request #478 from dhozac/not-host
Allow exclusion of hosts/groups
13 years ago
Jonte Norman 1b091a7e3e Fixed typo from results to result in _execute_raw method 13 years ago
Daniel Hokka Zakrisson 3d5c93bf44 Allow exclusion of hosts/groups 13 years ago
Fred Alger 834f6a216d Make shell outs to md5sum work on FreeBSD and OS X
Tested with OS X local connection and Linux remote. The paths to the
md5sum and md5 commands are hardcoded to the most common location. This
will definitely fail if the commands are elsewhere, or if the md5
command doesn't support the -q 'quiet' option.
13 years ago
Michael DeHaan c0a5d91592 Merge pull request #475 from nafeger/devel
Better error messaging in utils
13 years ago
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.
13 years ago
Michael DeHaan 2a8d1f07d4 Merge branch 'mktemp-vanish' of https://github.com/dagwieers/ansible into devel
Conflicts:
	lib/ansible/runner/__init__.py
13 years ago
Michael DeHaan 27c949ade9 Merge pull request #462 from tima/more-env-defaults
Most constants can be overriden with environment variables.
13 years ago
Michael DeHaan 2a49438c37 Merge pull request #461 from dhozac/only_if-early
Evaluate only_if early
13 years ago
Michael DeHaan bd893b765b Merge pull request #459 from dhozac/with_items-variable
Allow a variable in with_items
13 years ago
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.
13 years ago
Timothy Appnel 5ea8ad2d94 Most constants can be overriden with environment variables. Reserved doing anything with the connection options for further review. 13 years ago
Daniel Hokka Zakrisson 7942570411 Fix on_unreachable invocation with non-existing variable 13 years ago
Daniel Hokka Zakrisson eba81ee36f Evaluate only_if early to do as little work as possible 13 years ago
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.
13 years ago
Daniel Hokka Zakrisson a05da2d312 Allow with_items to specify a variable 13 years ago
Daniel Hokka Zakrisson 933b5e8631 Reduce code duplication 13 years ago
Michael DeHaan e8e6c98016 Merge pull request #455 from dhozac/vars_files-non-list
Expand vars_files identically for lists and non-lists
13 years ago
Michael DeHaan 01387520e9 Merge pull request #451 from phred/fix-fetch-module
Make 'fetch' test for local directories before creating.  Fixes issue #450
13 years ago
Michael DeHaan e265cdfa1d Merge pull request #454 from jhoekx/configure-python-interpreter
Introduce ansible_python_interpreter variable.
13 years ago
Michael DeHaan b1c2820a32 Merge pull request #456 from dhozac/notify-variable
Allow variables in notify list
13 years ago
Daniel Hokka Zakrisson d0d036fd3f Expand $item for copy and fetch 13 years ago
Daniel Hokka Zakrisson ad7b744764 Allow variables in notify list 13 years ago
Daniel Hokka Zakrisson dff8d7be04 Expand vars_files identically for lists and non-lists 13 years ago
Jeroen Hoekx 1f63c47738 Introduce ansible_python_interpreter variable.
This allows configuration of the correct python interpreter on the managed system.
13 years ago
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
13 years ago
Fred Alger bee04de26a Fix exception in fetch module when src or dest parameter omitted. 13 years ago
Fred Alger d0c4f4015c Fix remote md5 in fetch module, related to Issue #450 13 years ago
Fred Alger 51b460e8c6 Make 'fetch' test for local directories before creating. Fixes issue #450 13 years ago
John Kleint e9f770fa11 More helpful message when ssh fails. 13 years ago
Michael DeHaan 1ee7ff2f7b To allow plays using different user accounts in the same playbook to function, clear the setup cache
between plays.
13 years ago
Michael DeHaan 16f0d7b333 Revert "Get rid of mktemp dependency to support AIX"
This reverts commit 4ad1b57b52.
13 years ago
Michael DeHaan 99430fa0a3 Fix for older version of sudo + some changes to imports so tests are happy 13 years ago
Michael DeHaan 634cf9aaba Merge pull request #437 from dagwieers/mktemp-vanish
Get rid of mktemp dependency to support AIX
13 years ago
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.
13 years ago
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
13 years ago
Michael DeHaan 6034b5b0f3 Split connection code into submodules. 13 years ago
Michael DeHaan 0972b761de Leverage cowsay if installed. 13 years ago
Brad Olson c34921fe7b Removed legacy comment. 13 years ago
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.
13 years ago
Michael DeHaan af9651f015 Merge pull request #420 from bradobro/fix_no_varfiles
Test for play.vars_files == None, avoiding nasty traceback.
13 years ago
Brad Olson 7ea4a0e895 Avoid traceback when vars file has no vars items. Could warn or fail instead. 13 years ago
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)?
13 years ago
Cosmin Luță 74bfd7eb81 Removed line that caused stacktrace 13 years ago
Michael DeHaan 4664e354c3 Get with_items to work with new play/task architecture. 13 years ago
Michael DeHaan ecb944892d Tweaks on previous refactoring of playbook, version bump a 0.4 reference, remove some debug, etc 13 years ago
Michael DeHaan b9b53d1941 Playbook refactoring -- work in progress. 13 years ago
Michael DeHaan cf9ddf3a30 Reorganizing file structure. Not done. 13 years ago
Michael DeHaan 6f114a2e2c Delete poller code from runner.py now that it is moved. 13 years ago
Michael DeHaan db1d5b154a Fix casing/underscore convention in method name, split polling logic away from runner. 13 years ago
Michael DeHaan 6d580aea02 As part of a precursor to other refactoring, make returns less list-like throughout runner. 13 years ago
Matt Goodall 639763c138 Allow "=" in k-v values. 13 years ago
Matthew Williams 7bbcf5d2d5 template path for handlers: include 13 years ago
Michael DeHaan 1125ca548a Merge pull request #411 from mgwilliams/bug-fetch-module
Fetch module: run dwim on dest after templating, not before
13 years ago
Matthew Williams effd931031 dim fetch dest after templating 13 years ago
Michael DeHaan 8e88667f82 Fix hosts being in multiple groups, and duplicate host references in the same inventory file. 13 years ago
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
13 years ago
Adam Denenberg 3dfd240b86 updated connection.py to have the same interface for exec_command on both LocalConnection and ParamikoConnection classes 13 years ago
Jeroen Hoekx 3eff44a2b0 Arguments to setup module should be json. 13 years ago
Seth Vidal d80fd74b64 make sure private_key_file is hooked up in playbooks, too 13 years ago
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
13 years ago
Daniel Néri e4991d1a61 In the template module, use utils.template_from_file instead of reimplementing it inline 13 years ago
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.
13 years ago
Daniel Néri 4b0480dd9d Set 'hostvars' before performing variable replacements 13 years ago
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
13 years ago
Michael DeHaan ccab8ac2c0 Reinstate raw module 13 years ago
Michael DeHaan b7bb0ab225 Do not read user's SSH config file because only reading it partially is confusing to everyone :) 13 years ago
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.
13 years ago
Michael DeHaan f8807da57b Merge pull request #363 from jhoekx/template-only-if
Fix correct variable expansion in includes only_if.
13 years ago
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.
13 years ago
Michael DeHaan dab50574e0 Merge pull request #356 from jkleint/singleton-notify
Support single handlers for notify.
13 years ago
John Kleint d9427db14b Support single handlers for notify. 13 years ago
John Kleint 4cf0c5550e Fix YAML hosts list. 13 years ago
Jeroen Hoekx 3cbc229990 Support list indexing in varReplace. 13 years ago
Michael DeHaan 4819ce4989 Merge pull request #349 from jhoekx/template-unicode-fixes
Fixup unicode varReplace templating.
13 years ago
cocoy c1fd1348b1 Fix for bug #264 13 years ago
Jeroen Hoekx 74e21e6154 Fixup unicode varReplace templating.
The original patches should have conflicted?
53bde0bf51 vs efde61e537
13 years ago
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.
13 years ago
Michael DeHaan 36639186e0 Merge pull request #362 from jhoekx/uppercase-vars
Allow camelCase variables in varReplace.
13 years ago
John Kleint fba2bdcf0c Don't read from Paramiko's stderr since there isn't one. 13 years ago
Jeroen Hoekx dc60f2d844 Allow camelCase variables in varreplace. 13 years ago
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.
13 years ago
Michael DeHaan cb6f0f4284 Merge pull request #346 from jhoekx/improve-varreplace
Support nested variables in varReplace
13 years ago
Jeroen Hoekx 2bbc05185e Make no_engine the default templating action. 13 years ago
Jeroen Hoekx 82144fd543 Support nested variables in varReplace. 13 years ago
Jeroen Hoekx 98f93fcc07 Preserve trailing newline after templating.
Jinja seems to eat trailing whitespace. A lot of tools complain about this: iptables-restore, iscsid...
13 years ago
Matthew Williams e56023b8bb Template dest and src parameters 13 years ago
Michael DeHaan d149c1823a Merge pull request #339 from mgwilliams/feature-unicode
Allow unicode (utf8) in templates
13 years ago
Matthew Williams 43b1727f6a removed debug code 13 years ago
Matthew Williams 39a92f9cd6 allow unicode (utf8) characters in jinja templates 13 years ago
Michael DeHaan 0894206467 Be able to use --extra-vars to set the hosts variable 13 years ago
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.
13 years ago
Michael DeHaan fc300723da Revert "fix indentation"
This reverts commit 42b55a07cd.
13 years ago
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.
13 years ago
Michael DeHaan 121d7c4ece Merge pull request #329 from skvidal/devel
inventory and indentation
13 years ago
Jeroen Hoekx e09572a8e1 Inventory: undefined group -> ungrouped.
Also change test name collision.
13 years ago
Jeroen Hoekx d419a13ca7 Inventory: support list of vars in host. 13 years ago
John Kleint 710d085def Fix non-sudo execution, add --sudo-user to ansible-playbook. 13 years ago
Seth Vidal cd28d82639 fix indentation 13 years ago
Seth Vidal 279e5e4522 fix the get_hosts() error in get_groups returning a dict not a list of group objects 13 years ago
Michael DeHaan 05545e3735 Fixup the previous sudo_user support patch to work with playbooks. 13 years ago
Jim Richardson 5582e6a4f1 sudo -u works now. Needs testing and maybe a bit of cleanup 13 years ago
Jim Richardson 2cd8d7b5e4 first bit of getting sudo -u functionality 13 years ago
Jim Richardson 8d39ae709c sudo -u works now. Needs testing and maybe a bit of cleanup 13 years ago
Jim Richardson 93a20a33e9 first bit of getting sudo -u functionality 13 years ago
Michael DeHaan f718fc99b7 Add missing file 13 years ago
Michael DeHaan 157d21b1c3 Add tests for new advanced inventory features (groups of groups, group variables) in the default INI format file. 13 years ago
Michael DeHaan 1a00e2635e Further work on making the YAML inventory parser use the new inventory objects. 13 years ago
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.
13 years ago
Michael DeHaan 256377166a Reinstate external inventory script support this time using the new more OO-ey inventory system.
Next up: YAML format.
13 years ago
Michael DeHaan 5730a29814 missing files 13 years ago
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.
13 years ago
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
13 years ago
Michael DeHaan 02efcdced6 Merge branch 'devel' of https://github.com/skvidal/ansible into skvidal-devel 13 years ago
Seth Vidal 38ea61054f if a playbook has no vars - still include the global vars 13 years ago
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.
13 years ago
Jeroen Hoekx 03541baba7 Define 'inventory_hostname' variable for hosts. 13 years ago
John Kleint cbbaee8a9f Remove command timeout. 13 years ago
Jeroen Hoekx f14c1e3e91 Async: print one poll message per polling cycle.
Instead of one per host per polling cycle.
13 years ago
Jeroen Hoekx 029fe1273c Modify /usr/bin/ansible and playbooks to use the new async API. 13 years ago
Jeroen Hoekx ce9a8c9ffc Introduce Async API in Runner. 13 years ago
Jeroen Hoekx b87710a1df Introduce group_names in template variables.
This is a list of all the groups a host is in.
13 years ago
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.
13 years ago
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.
13 years ago
Michael DeHaan 076f1bc169 Revert "Revert "Unify normal and sudo remote command execution. Breaks stderr/stdout handling"
This reverts commit 40f603539c.
13 years ago
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
13 years ago
Michael DeHaan 40f603539c Revert "Unify normal and sudo remote command execution. Breaks stderr/stdout handling
This reverts commit 44486223ed.
13 years ago
Michael DeHaan e16114034c Revert "Actually wait for password prompt in remote sudo execution. Totally breaks stderr debugging
and various modules.

This reverts commit 6341a9547f.
13 years ago
Michael DeHaan f939f3fdaf Playbook can now take a 'name' which it will show when starting the play 13 years ago
Michael DeHaan 67d1169674 fix code handling if module_vars is None 13 years ago
Michael DeHaan aa8ae85070 Add playbook example for first_available_file 13 years ago
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.
13 years ago
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
13 years ago
Michael DeHaan 40f5469869 minor personal style preference on 'not' 13 years ago
Reed Murphy abf524405a shlex.split() tries to read from stdin if passed None 13 years ago
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
13 years ago
Michael DeHaan 5aa5a48f7f Merge pull request #250 from jkleint/devel
Service module crashes if args has no "=".
13 years ago
Michael DeHaan a4b3b7a2cf Local connection doesn't need a port. 13 years ago
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.
13 years ago
cocoy 1220a46e3a Bugfix for issue #245.
Do not override the value of user and hostname.
Get port and identityfile only.
13 years ago
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.
13 years ago
Seth Vidal fa2aebc8a6 fix for issue #230 - handle template taking 3 args 13 years ago
Michael DeHaan 87b1cf45a4 Merge pull request #226 from cread/make-osx-tests-pass
Use the $HOME env var instead of hard coding /home/<username>
13 years ago
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 ';'.
13 years ago
Chris Read dbb4afff50 Use the /Users/cread env var instead of hard coding /home/<username> 13 years ago
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.
13 years ago
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
13 years ago
Michael DeHaan 02abb5a83b Merge pull request #217 from jhoekx/connection-fixes
Expand user in ssh identity file
13 years ago
Jeroen Hoekx 973b1fe02e Fix incorrect merge of custom-facts branch.
This fixes #216.
13 years ago
Jeroen Hoekx c2f1aefaf1 Expand user in SSH identity file. 13 years ago
Jeroen Hoekx 1804df0bae Whitespace fixes in connection.py 13 years ago
Matt Coddington d34160ed26 cast ssh port number as integer 13 years ago
Michael DeHaan 89c013035e Merge branch 'integration' of https://github.com/cocoy/ansible into cocoy-integration 13 years ago
Michael DeHaan bced4c9db1 Merge branch 'jhoekx-custom-facts' into devel 13 years ago
Michael DeHaan 49cca98f1e Merge branch 'custom-facts' of https://github.com/jhoekx/ansible into jhoekx-custom-facts
Conflicts:
	lib/ansible/runner.py
13 years ago
Michael DeHaan 346df537b4 Merge branch 'integration' of https://github.com/jkleint/ansible into jkleint-integration 13 years ago
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)
13 years ago
Michael DeHaan 4d62510997 Version bump for 0.3 release 13 years ago
Michael DeHaan a8707e48e8 Fix merge issue 13 years ago
Michael DeHaan c00699d0ef Merge branch 'integration'
Conflicts:
	lib/ansible/playbook.py
	lib/ansible/runner.py
	library/apt
13 years ago
Michael DeHaan 321ed53e3a Fetch module doesn't set invocation parameter as it invokes nothing, so don't let that be an error. 13 years ago
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.
13 years ago
Jeroen Hoekx 2dc9a563ef Allow modules to return facts.
If the module result contains "ansible_facts", that will be added to the setup
cache.
13 years ago
cocoy c844a2d072 Fix to skip /.ssh/config if don't exist rather than raise an error. 13 years ago
cocoy 645b7a2dff Add .ssh/config support 13 years ago
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'] }}
13 years ago
Michael DeHaan 767282df2a Small style fixes for indentation and spacing. 13 years ago
Michael DeHaan bed5da6086 Remove unused assignment 13 years ago
Michael DeHaan ddc0342920 Unused import 13 years ago
Michael DeHaan 1e7b60b9a5 Unused import 13 years ago
Michael DeHaan 9d0f2a6e9b Unused import 13 years ago
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.
13 years ago
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)
13 years ago
Michael DeHaan c6b8e1621d A better fix for slurp, expand path in the module. 13 years ago
Michael DeHaan 13ba31231e Fixup slurp module usage when not running as root, fix error handling path in slurp module. 13 years ago
Michael DeHaan 8a433ecb96 Merge branch 'align-vars-syntax' of https://github.com/jhoekx/ansible into jhoekx-align-vars-syntax 13 years ago
Jeroen Hoekx cdb8213dcc Supported 'listed' vars in playbooks. 13 years ago
Jeroen Hoekx 903e4f6eae Support dicts in inventory vars. 13 years ago
Michael DeHaan 9cd492befe make all templating happen locally, so no jinja2 deps are ever required 13 years ago
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.
13 years ago
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.
13 years ago
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.
13 years ago
Jeroen Hoekx 22ff8282a8 Template template module source. 13 years ago
Jeroen Hoekx b678cf783c Template the source file of the copy module. 13 years ago
Michael DeHaan de70277173 No need to save setup files to disk, this is what SETUP_CACHE effectively does. 13 years ago
Jeroen Hoekx aa555b8b16 Inventory: AnsibleError is not global... 13 years ago
Michael DeHaan da6cb1ca6e Less scrolling over constructor params now that documentation follows 13 years ago
Michael DeHaan 3f26a1c7f6 verbose option is not being used, so remove it. debug variable still exists. 13 years ago
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.
13 years ago
Michael DeHaan 9ce27be878 Remove extra_vars tests 13 years ago
Michael DeHaan 35fdf6636b Allow --user for playbooks, no need for port setting as can specify in inventory file now. 13 years ago
Michael DeHaan 08468dcb0c Fixes to make ports DWIM. 13 years ago
Michael DeHaan 957867e088 Merge branch 'yaml-inventory' of https://github.com/jhoekx/ansible into jhoekx-yaml-inventory
Conflicts:
	lib/ansible/runner.py
13 years ago
Michael DeHaan a5cb16c9d7 Use correct user to determine host files path, do not reuse .ansible
which is already taken for ansible management ops.
13 years ago
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.
13 years ago
Jeroen Hoekx 8c3206c99f Return a copy of the host variables. 13 years ago
Jeroen Hoekx 961ccdb2f4 List hosts in no group in the ungrouped group. 13 years ago
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.
13 years ago
Jeroen Hoekx 54f4526160 Export SSH port number as host variable. 13 years ago
Jeroen Hoekx f04041b37d Ignore port numbers in simple inventory format 13 years ago
Jeroen Hoekx 746f1b92ae Reimplement the class method on Runner. 13 years ago
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.
13 years ago
Michael DeHaan d8f9d7c6c9 Use correct user to determine host files path, do not reuse .ansible
which is already taken for ansible management ops.
13 years ago
Rafal Lewczuk a87c77958c clean exec bits from lib/ansible/*.py, ignore Eclipse/PyDev files 13 years ago
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.
13 years ago
Michael DeHaan 31d4ee32d1 Looping! With items! See examples/playbook/loop_with_items.yml for details 13 years ago
Michael DeHaan 347637339c Merge remote branch 'public/integration' into integration 13 years ago
Michael DeHaan c3cad50075 Update manpages, fix missing variable assignment 13 years ago
Michael DeHaan f2465e0571 Add support for specifying sudo passwords to both ansible & playbook. Nopasswd sudo is no longer required. 13 years ago
Jeroen Hoekx a975852f66 Module_arguments can be unicode. 13 years ago
Michael DeHaan 6b50078881 Add defaults to command help to avoid a certain class of user questions. 13 years ago
Michael DeHaan 6129574290 Include default value for connection in help. 13 years ago
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.
13 years ago
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
13 years ago
Michael DeHaan 08c593bee1 Warn if no hosts matched 13 years ago
Michael DeHaan f3489a53cd English error messages if src and dest are left off the copy, template, or fetch modules 13 years ago
Michael DeHaan a0480a1bc5 Block some paramiko warnings that are not relevant. 13 years ago
Michael DeHaan 95e045d153 Remove remote logging as we're going to move this logging to the modules for performance reasons. 13 years ago
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.
13 years ago
Michael DeHaan 62224271e9 Merge pull request #131 from mgwilliams/feature-fetch-module
Fetch Module
13 years ago
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.
13 years ago
Matthew Williams 31d3f52b28 fetch to host specific directory 13 years ago
Matthew Williams 611e3fec4c fetch 'module' -- working with paramiko and local connections 13 years ago
Michael DeHaan 4c75b7f3ad Merge commit '8ae71cc' into integration
Conflicts:
	bin/ansible
	bin/ansible-playbook
	lib/ansible/utils.py
13 years ago
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.
13 years ago
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.
13 years ago
Stephen Fromm 5d74fedeb9 Update Runner to default to C.DEFAULT_TRANSPORT
This also uses self.transport when instantiating Connection object.
13 years ago
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().
13 years ago
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.
13 years ago
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.
13 years ago
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
13 years ago
Brad Olson f840c0d167 Wired in Michael's usage string optparse style. 13 years ago
Michael DeHaan 6749903e57 Allow explicit request of the local connection. 13 years ago
Michael DeHaan da9d4eb29a Merge pull request #123 from sfromm/localconnection
Add LocalConnection class to connection.py
13 years ago
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().
13 years ago
Michael DeHaan 7b9856bc0e Modification on top of skvidal's common options patch to keep options to command line tools sorted. 13 years ago
Seth Vidal 7e50d170a8 move the bulk of the opt parsing out of ansible/ansible-playbook and into utils
for other scripts to use.
13 years ago
Jeroen Hoekx ab86726a15 Introduce per task variables and push them to templates. 13 years ago
Jeroen Hoekx edd5baad8b Refactor _transfer_argsfile to generic string transfer function. 13 years ago
Michael DeHaan 09e690fd7c Indentation error causing forks to not be parallel. Ahem :) 13 years ago
Michael DeHaan 778fe8755f Merge pull request #110 from jhoekx/remote-vars
Always add vars to a play.
13 years ago
Michael DeHaan eae1fdd734 Merge pull request #109 from jeckersb/version-0.0.2
Bump release to 0.0.2
13 years ago
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.
13 years ago
John Eckersberg 82b781925c pep8 fix 13 years ago
John Eckersberg 5aad4bacc7 Bump release to 0.0.2 13 years ago
Michael DeHaan e5d5b072db Merge remote branch 'public/integration' 13 years ago
Michael DeHaan 59a1ff31db Merge pull request #103 from jeckersb/no-shebang-on-callbacks.py
Remove shebang from callbacks.py
13 years ago
Michael DeHaan 2f1f0d44b4 Merge pull request #106 from mgwilliams/honor-hostfile-returncode
raise error if executable host file execution fails
13 years ago
Matthew Williams 461a4e78c2 raise error if executable host file execution fails 13 years ago
Matthew Williams c742b8eb0b bugfix for extra-vars 13 years ago
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
13 years ago
John Eckersberg 2dad8cc27c Remove shebang from callbacks.py
It is not +x, and has no __main__.  It draws ire of rpmlint.
13 years ago
Seth Vidal 04aecdcf34 before we run the actual module/command - emit what that would be to the logs 13 years ago
Michael DeHaan 2511992659 Surface module debug (-D) to /usr/bin/ansible also 13 years ago
Michael DeHaan 4a8dc50249 Merge pull request #97 from jhoekx/stderr-logging
Stderr logging
13 years ago
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.
13 years ago
Jeroen Hoekx fb1a313974 Correct default user and port in playbook.
They are set in the constructor.
13 years ago
Michael DeHaan 6275e57718 pyflakes: Unused import / unused var 13 years ago
Michael DeHaan 9569be8bdb Need for quoting/unquoting problems go away once module_args are all treated as strings throughout. 13 years ago
Michael DeHaan 3ded27fe35 Treat module args as strings everywhere to avoid unneccessary shlex and requoting 13 years ago
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).
13 years ago
Michael DeHaan 6db87a5018 Minor style fix, update test to match quote fix patch 13 years ago
Matthew Williams ec6f488d1f shell quoting fixes
(edited author's original commit comment -- MPD)
13 years ago
Matthew Williams 99d5796605 support for quotes strings in command module (via posix=False), related fixes to keep other things from breaking 13 years ago
Michael DeHaan 2372a3b734 Sudo support operational in both playbooks and main program. Implementation could use some cleanup. 13 years ago
Michael DeHaan 81e3496037 Added preliminary support for --sudo to ansible, playbook support and further testing pending. 13 years ago
Michael DeHaan 72cc99722d sudo tweaks 13 years ago
Michael DeHaan 7ae75eb14b Default sudo is false 13 years ago
Michael DeHaan c2a6e2f97b Work in progress on sudo, hitting some issues with paramiko saying the connection is closed. 13 years ago
Michael DeHaan 7133734d87 Remove debug statements (WIP on sudo) 13 years ago
Michael DeHaan 4971101f27 Handler doesn't take this param. 13 years ago
Michael DeHaan 706ba9fd9a Add paramiko/pycrypto atfork workaround (can back out later if not useful), tweak error
message text per skvidal's suggestion
13 years ago
Michael DeHaan b30ddc4520 Expose remote_port option in playbook 13 years ago
Christopher Johnston 68818ad1fe add support for remote ports in playbooks 13 years ago
Christopher Johnston 15e781eb51 add exception check for paramiko if older then 1.7 13 years ago
Christopher Johnston f06ec76fdb add support for using an alternate remote port 13 years ago
Michael DeHaan b1471bf857 Add more comments to the callbacks file 13 years ago
Michael DeHaan 95670ce6b5 remove unused function 13 years ago
Michael DeHaan f9da7cb180 remove functions that are no longer used 13 years ago
Michael DeHaan 35d77d0433 Make it an error to try to hit a change handler that doesn't exist 13 years ago
Michael DeHaan f693759252 Style fixes from pep8 makefile target 13 years ago
Michael DeHaan f074f1c4c4 Fixes from pyflakes 13 years ago
Michael DeHaan 35c8750bbb Fix tree view to work with callbacks 13 years ago
Michael DeHaan 45a455a805 Make /usr/bin/ansible output realtime and also delete some code! 13 years ago
Michael DeHaan eb67a91c57 Merge remote branch 'public/master' 13 years ago
Michael DeHaan aaafd12b59 rm FIXMEs 13 years ago
Jeroen Hoekx a370261dce Playbook: create one task per include instead of per argument. 13 years ago
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)
13 years ago
Michael DeHaan ab55fa4266 Revert "Only override the pattern if it is ommitted"
This reverts commit bb0bf9eef4.
13 years ago
Michael DeHaan bb0bf9eef4 Only override the pattern if it is ommitted 13 years ago
Michael DeHaan 9df612f007 Add a "-o" override option so hosts not in a playbook can still be managed by a playbook. 13 years ago
Michael DeHaan 292ac4aad2 Make it such that the 'name' element of each playbook line is optional. 13 years ago
Michael DeHaan 44d4dede92 Split conditional imports in playbook into subfunction, fix small bug in event reporting on playbook
actions.
13 years ago
Michael DeHaan b43019f3a1 In playbooks, a return code (rc) of non-zero should fail the playbook. 13 years ago
Michael DeHaan 6ab615c724 Code cleanup for playbooks, also added 'on_skipped' callback 13 years ago
Seth Vidal 53446d6d45 make sure the setup step in a playbook has the sshpass included 13 years ago
Seth Vidal 89d4bc542c fix up minor type - AnsibleException should be AnsibleError 13 years ago
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.
13 years ago
Michael DeHaan 94605b811b Fixes from refactoring 13 years ago
Michael DeHaan 6a7aac38c5 misc cleanup in the runner module, splitting some things out into utils, breaking up functions into smaller functions. 13 years ago
Michael DeHaan 7ed734dfb2 move callbacks to seperate file, anticipating callbacks for Runner() as well 13 years ago
Michael DeHaan 7883f414ce unused module 13 years ago
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.
13 years ago
Michael DeHaan a5f4ca50b8 Ratchet up logging a few notches prior to controlling w/ verbosity settings 13 years ago
Michael DeHaan b5c62ec068 Enhance logging, way to gate verbosity levels pending. 13 years ago
Michael DeHaan dfbe591cc0 Add "only_if" capability, which allows task steps to be skipped if they do not match a conditional. 13 years ago
Michael DeHaan 149cc57b0f remove unneeded code 13 years ago
Michael DeHaan c05e7fd83e Fix typing issue 13 years ago
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!
13 years ago
Michael DeHaan 5ed2b894d9 Add an additional way to dereference a variable in a playbook, $foo
(Using varReplace function originally from yum, thanks Seth)
13 years ago
Michael DeHaan af9596307d Move templating into a utils function. Reuse is our friend. 13 years ago
Michael DeHaan c1fe0dd719 Quote long variables in playbooks when feeding them to the setup command 13 years ago
Michael DeHaan 5371a9e497 Regression tests for playbooks, logging the events they call via callbacks. 13 years ago
Michael DeHaan 45abe3c16b Add unit tests for playbooks, and fix an error caught by one 13 years ago
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)
13 years ago
Michael DeHaan 9e07b24239 Fix indentation 13 years ago
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.
13 years ago
Michael DeHaan c861e0de55 Fix "import *" and resultant new things detectable from "make pyflakes" 13 years ago
Michael DeHaan 33aa50eae7 Inside of runner, do not 'import *' from utils, so we can more easily tell where functions come from 13 years ago
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.
13 years ago
Michael DeHaan 5905974737 Fix variable referenced before assignment when not using external variables script 13 years ago
Michael DeHaan 3495d402c7 Default for class variable 13 years ago
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.
13 years ago
Michael DeHaan f39944b89b Update example to use correct service state; minor pep8 indent/spacing fixes 13 years ago
Michael DeHaan 24923c2e17 Purge unused imports per pyflakes 13 years ago
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
13 years ago
Michael DeHaan be55145a1e Initial crack at the file module 13 years ago
Michael DeHaan 1a0672fd1e Fix exception type 13 years ago
Michael DeHaan c909b66864 use iteritems vs items(), probably doesn't matter that much 13 years ago
Michael DeHaan 4bde4926c3 Modules don't have to return JSON, key=value pairs is ok. 13 years ago
Michael DeHaan 40fd778e2c 'shell' is a magic module that executes the command module with shell=True 13 years ago
Michael DeHaan e8751baaf3 Remove remote log function as it's only used in one place now 13 years ago
Michael DeHaan 696b67f935 Fix async to use the new argfiles method (wrapping brain around rock, really must write module development guide) 13 years ago
Michael DeHaan 3ea9174ed7 Split argsfile handling into subfunction, attempt to apply argsfile logic to setup 13 years ago
Seth Vidal a9948f97c6 convert runner to use an args file rather than just arguments passed
on the command line
13 years ago
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.
13 years ago
Michael DeHaan 4ae98ed92d Upgrades to error handling, now general try/catch available. 13 years ago
Michael DeHaan 09a7119e74 Annotate more files, fix missing imports messing with playbooks. Hey Tim, please test your stuff :) 13 years ago
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*.
13 years ago
Michael DeHaan ce85222fa6 What we are running is actually a "play" (multiple plays per playbook) so rename the function to make it more clear 13 years ago
Michael DeHaan adf1492da2 Add external vars example 13 years ago
Michael DeHaan e582bd5ec5 Add fire and forget example 13 years ago
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.
13 years ago
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.
13 years ago
Michael DeHaan 49a636d8a0 Fixed up async and polling logic. 13 years ago
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.
13 years ago
Michael DeHaan 60a13cf540 Ignore commented out lines in the ansible setup files. 13 years ago
Michael DeHaan 4c9dd972b4 Fixes for output formatting 13 years ago
Michael DeHaan bb5e4fad48 Abstracted out transport from implementation so it can be pluggable. Also fixes for output format. 13 years ago
Seth Vidal b576e389b1 runner buglet and yum module
runner: fix buglet causing logger output to include a u for the command
yum: add yum module:
   ensure=installed pkg=name/name.arch/name-ver-rel.arch
   ensure=removed pkg=name/name.arch/name-ver-rel.arch
   list=installed
   list=updates
   list=available
   list=pkgspec
   list=repos
13 years ago
Seth Vidal 19b784e480 if we've failed a connection to a host - we cannot set items to the
'conn' object since it is not an object on failure - it's a string.
13 years ago
Tim Bielawa 95502c3089 Adding version and author to ansible init. 13 years ago
Michael DeHaan 8e20ed3714 src= parameters for template and copy operations can be relative to the playbook (for /usr/bin/ansible-playbook) or current directory (for /usr/bin/ansible) 13 years ago
Michael DeHaan 7eedc3fb1a Breakout includes into seperate functions, allow vars to apply to handlers but handlers
still may not be parameterized because it does not make sense to import them more than
once since they are keyed by name.
13 years ago
Michael DeHaan 85e0de5bb2 Move print statements out of playbook.py and back into CLI so we can simplify playbook operations
independent of output, and can also see all the output nicely grouped together if we want
to reformat it or make summaries of statistics.
13 years ago
Michael DeHaan 0935506d6f Templating as non-root should not require passing in the metadata= parameter. 13 years ago
Michael DeHaan 4ee4ddcd7c Parameterized include statements can see top level variables and also be passed specific variables!
Code needs cleanup, but works
13 years ago
Michael DeHaan 8d57ceecf1 Factoids and push variables via setup are now available to be templated in command args
as well as template files.  PLUS, variables are now expressed in playbooks without having
to know about the setup task, which means playbooks are simpler to read now.
13 years ago
Tim Bielawa f2c2786a14 Update constants.py to pull module path and the hosts file from the
environment (ANSIBLE_{LIBRARY,HOSTS}) if defined.

Update manpages to represent this.

Also update the env-setup script to set ANSIBLE_{LIBRARY,HOSTS}.
13 years ago
Tim Bielawa b190ea4b62 Fix parse_hosts to not blow up on ungrouped hosts. 13 years ago
Michael DeHaan fae3a71899 WIP on async tests 13 years ago
Michael DeHaan 369b9cde1c Add test for template module and make 'dark' errors clearer if we get output back and the JSON
is not parseable
13 years ago
Michael DeHaan 8d06c074b1 * Added uptime.py as an example of somewhat minimal API usage & reporting
* Pattern in API now has a default
* Fixed bug in template module operation detected from running playbook (tests for that pending)
* Workaround for multiprocessing lib being harmlessly squeaky (feeder thread got sentinel)
13 years ago
Michael DeHaan db57933614 Allow ":" to be used to split patterns as well as ";" so if you are just using group names or fully explicit names you do not need to use shell quoting at all. Obviously if you use wildcards like "*" you wouldstill. 13 years ago
Michael DeHaan 45c40524ef Time limit needs to be passed to async_wrapper. 13 years ago
Michael DeHaan eaa7714ff8 Laying the groundwork for async mode, async status script still needs to be done, and async_wrapper
still needs to daemonize.  Then, once done, playbook can be taught how to poll async within the
timing window.
13 years ago
Michael DeHaan ab408b0000 Ability to import task lists and handler lists from a top level playbook file. It is possible
to use multiple import statements to implement 'class' like behavior, and also to share
a common list of handlers between multiple patterns.
13 years ago
Michael DeHaan cbfabcd0fb Add -i, -k, and -M to ansible-playbook CLI to match options in /usr/bin/ansible 13 years ago
Michael DeHaan e4304a0ac5 Make sure tempdirs are cleaned up after execution steps, fix notifiers, make sure
service module is installed by setup.py
13 years ago
Michael DeHaan 6541f338df add pyflakes target & associated fixes. Also decided to save JSON to --tree file so it can
be better used programatically.  May have to come up with another system of tree logging for
playbook if playbook decides to have tree logging.  Presumably not the highest priority.
13 years ago
Michael DeHaan 3ad9db4966 Some minor from 'pep8', and silencing the PEP8 messages I don't care about.
Also make pep8 show all messages rather than just 1 per code.
13 years ago
Michael DeHaan 0d7a84d591 Some minor refactoring of playbook code, more to go. 13 years ago
Michael DeHaan c57df6220b Add pydoc to playbook binary, fix default types for playbook '.get()' call 13 years ago
Michael DeHaan 34cbbfbfe1 Added pydoc for utils.py 13 years ago
Michael DeHaan e9a24cdad4 Extensive refactoring of bin/ansible, moving most output functions into lib/ansible/utils to
encourage readability and make things more maintainable.
13 years ago
Michael DeHaan e6a1acf756 Let "all" be an alias for "*" in patterns, fix output bug on non-command execution, make clean now removes the build dir 13 years ago
Michael DeHaan 5040c01640 rename 'pattern' to 'hosts' in playbook format. 13 years ago
Michael DeHaan 687a315a80 Increasing default --forks to 5 13 years ago
Michael DeHaan 847846af0e -p has been replaced by a required option. Various docs changes. 13 years ago
Michael DeHaan bed29b7e11 Allow the /etc/ansible/hosts file to contain groups and those group names to be used in place
of pattern names.
13 years ago
Christopher Johnston d15172abdc add a -T option for setting ssh timeout in seconds 13 years ago
Christopher Johnston 2773234c3f python 2.5 does not include json so lets try to use simplejson 13 years ago
Michael DeHaan ab266472be Trim errors on connection refused messages 13 years ago
Michael DeHaan a40ac93716 Plan to merge things back into ansible means we can simplify our code tree
by eliminating the lib/ansible/scripts file.  Ansible-playbook
doesn't have enough options to need it's own thing, and we're going to try
to work most things back into bin/ansible
13 years ago
Michael DeHaan 430f38d54c minor option consistency 13 years ago
Michael DeHaan ab17f6f44e Because I can't remember which options are supposed to be uppercase and which are not,
rename all of them so we can use non-conflicting lowercase.  Manpage updates pending
13 years ago
Michael DeHaan de1d0011bc Take darkened hosts out of the playbook rotation, fix error handling in template
module so that if a directory path is specified we get valid output
13 years ago
Michael DeHaan 01e5da6d0b Make /bin/ansible use the common options from lib/ansible/scripts
DRY!
13 years ago
Michael DeHaan fb531a8dfa Minor option string relabelling, move one option from common into helper script 13 years ago
Michael DeHaan 7de661dd2c Add ansible command, fix import error in runner 13 years ago
Michael DeHaan 0321afb1e3 Minor error handling tweaks (yell if no args) for ansible-command and some minor
style bits (underscores between compound words, use dest always in optparse)
13 years ago
Michael DeHaan a3a426b4c5 Add GPLv3 license headers to new files. Approved by all contributors on mailing list. 13 years ago
Michael DeHaan 5eea593af5 Merge branch 'master' of github.com:mpdehaan/ansible 13 years ago
Michael DeHaan be4cb64c92 Relicensing to GPLv3, all previous committers ok'd on mailing list. 13 years ago
Michael DeHaan 0ed3e87792 Merge pull request #40 from skvidal/master
ans-command
13 years ago
Seth Vidal 95706af074 ans-command and scripts.py for the basic cli parser to be imported elsewhere 13 years ago
Michael DeHaan 1caafb7bd9 Stop evaluating a host in a playbook when it encounters the first failure. 13 years ago
Seth Vidal 85f751175d - make tmp_path be a dir so we can put more than one command in there securely 13 years ago
Seth Vidal bd7a71bb29 implement manual multiprocessing pools for the runner.
this fixes the ctrl-c not-working problem.

implemented this solution: http://www.bryceboe.com/2010/08/26/python-multiprocessing-and-keyboardinterrupt/#georges

also add hosts which do not get a chance to return results to the 'dark' results.
13 years ago
Seth Vidal 1a20b00d1f If the error is an authentication exception - just report it that way don't dump out an unappetizing traceback which just says the same 13 years ago
Michael DeHaan f7cff27f3d Drastically simply playbook syntax 13 years ago
Michael DeHaan fc4ba46d1a Add a ton of comments so folks can understand what runner does. More refactoring is
certaintly possible too.
13 years ago
Michael DeHaan c0ac0e9b62 Added comments to explain the playbook code. 13 years ago
Michael DeHaan 78a254fc52 In playbooks, each pattern stanza can reference it's own user to run as, so you can
run things as multiple sets of users (if you want) in the same playbook.
13 years ago
Michael DeHaan 61d064d011 Fixed up KV munging in runner, misc fixes to copy, setup, and template modules 13 years ago
Michael DeHaan e5f62f20b1 make copy & template module take key/value parameters so we're consistent. Only the command
module works differently now

starter manpage for modules

allow template file location to be passed into template & setup modules
13 years ago
Michael DeHaan deb71da91e trim md5sum string so it does not contain the filename
also fix a bug/typo in the reporting from playbook
13 years ago
Michael DeHaan d308254eae A basic service module with 'ensure' idempotence semantics. Playbook updated to use service
module vs command module for restarting.  May be some bugs and requires the service to implement 'status' -- and probably some better error handling (i.e. return JSON with "failed" element if failed).

Improvements welcome.
13 years ago
Michael DeHaan cb90df2377 Allow multiple patterns to specified, just like Func did. 13 years ago
Michael DeHaan b44ae0af90 applying indentation patch from skvidal 13 years ago
Michael DeHaan a5039eec62 Update reporting on playbook runs. 13 years ago
Michael DeHaan 79fdc1b6f4 Notifable handlers only run when something is changed. Awesome. 13 years ago
Michael DeHaan de80166b6d Misc refactoring, updated TODO to reflect new templating features being completed 13 years ago
Michael DeHaan ba9468266f Can it get an easier? Yes it can! Further simply playbook format. 13 years ago
Michael DeHaan 6d0fd2bfde Compress the playbook format for readability 13 years ago
Michael DeHaan b053df4182 Some refactoring of runner.py -- more to come to eliminate repeated code 13 years ago
Michael DeHaan 6cceaa5f6a Implment copy with an actual minion-side module such that we can get md5sum's and
onchange events like Puppet's file providers do.
13 years ago
Michael DeHaan 440bac4a95 Added remote templating engine using jinja2, see examples/playbook.yml for usage.
Cleanup is due in runner.py
13 years ago
Michael DeHaan 5d6b0280d5 Added stub for template execution, WIP. 13 years ago
Seth Vidal 160470bc49 - add match_hosts() method to runner.Runner()
- add pattern parameter to self._matches() and match_hosts() so you can query
  for matches against the host list
- these are useful when writing scripts and you want to tell the user
  what hosts you will be running on before  actually executing anything.
13 years ago
Seth Vidal e7bb41ff89 simple logging setup using logger.
/usr/bin/logger should probably be a constant or defined in some sort of config as well as the log priority
13 years ago
Michael DeHaan e25bb2f888 Upgrade output for playbook runs 13 years ago
Michael DeHaan ee2fa721f1 Kinda have to pass the host list parameter 13 years ago
Michael DeHaan 43f7dee247 Added rough sketch of what I want for playbook support. Debug heavy at the moment
as I figure out how logging/output might look.  A couple of major TODO features
also listed in the file.
13 years ago
Michael DeHaan d079c8e5f3 Move runner out of __init__.py so it's clear what classes live where. 13 years ago
Michael DeHaan 6eda2cf383 Added initial stub for where playbooks will go, moved to common
constants file so as to not repeat constants between CLI and lib.
13 years ago
Michael DeHaan b2e8084c50 Merge pull request #4 from skvidal/master
adds an option to ask for and store the ssh password from the cli
13 years ago
Seth Vidal 08b45d6da1 add support to prompt for ssh password on the cli 13 years ago
Jeremy Katz 25df80ff58 Use a mktemp'd path for uploading modules 13 years ago
Michael DeHaan bd37864242 Comments and fixup on the dark/contacted code 13 years ago
Michael DeHaan 11f7930038 trim unused modules 13 years ago
Michael DeHaan 7be8d134c9 Rename 'successful' to 'contacted' ... 13 years ago
Michael DeHaan 530e54b3e4 Fix multiprocessing pool usage and remove stackoverflow hack 13 years ago
Michael DeHaan 7ce5db97ed Add explicit calls to close connections 13 years ago
Michael DeHaan e0e98d10ce use readlines on stdout so we'll block on long running commands 13 years ago
Michael DeHaan 7eb2dd2dee Add remote setting to file, update TODO 13 years ago
Michael DeHaan 3da6370a65 use defaults better, improve/fix setup.py 13 years ago
Michael DeHaan 9681e1fa04 Add MIT license headers 13 years ago
Michael DeHaan 3807824c6d Added file copy support w/ readme updates 13 years ago
Michael DeHaan 145a024d7b Split CLI into binscript 13 years ago
Michael DeHaan f31421576b Genesis. 13 years ago