Commit graph

4321 commits

Author SHA1 Message Date
Petros Moisiadis
4ad0ff61e5 added a 'chdir' argument to the command module
the 'chdir' argument changes the current working directory to the
fullpath supplied as its value, before the execution of the command.
2012-07-30 18:39:45 +03:00
Stephen Fromm
87b3e1ecdc Update git module to use module magic and other changes
Convert git module to module magic.
Drop cruft no longer needed.
Standardize indent to 4 spaces in methods switchLocalBranch, reset,
clone, and get_version.
Update is_local_branch to also handle '* branch' format.
Add is_current branch method()
Update pull() method to use is_current_branch()
2012-07-29 22:39:19 -07:00
Lorin Hochstein
dcd214a631 Use standard argument names in PostgreSQL modules
passwd -> password
loginpass -> login_password
loginuser -> login_user
loginhost -> login_host

Add an example playbook that shows how to use the modules.
2012-07-29 12:52:14 -04:00
Lorin Hochstein
a9c2e597ac Fix typo in apt error message: update-cache -> update_cache
The apt parameter changed from update-cache to update_cache, but
the error message still mentioned update-cache
2012-07-29 12:29:00 -04:00
Michael DeHaan
ff82f0a168 Further service module tweaks 2012-07-28 16:48:04 -04:00
Michael DeHaan
e9c4eb36d1 Service tweaks WIP 2012-07-28 16:39:18 -04:00
Nikhil Singh
aca860df9c Standardizing the module 2012-07-28 16:39:18 -04:00
Mark Theunissen
7a67145ef4 Fixes for apt module 2012-07-30 17:20:43 -05:00
Michael DeHaan
487c826700 Tweak alias consistency a bit. 'package' has never been documented, but since it works, make it work in both places.
'name' is the preferred form.  Similarly, take 'name' for the 'guest' argument to the 'virt' module.
2012-07-28 09:22:13 -04:00
Michael DeHaan
4ecdd17caf Merge pull request #702 from lorin/postgresql-module
Add postgresql_db and postgresql_user module.
2012-07-27 15:32:10 -07:00
Michael DeHaan
d55012e570 Merge pull request #704 from lorin/gitfix
git module: Don't pass rc as separate arg to fail_json
2012-07-27 05:49:22 -07:00
Lorin Hochstein
9253d89280 git module: Don't pass rc as separate arg to fail_json 2012-07-27 08:40:47 -04:00
Michael DeHaan
0c61d049a2 Merge pull request #690 from marktheunissen/mysql_default_password
Change modules to use credentials in my.cnf if they are available
2012-07-26 17:16:05 -07:00
Michael DeHaan
ebfd7ec7e3 Merge pull request #695 from nix85/fix_apt_mod
Standardizing the apt module
2012-07-26 17:15:28 -07:00
Lorin Hochstein
def1fa23f8 Add postgresql_db and postgresql_user module.
These modules are based on the mysql_db and mysql_user modules.

Currently, the postgresql_user module can only grant all permissions
on a database, fine-grained access has not been implemented yet.
2012-07-26 17:05:04 -04:00
Mark Theunissen
7395becf3a Check file exists instead of relying on the exception. Leave the exception catch in, in case the file is deleted or some other issue crops up 2012-07-26 11:30:22 -05:00
Mark Theunissen
888ac86d70 Woops, missed the rest of them 2012-07-26 11:13:10 -05:00
Mark Theunissen
ac23c69bcc Making the passwd parameter consistent 2012-07-26 11:10:22 -05:00
Mark Theunissen
6afe3fd497 Changing to read from a file pointer instead so that an exception is thrown if the file doesn't exist 2012-07-26 08:58:21 -05:00
Nikhil Singh
daf44331c4 Code review changes
1. Passing the module to the various functions so that they can use module.fail_json and module.exit_json methods inside.
2. Because of point 1, install and remove methods do not return anything. Instead, they use the module functions itself.
3. Move the import statement (for apt and apt_pkg) inside main function so on import error, we can use module.fail_json to print the error.
2012-07-26 17:29:15 +05:30
Nikhil Singh
dd9e09dee6 Adding dict() for json.dumps 2012-07-26 16:24:10 +05:30
Nikhil Singh
4c8d949642 Standardizing the apt module 2012-07-26 16:21:49 +05:30
Stephen Fromm
1727bd3b7a Update git module to handle branches better
This drops the branch option.  The version option is overloaded
to mean either a sha1, branch, or tag.  This also adds the option
'remote' which defaults to 'origin'.
clone() was simplified by removing the checkout operation.  That
happens later when switch_version() is called.

Added the methods get_branches(), is_remote_branch(), and
is_local_branch().  get_branches() returns an array listing all
of the branches for the git repository.  is_remote_branch() checks
whether the arguments supplied correspond to a remote branch.
Similarly, is_local_branch() checks for a local branch.

The pull() method now checks to see if it is on the desired branch.
If not, it checks out the requested branch and then does a pull.
This should keep issue #604 still fixed.

switch_version(), formerly switchver(), looks to see if it is
checking out a branch.  If a branch, it checks it out with the --track
option.  This type of checkout was in pull() before.

Updated pull, clone, and switch_version to return (rc, out, err).
2012-07-26 00:22:30 -07:00
Michael DeHaan
2030f82bf2 Further standardize the yum module 2012-07-25 20:14:15 -04:00
Michael DeHaan
1584eda3f8 Merge pull request #684 from nix85/fix_yum_mod
Standardizing the yum module
2012-07-25 17:33:55 -07:00
Mark Theunissen
12979cf834 Change modules to use credentials in my.cnf if they are available 2012-07-25 16:31:12 -05:00
Stephen Fromm
40eaf282ea More cleanup in assemble module for module magic (tm) 2012-07-25 09:24:10 -07:00
Nikhil Singh
b47bed9601 Standardizing the yum module 2012-07-25 19:45:41 +05:30
Michael DeHaan
772e241d1f shorten up the assemble module 2012-07-24 19:44:53 -04:00
Michael DeHaan
f787cda7be Merge pull request #675 from jpmens/assemble1
convert sfromm's assemble to module-magic
2012-07-24 16:41:25 -07:00
Michael DeHaan
f4a4649086 Port async_status to use the new common code. 2012-07-24 19:03:18 -04:00
Michael DeHaan
45354c6be5 Port command module over to new common code. Notice that this has to subclass AnsibleModule -- this should be the only
one that has to do that.
2012-07-24 18:52:52 -04:00
Michael DeHaan
2d1c297fb8 Merge pull request #674 from nix85/fix_facter_mod
Standardizing the module
2012-07-24 11:54:50 -07:00
Jan-Piet Mens
f6fe9124b8 convert assemble to module-magic 2012-07-24 18:35:06 +02:00
Nikhil Singh
8bbcef6f13 Standardizing the module 2012-07-24 21:08:56 +05:30
Mark Theunissen
97cc259d8c Undefined variable error 2012-07-24 09:26:45 -05:00
Nikhil Singh
483f7fd625 Standardizing the mount module 2012-07-24 17:00:08 +05:30
Michael DeHaan
2cda36f7dc Merge pull request #664 from jpmens/a1
Fix file module to support = in args; remove superflous call in get_url
2012-07-24 03:39:30 -07:00
Christoph Seitz
ab8a36686e Fixes locale problem with ifconfig in setup module 2012-07-24 11:10:11 +02:00
Jan-Piet Mens
628b289ab3 Fix file module to support = in args; remove superflous call in get_url 2012-07-24 06:40:34 +02:00
Michael DeHaan
ec12cc4154 Save the transfer of the module file for new style modules, because we can inject the arguments into the modules.
Module consumers using the API don't have to know how this works.  base64 stuff is only there
because escaping a docstring inside a docstring was a bit of a challenge :)
2012-07-23 19:18:45 -04:00
Stephen Fromm
f068bedfa1 Update user module to use new shared module code 2012-07-23 11:29:59 -07:00
Mark Theunissen
12e23a1a6c Upgrading MySQL user module to new format 2012-07-22 12:11:39 -05:00
Michael DeHaan
0b891fc8fb Tweaking daisychain internals to allow get_url to modify the path destination when downloading to a directory.
Minor module refactoring.
2012-07-22 11:08:16 -04:00
Michael DeHaan
46650cfcec Merge branch 'get_url3' of https://github.com/jpmens/ansible into devel 2012-07-22 10:08:27 -04:00
Stephen Fromm
1a9c54b1e1 Update group module to use new shared module code 2012-07-21 22:30:13 -07:00
Mark Theunissen
efb60776f4 Upgrading to new shared module code 2012-07-21 18:02:34 -05:00
Michael DeHaan
9f149c9f1a imports not needed 2012-07-21 17:25:47 -04:00
Michael DeHaan
d0f4358730 Port the copy module over to the new "common module" logic. 2012-07-21 17:07:42 -04:00
Jan-Piet Mens
b8d7b5041b new module: get_url
get module (with new module-magic-code!)
	Usage: ansible -m get -a "url=http://xxxxxxx  dest=fileordirctory"
	all cleanups as per @mpdehaan's suggestions
	add daisychain
	added example playbook (get_url.yml) with URLencode example
2012-07-21 13:34:42 +02:00
Stephen Fromm
2a0dfba838 Skip get_ipv6_facts if socket.has_ipv6 is false 2012-07-20 17:19:26 -07:00
Stephen Fromm
fd059a3df2 Fix for issue 604
Do not switch to master branch in pull()
Add --track to git checkout, when checking out a remote branch to track.
2012-07-20 10:43:26 -07:00
Michael DeHaan
70ef8e9ebb Merge pull request #637 from goozbach/git-mkdir
git mkdir causes problems with older git (can't c/o to existing directory)
2012-07-20 06:54:20 -07:00
Derek Carter
f0f8eb3445 git mkdir causes problems with older git (can't checkout to existing directory) 2012-07-20 09:48:18 -04:00
Michael DeHaan
b114a6075f Merge pull request #631 from sfromm/facts
Update setup module for facts derived from classes - take 2
2012-07-20 03:58:42 -07:00
Michael DeHaan
d69e70db01 By defining a main function here, and including it ahead of the boilerplate insertion symbol, tracebacks are
now accurate with respect to the main function, but may include lines not in the original file.  A lot better
than before, where they were offset.
2012-07-20 06:37:46 -04:00
Stephen Fromm
0efc0bec89 Update LinuxNetwork to not use fcntl and ioctls
get_interfaces() updated to read /proc/net/dev.  This means it no
longer provides only interfaces that are up.

get_iface_hwaddr() updated to read from /sys/class/net/<iface>/address.

Added get_interface_facts() to pull in mac address and interface mtu.
Can be used later for additional interface-facts.

Added get_ipv6_facts(), which reads from /proc/net/if_inet6.

get_network_facts() renamed to get_ipv4_facts().  It still calls
ifconfig to determine ipv4 facts.
2012-07-19 23:50:13 -07:00
Stephen Fromm
162b78ea5c Check if CPU is QEMU via different mechanism
The processor fact doesn't exist in LinuxVirtual.  Read /proc/cpuinfo
and check if it is QEMU.
2012-07-19 23:50:12 -07:00
Stephen Fromm
e3dd25b1b2 Add back erroneously deleted get_file_content() 2012-07-19 23:50:12 -07:00
Stephen Fromm
97c64f3632 Adjustments to behavior of Facts and subclass behavior
The Facts class and subclasses no longer take a dict argument for
instantiation.  populate() now returns self.facts.
Other changes:
- Facts.__init__() takes over most of the work from populate() so that
  subclasses can benefit from its knowledge.
- Drop setting unknown facts to 'NA' in __init__() in various
  subclasses.
- Check for presence of facts in get_virtual_facts()
- Update ansible_facts() to use facts.update(<classname>().populate())
2012-07-19 23:50:12 -07:00
Stephen Fromm
ae1b2394ac Update setup module for facts derived from classes
This changes and organizes facts into a base class Facts and several
sub classes that implement the necessary functionality.  The classes
are:
- Facts: base class.  Implements basic facts that should be common to a
  number of platforms.  It is also where SSH keys and SELinux facts are
  set.
- Hardware: A subclass of Facts that should be further
  subclassed per platform for CPU, memory, and related facts.
  - LinuxHardware: subclass of Hardware for Linux platforms
  - SunOSHardware: subclass of Hardware for SunOS platforms
  - FreeBSDHardware: subclass of Hardware for FreeBSD
- Network: A subclass of Facts that that should be further
  subclassed per platform for IP, both IPv4 and IPv6, information.
  - LinuxNetwork: Currently only implementation for determining network
    facts.
- Virtual: A subclass of Facts that that should be further
  subclassed per platform to determine virtual environment facts.
  - LinuxVirtual: Currently only implementation for determining virtual
    facts.

If facts are needed for additional platforms, one of the above classes
(eg Network) can be further subclassed and implement the necessary
functionality.

In addition, it fixes get_network_facts() to work on Fedora17.  That
broke due to changes to ifconfig output.
2012-07-19 23:50:12 -07:00
Michael DeHaan
a94ec130d2 Common module code upgrades 2012-07-17 23:09:57 -04:00
Michael DeHaan
9006d4557d Added code to allow insertion of boilerplate into modules to make them able to share lots of code, the result
should be a huge reduction of total ansible source, at a slight cost of difficulty in original module development.

We need to apply this now to all modules, but may need to have some exemptions to things like command, which should
subclass this module.
2012-07-17 22:34:52 -04:00
Peter Sankauskas
5e35cd6466 Pass through error message when repo not found 2012-07-19 15:48:13 -07:00
John Kleint
ae665c15b3 Service module outputting extra data.
The service module was printing stuff to stderr, returning two
JSON dicts, not using consistent 'failed' values, had dead code
and unused variables.  Added detection for the case when service
status returns 'xxx is dead and pid file exists' and made the
code a bit easier to read.
2012-07-19 13:15:09 -04:00
Michael DeHaan
1a88a3362f add noninteractive to debian module per #602 2012-07-16 20:18:58 -04:00
Seth Vidal
f6a09bc4c1 Squashed commit of the following:
commit ea14bbfb52587bf5b97b5577c0439b01cb0b4836
Merge: 82819a9 285aaf8
Author: Michael DeHaan <michael.dehaan@gmail.com>
Date:   Sun Jul 15 14:38:28 2012 -0400

    Merge branch 'devel' of https://github.com/skvidal/ansible into skvidal_mount

commit 285aaf836c
Merge: 634c117 32b6879
Author: Seth Vidal <skvidal@fedoraproject.org>
Date:   Mon Jul 16 12:42:21 2012 -0400

    Merge remote-tracking branch 'upstream/devel' into devel

    * upstream/devel: (52 commits)
      format fixes to make fetch more usable
      ...

commit 634c11748e
Author: Seth Vidal <skvidal@fedoraproject.org>
Date:   Thu Jul 12 01:16:00 2012 -0400

    fix a bunch of small bugs in mount module - test with bind and local mounts

commit fcfd73de71
Author: Seth Vidal <skvidal@fedoraproject.org>
Date:   Wed Jul 11 20:46:14 2012 -0400

    fix some obvious bugs pointed out by #ansible

commit 13c3080383
Author: Seth Vidal <skvidal@fedoraproject.org>
Date:   Wed Jul 11 19:35:34 2012 -0400

    mount/fstab editor
2012-07-15 14:38:40 -04:00
Michael DeHaan
64c51ade1e Change the way we do with_items to make them happen next to each other in runner, which eliminates the problem of with_items and vars_files sometimes not playing nice with each other.
(Also a fix for the user module error handling when the user
is not present at the time of the return.  This can only really be caused by multiple ansible executions).
2012-07-14 19:18:33 -04:00
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.
2012-07-14 11:59:12 -04:00
Mark Theunissen
f47cc1693d The MySQL modules 2012-07-13 17:07:23 -05:00
Jeremy Smitherman
e5a6627d10 Removed unused recurse option in file module. 2012-07-12 02:04:51 -04:00
Michael DeHaan
fd7e96d33e Merge pull request #578 from jeremysmitherman/boolean_parameters
Removed boolean parameter setting from user module.
2012-07-11 10:58:09 -07:00
Michael DeHaan
626e4cb003 Merge pull request #572 from goozbach/devel
fixes #569 apt module problems on old versions of apt-python
2012-07-11 10:53:29 -07:00
Jeremy Smitherman
ecacb67d31 Added yes/no to user options instead of False comparison for force and remove options for user module 2012-07-11 12:16:40 -04:00
Michael DeHaan
3f5c4772be Merge pull request #575 from jeremysmitherman/apt-force
Added cmd modifications to use a force-yes option for apt module
2012-07-11 07:16:40 -07:00
Michael DeHaan
949f8b8fc5 Merge pull request #571 from sfromm/group
Group module fixes
2012-07-11 05:27:56 -07:00
Jeremy Smitherman
a35a0f885e Added cmd modifications to use a force-yes option for apt module 2012-07-10 22:22:52 -04:00
Derek Carter
f38b9d1ca7 added filter for future warning 2012-07-10 19:50:08 -04:00
Stephen Fromm
ac3341cc12 Minor fix to user module to further streamline setting 'changed' flag 2012-07-10 16:37:07 -07:00
Derek Carter
e261d49acc fixes #569 apt module problems on old versions of apt-python (namely debian 5.0) 2012-07-10 19:28:14 -04:00
Stephen Fromm
3a5f2126a6 Fixes to group module for better error handling
Takes a lot of the fixes to the user module and applies them to the
group module: provide stdout/stderr in result if available and call
fail_json() if the attempted action fails.
2012-07-10 16:18:53 -07:00
Michael DeHaan
3235da074e Merge pull request #568 from sfromm/user
User modules fixes
2012-07-10 16:04:17 -07:00
Michael DeHaan
8bb41bc627 Merge pull request #566 from jeremysmitherman/service-no-pid
Added additional output to service status checker
2012-07-10 16:03:51 -07:00
Stephen Fromm
09f025b7a0 Fixes to user module for better error handling
The user module now returns the output, both stdout and stderr, from
useradd, usermod, and userdel.  This should help debug cases why one of
those commands fail.  In addition, the user module will now call
fail_json() when the attempted command failed so as to properly
communicate a failure in a playbook.
2012-07-10 15:55:39 -07:00
Seth Vidal
2f11350665 modify user module so that password is NEVER logged before the command runs 2012-07-10 17:13:51 -04:00
Jeremy Smitherman
7af3bdc89e Added additional output to service status checker 2012-07-10 16:13:39 -04:00
John Kleint
375a1eaf43 Use iterative MD5 hashing. 2012-07-09 13:27:47 -04:00
Dave Hatton
55694db7c3 switch to hashlib.md5 or md5 instead of OS md5 commands 2012-07-09 08:52:00 +01:00
Peter Sankauskas
fed1e9870c Assigning to boolean first 2012-07-06 18:05:15 -07:00
Peter Sankauskas
fced8cf6b0 Getting the apt module to accept and understand a 'install-recommends' parameter which allows running apt with --no-install-recommends 2012-07-06 12:12:04 -07:00
Dave Hatton
ecaa794f7f copy always returned change=true 2012-07-06 13:43:19 +01:00
Dave Hatton
9d85a55434 switch to shutil.copy rather than os.system(cp) 2012-07-04 12:26:25 +01:00
Dave Hatton
263fcab594 md5 allow copy if file is missing 2012-07-03 20:07:08 +01:00
Jeremy Smitherman
3003aa2d47 Added IndexError catch for copy module, IndexError is thrown if a destination file doesn't exist 2012-07-03 14:12:19 -04:00
Dave Hatton
d47de18b6c improve error trapping for md5 2012-07-03 12:44:37 +01:00
Brad Olson
be9ff7ff46 Fixes ansible/ansible#522, no longer creates comment in ~/.ssh/authorized_keys, does not create directory or file if state==absent. 2012-07-02 19:16:57 +00:00
Brad Olson
756df550f8 Fixes ansible/ansible#523. Removed 'with:' blocks so module works with Python 2.4 for CentOS 5 support, courtesy of mcodd/ansible@29af24b732. 2012-07-02 17:57:38 +00:00
Derek Carter
fc4ae3e270 remove UID/GID from output 2012-07-01 17:38:17 -04:00
Derek Carter
a548769792 removed print from debug code of file module 2012-06-29 21:38:31 -04:00
Derek Carter
82832021e8 file when UID or GID doesn't exist 2012-06-29 20:05:23 -04:00
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.
2012-06-19 21:57:43 -04:00
Ludovic Claude
daf858648b Add basic support for Solaris 2012-06-26 19:49:26 +02:00
Ingo Gottwald
a42167ca73 Copy module: Extended error handling and fixed error messages 2012-06-25 20:45:05 +02:00
Ingo Gottwald
270266e920 Added to copy module: Error handling for missing permissions on the copy destination 2012-06-23 21:39:37 +02:00
Michael DeHaan
25083953fc Merge pull request #495 from nafeger/devel
make copy module implemented closer to other newer modules when returning results
2012-06-20 13:12:24 -07:00
Nathan A. Feger
26816b72ec attempt to make copy more idiomatic. 2012-06-20 14:17:15 -05:00
Ingo Gottwald
abe33a5881 Enhanced the service state recognition in the service module:
- Added Upstart support
- Added an initial unknown state
- Prevented state changes when the current state is not recognized
- Changed the keyword recognition to a safer method
2012-06-17 15:55:26 +02:00
Fred Alger
80f402aa9b Remove unused md5sum function from file module 2012-06-15 00:13:35 -04:00
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.
2012-06-15 00:04:01 -04:00
Stephen Fromm
4a6a3fd305 Conditionally import hashlib (issue #471)
Import hashlib if it is there, otherwise import md5.  Adds method
file_digest that wraps the logic on which module to invoke.
2012-06-14 07:18:46 -07:00
Michael DeHaan
7926ab5b95 Merge pull request #469 from nafeger/devel
Add support for older version of python-apt
2012-06-13 19:21:31 -07:00
Nathan A. Feger
1d553830f2 Add support for older version of python-apt 2012-06-13 13:57:47 -05:00
Stephen Fromm
9cf182c225 Add assemble module
This adds a module that concatenates (ie. assembles) a file from
fragments in a directory in alphabetical order.  It chains the file
module afterward to fix up ownership and permission.  This also adds
tests for the assemble module with fragments in assemble.d.
2012-06-11 23:09:54 -07:00
Michael DeHaan
9ff59090c2 capture possible chown stderr output 2012-05-31 22:19:05 -04:00
Michael DeHaan
5a8e61a610 Fix parsing error in file module when returning errors. 2012-05-31 22:14:33 -04:00
Michael DeHaan
4886b26ea9 Merge pull request #426 from dagwieers/facts
Add BIOS information and fix VMware detection (supports both IDE and SCSI)
2012-05-31 18:45:52 -07:00
Michael DeHaan
960e7c331c Merge pull request #433 from bradobro/authorized_key
Renamed module, fixed idempotency, removed debug param.
2012-05-30 13:59:13 -07:00
Brad Olson
ab55b1a412 Renamed module, fixed idempotency, removed debug param. 2012-05-30 16:41:38 -04:00
Stephen Fromm
3eef7a629b Update get_selinux_facts in setup module
This switches to using selinux library calls instead of parsing the
output of sestatus.  This fixes issue #428 where the output was slightly
different than expected on F17.  Tested against debian (non-selinux),
centos5, centos6, and fedora17.
2012-05-30 08:42:05 -07:00
Dag Wieers
50ef1bb93f Add BIOS information and fix VMware detection (supports both IDE and SCSI disks) 2012-05-30 14:23:52 +02:00
Michael DeHaan
ecb944892d Tweaks on previous refactoring of playbook, version bump a 0.4 reference, remove some debug, etc 2012-05-26 01:20:53 -04:00
Michael DeHaan
8a687b77f8 Merge pull request #391 from cocoy/reload-feature
Feature: Add state=reloaded
2012-05-19 14:26:20 -07:00
Michael DeHaan
0db6d73523 Merge pull request #393 from bradobro/fix_usergroup
0.4 fix, Remove call to undefined debug() in module 'user'
2012-05-15 10:04:28 -07:00
Brad Olson
2b8bc789c2 Remove call to undefined debug() in module 'user'.
I think when we stopped using stderr for debugging modules because
paramiko didn't like it, many modules used the idiom of defining
a debug function that used standard error. The def's and calls were
removed.

This looks like a stray debug() that didn't get removed and didn't
show up unless you alter a user's groups. If it's hit, 'user' fails
with a global undefined function error.
2012-05-15 09:19:43 -04:00
cocoy
25f808de8f Add state=reloaded 2012-05-15 17:28:49 +08:00
Wes Johnson
5da7f2aff4 starting fresh, doing it 'right'
Lost commit history, but this way I'm not introducing crappy commit
history in RP
2012-05-14 14:31:53 -07:00
Michael DeHaan
54a56e478b add fake module for 'raw' 2012-05-10 01:08:01 -04:00
Michael DeHaan
45100f03b1 Default git module to master branch so branch= is not required. 2012-05-10 00:41:44 -04:00
Michael DeHaan
e6416def6b update comment about branch support, now that supported 2012-05-10 00:39:15 -04:00
Michael DeHaan
eb41bfd3c8 Allow service 'enable' parameter be 'enabled', which is what I'd personally try to use. 2012-05-09 23:13:13 -04:00
Cosmin Luță
c37014083a Added a new fact: network address for an interface 2012-05-11 17:17:59 +03:00
Cosmin Luță
204bffa21e Added parameter to the apt-get install command to prevent interactive conflict resolution 2012-05-11 10:54:55 +03:00
Michael DeHaan
d118cf3e31 Merge pull request #336 from sfromm/issue122
Issue122 - have all modules log to syslog
2012-05-09 17:19:24 -07:00
Michael DeHaan
0fe8e51cb5 Merge pull request #337 from ordrin/devel
Support for branches in git module
2012-05-09 17:18:32 -07:00
Stephen Fromm
aea022b002 Apply logging of arguments to modules (issue #122)
The ohai and facter modules use /usr/bin/logger to log the fact that
they have been invoked.  I added 'import os' to the ping module
so that it could have the same syslog statements as the other modules.
I separated the condensed:
    shlex.split(open(argfile, 'r').read())
into two separate statements similar to the other modules.
2012-05-09 15:19:20 -07:00
felix
7ee6ae3663 removed unecessary branch addition from switchver 2012-05-08 16:24:29 -04:00
felix
c9fafcecbe added in support for branches in git module (now takes optional "branch") 2012-05-08 16:20:08 -04:00
Stephen Fromm
73ffec9710 Move import of spwd under a try block
Resolves issue #333.  If spwd is not available, the password will
be set regardless.
2012-05-08 10:40:44 -07:00
Brendan Beveridge
be32d3b00f Merge remote-tracking branch 'ansible-origin/devel' into devel
Conflicts:
	library/user
2012-05-08 10:33:18 +10:00
Michael DeHaan
b460980d7d Merge pull request #324 from lcosmin/devel
Prevent facter stderr messages from confusing ansible
2012-05-07 17:07:49 -07:00
Michael DeHaan
9b1add8c40 Reverting to apply correct attribution. 2012-05-07 20:07:12 -04:00
Michael DeHaan
3a027c2749 Don't let facter spew things to stderr and confuse Ansible, which now blends stdout/stderr due to paramiko
pty usage.

(This commit from lcosmin, manually applied due to github crossup on my part -- MPD)
2012-05-07 20:05:10 -04:00
Brendan Beveridge
5059588b17 remove now useless append check in user_mod 2012-05-08 09:49:37 +10:00
Brendan Beveridge
2635195185 Fixes issue #315
This adds some logic when usings groups possibly in combination with append

  if just specifying groups and the current groups do not match the list
     set groups
  if specifying groups with append and any group thats not in the current groups
     set groups with -a
2012-05-08 09:43:51 +10:00
Peter Sankauskas
d814136ec9 Code was adding '-a' even when the user was already in the desired groups causing usermod to fail since there was no '-G' option. This is duplicate code (3 lines) from the 'group' section, so could be improved, but it works. 2012-05-07 11:35:45 -07:00
Cosmin Luță
fba4d9232d Prevent facter stderr messages from confusing ansible 2012-05-07 18:08:50 +03:00
Michael DeHaan
36559badd5 Merge pull request #316 from skvidal/devel
fix up service module to make it start processes that are listed to be
2012-05-06 16:43:20 -07:00
Michael DeHaan
0669ce858a Refactored inventory to make it object oriented, need to make YAML format and executable script
format compatible with this still, and add some tests for INI-style groups of groups
and variables.
2012-05-05 16:31:03 -04:00
Seth Vidal
81418afbbb fix up service module to make it start processes that are listed to be
running and to report errors from starting them
2012-05-04 01:20:51 -04:00
Rafal Lewczuk
3de61fb180 Fix: file module does not remove dangling symlinks 2012-05-01 22:56:37 -04:00
Michel Blanc
a7e4da92db Fixes _find_binaries not using globals
_find_binaries now sets the right globals
Binaries are now properly populated (reverse path/binary for loops)
2012-05-03 12:36:06 +02:00
Michel Blanc
572868c9e1 Adds support for Ubuntu style update-rc.d
Checks if update-rc.d (Ubuntu) or chkconfig (RHEL) should be used.
Adds basic bin path search for those binaries
Adds 'enable' and 'disable' options for 'enable' command since it's the
arguments that update-rc.d uses (this might be somewhat confusing to
have a command line with 'enable=enable', but probably mkes sense for
Ubuntu users).
Allows use of mixed case for 'list' and 'state' commands.
2012-05-03 08:34:36 +02:00
Michael DeHaan
9ad4e7d149 Merge pull request #300 from sfromm/git
Updates for git module
2012-05-02 19:57:50 -07:00
Stephen Fromm
f1b7149fcf Update how to set default selinux context for file
This removes the 'context' option and replaces it with checks for
'_default' value for seuser, serole, setype, or (maybe) selevel.
If '_default' is provided *and* there is a default context for the given
file, this will set the file context to the available default.
2012-05-02 11:38:44 -07:00
Stephen Fromm
887d293a3b Add git reset --hard support to git module
Resets working tree to what is in HEAD and discards any
uncommitted changes.
2012-05-02 09:50:36 -07:00
Stephen Fromm
40dbd9b3d7 Add exit_json and fail_json to git module
This adds exit_json() and fail_json() to git module.  It also sets
version to 'HEAD', if not provided.
2012-05-02 09:50:36 -07:00
Jeroen Hoekx
2c8fbdbd20 Group order in user module should not matter.
Groups are not necessarily returned in the defined order, especially when the user already existed before ansible started managing the system.
2012-05-02 11:54:27 +02:00
Michael DeHaan
594084bc9f Merge pull request #287 from dne/user-group-add-system
Add 'system' option for user and group modules
2012-05-01 15:54:45 -07:00
Michael DeHaan
27582ad313 Merge pull request #281 from dne/file-link-relative
File module fix for symlink from relative source path
2012-05-01 15:41:46 -07:00
Michael DeHaan
dd380f67e6 Merge pull request #289 from skvidal/devel
service enable=on/off
2012-05-01 15:40:59 -07:00
Jeroen Hoekx
d96763346f Make async wrapper kill the process it supervises.
It wasn't killing the job at all before.
Indentation was 3 spaces.
2012-05-01 18:38:26 -04:00
Seth Vidal
dc30b01c87 new service module handles enable=on/off for chkconfigging it on 2012-05-01 17:46:45 -04:00
Daniel Néri
a837009c5d Add 'system' option for user and group modules
Creates system accounts/groups; corresponds to the '-r' option for {user,group}add.

The option is only honored when users/groups are added, not when modified.
2012-05-01 21:38:55 +02:00
Daniel Néri
82d3fcfd53 File module fix for symlink from relative source path 2012-05-01 03:12:13 +02:00
Michael DeHaan
36e454c52f Because paramiko using a pty can't distinguish stderr and stdout, remove handling that
treated -D as a way to show stderr, and make sure modules don't include things on stderr.
Update docs and test module script to come into line.
2012-04-27 01:25:38 -04:00
Michael DeHaan
b56efa7809 Fix handling of list=status such that it will actually work in absense of the state command, to
make it useful from /usr/bin/ansible and the API.  Also some minor style fixes.
2012-04-26 22:43:36 -04:00
Michael DeHaan
ea296e9edb Merge branch 'devel' of https://github.com/jkleint/ansible into jkleint-devel 2012-04-26 22:23:09 -04:00
Seth Vidal
a3ab793ba8 fixes for yum module for rhel5 and issue 269 2012-04-27 17:38:46 -04:00
Seth Vidal
c701e59592 very minor indentation issue in librar/copy 2012-04-27 16:45:28 -04:00
John Kleint
c6db4e8fa3 Get service module working with sudo, add list=status, better error messages.
When running the service module via sudo, `$PATH` didn't contain `/sbin`,
so the service binary couldn't be found.  This just runs `/sbin/service`
directly.  Output is spewed to stderr on error.

Added `list=status` to include the output of `service <cmd> status`.
2012-04-27 13:35:24 -04:00
Michael DeHaan
a0ac936a55 Merge pull request #249 from jhoekx/octal-file-mode
Return the octal mode of a file instead of decimal.
2012-04-26 16:25:39 -07:00
Michael DeHaan
5aa5a48f7f Merge pull request #250 from jkleint/devel
Service module crashes if args has no "=".
2012-04-26 16:22:56 -07:00
Michael DeHaan
b6bdb22341 Merge pull request #251 from sfromm/selinux
Selinux -- more fun
2012-04-26 16:20:49 -07:00
Stephen Fromm
7b41e22e56 Change to socket.getfqdn() for fqdn fact 2012-04-26 08:39:47 -07:00
Stephen Fromm
5be20f8748 Update file module selinux-awareness
This adds selinux_mls_enabled() and selinux_enabled() to detect a)
whether selinux is MLS aware (ie supports selevel) and b) whether
selinux is enabled.  If selinux is not enabled, all selinux operations
are punted on -- same as if python's selinux module were not available.
In set_context_if_different(), I now iterate over the current context
instead of the context argument.  Even if the system supports MLS, it
may not return the selevel from selinux.lgetfilecon().  Lastly, this
drops selinux_has_selevel() in lieu of the current approach.
2012-04-26 07:31:25 -07:00
jkleint
30ce430363 Service module crashes if args has no "=". 2012-04-26 10:48:50 -03:00
Jeroen Hoekx
3594d1ce80 Return the octal mode of a file instead of decimal. 2012-04-26 14:55:31 +02:00
Stephen Fromm
5c74a524b9 Fix for issue #227
Older versions of selinux, such as that deployed on rhel5, only return a
context of user:role:type instead of user:role:type:level.  This detects
whether the tuple has three elements (old-style) or four.  If the
old-style, it keeps the secontext list at three elements.
2012-04-25 09:39:11 -07:00
cocoy
7a19a46e24 Bugfix for issue no. 229 2012-04-25 21:02:44 +08:00
Jeroen Hoekx
d3d26d0cd6 Ohai and facter modules should not use the ansible_facts API. 2012-04-24 16:57:04 +02:00
Michael DeHaan
80e6d83660 Fix bug in library/file 2012-04-24 08:10:50 -04: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
Daniel Néri
d5f3760acc Add optional "default-release" argument for apt module
The value is passed to apt-get's "-t" option. Useful for installing backports, e.g.:

  ansible webservers -m apt -a "pkg=nginx state=latest default-release=squeeze-backports"
2012-04-23 00:17:07 +02:00
Stephen Fromm
be58995278 Add context=default option to file module
This adjusts behavior of file module such that removal of se* option
does not revert the file's selinux context to the default.  In order to
go back to the default context according to the policy, you can use the
context=default option.
2012-04-21 23:27:34 -07:00
Daniel Néri
ec4d5fa287 Add apt module support for installing/removing specific version of package
This uses standard APT syntax, e.g.:

    ansible webservers -m apt -a "pkg=nginx=1.1.19-1 state=installed"
2012-04-22 02:48:58 +02:00
Michael DeHaan
c0c691089d Fix bug in src. Should not code this early :) 2012-04-20 08:09:43 -04:00
Michael DeHaan
7794493952 Don't try to expand path for None values 2012-04-20 08:02:12 -04:00
Michael DeHaan
445e48b991 Call os.path.expanduser in modules so things work as expected even when using ./hacking/test-module script 2012-04-20 07:57:39 -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
Daniel Néri
626e8f3543 Fix two misspellings of the apt module's "fail_json" function 2012-04-19 23:40:44 +02:00
Michael DeHaan
4578b17213 Add missing file (slurp) used by templates in non-playbook mode. 2012-04-19 09:03:40 -04: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
f4132a0162 Merge pull request #160 from sfromm/facts
Facts
2012-04-18 18:28:48 -07:00
Stephen Fromm
28895f6615 Rename serange to selevel to be consistent with selinux docs 2012-04-17 17:12:09 -07:00
Stephen Fromm
0c38bb2fd0 Add native facts to library/setup
This collects various facts from the host so that it isn't necessary to
have facter or ohai installed.  It gets various platform/distribution
facts, information about the type of hardware, whether a virtual
environment and what type, assorted interface facts, and ssh host public
keys.  Most facts are flat.  The two exceptions are 'processor' and all
interface facts.  Interface facts are presented as:
    ansible_lo : {
        "macaddress": "00:00:00:00:00:00",
        "ipv4": { "address": "127.0.0.1", "netmask": "255.0.0.0" },
        "ipv6": [
                    { "address": "::1", "prefix": "128", "scope": "host" }
                ]
    }
2012-04-17 16:59:23 -07:00
Tim Bielawa
c9ab5ebc6b Fix FSF address in virt header. 2012-04-17 10:30:44 -04:00
Jeroen Hoekx
9e0b7ee629 template: expand path if metadata is in user home. 2012-04-17 11:16:53 +02:00
Martijn Koster
f936616f91 comment typos 2012-04-13 11:19:36 +01:00
Stephen Fromm
1e5d34ba35 Add selinux support to file module
This adds the options: seuser, serole, setype, and serange to the file
module.  If the python selinux module doesn't exist, this will set
HAVE_SELINUX to False and punt in the related modules.

This takes the options the user provides and applies those to the
default selinux context as provided from matchpathcon().  If there is no
default context, this uses the value from the current context.  This
implies that if you set the setype and later remove it, the file module
will rever the setype to the default if available.
2012-04-12 10:45:31 -07:00
Michael DeHaan
ff5d329374 Yum package state defaults to installed 2012-04-11 20:47:38 -04:00
Michael DeHaan
8152e44efd Also allow the apt module to use package or name as an alias for 'pkg' 2012-04-11 20:45:14 -04:00
Michael DeHaan
b418632a8d Allow yum module to use package or name as an alias for 'pkg' 2012-04-11 20:44:15 -04:00
Michael DeHaan
529a194950 Upgrade apt message if no python-apt to intercept potential user questions. 2012-04-11 20:31:24 -04:00
Michael DeHaan
62224271e9 Merge pull request #131 from mgwilliams/feature-fetch-module
Fetch Module
2012-04-11 16:55:51 -07:00
Matthew Williams
611e3fec4c fetch 'module' -- working with paramiko and local connections 2012-04-10 20:23:25 -07: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
Michael DeHaan
38c7f1db4d Added 'creates=filename' to the shell/command module, which can skip command execution if a file
already exists
2012-04-06 11:16:53 -04:00
Seth Vidal
254f98bdf5 handle incorrect commands w/o '=' slightly better 2012-04-05 17:03:36 -04:00
Michael DeHaan
594b16a78b Merge pull request #114 from jhoekx/module-vars
Introduce task local variables.
2012-04-04 17:21:46 -07:00
Seth Vidal
66f9a697ed edit comment to reflect real args 2012-04-04 17:25:02 -04:00
Seth Vidal
8a61794234 add idempotent and ='s separated parameters to virt module to make people happy 2012-04-04 17:17:29 -04:00
Seth Vidal
415f4baa15 add virt module for libvirt interaction/support 2012-04-04 14:30:24 -04:00
Jeroen Hoekx
ab86726a15 Introduce per task variables and push them to templates. 2012-04-04 13:39:03 +02:00
Matthew Williams
c819f1715e apt module bugfix 2012-04-03 12:52:08 -07:00
Michael DeHaan
02d5e831ce have apt module raise an error if apt cannot be imported 2012-04-02 20:54:31 -04:00
Michael DeHaan
f92760de6c If missing state or name or list parameter on yum module, raise error explaining what is up. 2012-04-02 20:12:35 -04:00
Michael DeHaan
4792021f47 Fix syntax error in user patch 2012-04-02 20:08:40 -04:00
Michael DeHaan
e5d5b072db Merge remote branch 'public/integration' 2012-04-02 20:02:46 -04:00
Michael DeHaan
105a43a316 Merge pull request #104 from mgwilliams/feature-apt
improvements to apt module
2012-04-02 16:59:28 -07:00
Matthew Williams
9fdd7a837e improvements to apt module: state=latest, update-cache=yes|no, purge=yes|no 2012-04-02 14:42:54 -07:00
Matthew Williams
ae38ee0b3f protecting against replacing file or directory with link 2012-04-02 10:21:14 -07:00
Seth Vidal
08163c6251 catch all exceptions and emit sensible errors - if we have a config file error this lets us know about it 2012-04-02 12:33:46 -04:00
Matthew Williams
24f61f1583 "link" state in file module 2012-04-01 16:10:23 -07:00
Michael DeHaan
5764ccdb0e Eliminate possible race condition in async_wrapper where ansible deletes the argsfile while the module
is still kicking off.  Should not happen except in modules that are somewhat slow to load and probably
can be fixed better than the included sleep, i.e. some IPC communication that the process has
launched and is ok to exit.  This works pretty well for now though.
2012-04-01 02:35:19 -04:00
Michael DeHaan
2511992659 Surface module debug (-D) to /usr/bin/ansible also 2012-03-31 11:45:29 -04:00
Jeroen Hoekx
38a33c54a6 Make copy module idempotent.
Check md5sum before overwriting a file. Unconditionally copying changes the timestamp.
2012-03-31 13:59:41 +02:00
Michael DeHaan
d86dad76ba Be more flexible about where the service binary lives for better cross platform support. 2012-03-30 22:57:26 -04:00
Jeroen Hoekx
12d01a3444 Fix except statement in template module.
Python 2.4 (RHEL 5) does not know 'as'.
2012-03-30 11:46:30 +02: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
a05b75dbbb Merge pull request #101 from sfromm/user-module
Supplementary group membership now in users module
2012-03-28 16:24:26 -07:00
Michael DeHaan
13df76d3d5 Merge pull request #100 from sfromm/group-module
Remove support for membership from group module
2012-03-28 16:24:15 -07:00
Christopher Johnston
509c330f53 add support for running and started - both will do the same thing 2012-03-28 16:06:26 -07:00
Stephen Fromm
a379d58cdb Drop support of group membership in group module
Use the user module to define group membership.
2012-03-28 14:29:23 -07:00
Stephen Fromm
416eb36b9a Update user module to support supplementary group membership
This adds two options to the user module: groups and append.  groups is
a comma-delimited list of supplementary groups a user should belong to.
If a user is currently a member of a group not listed in groups, the
user will be removed from it.  To change this behavior, use append=yes.
This will append the user to the list of supplementary groups and *not*
remove the user from unlisted groups.
2012-03-28 14:12:35 -07:00
Stephen Fromm
db677954ac Add group module to manage groups and group membership
This relies on groupadd, groupmod, groupdel, and gpasswd utilities on
the system.  You can optionally modify the gid for the group.  You can
also add/remove a user to/from a group with the option member.  Member
state is defined with the option memberstate.
2012-03-26 23:04:19 -04:00
Stephen Fromm
8592b3b40d Update user module to support group name
This changes the gid option to group.  One may provide a primary group
as either a gid or a name.  The module will then check to verify that
the group already exists.  If the group does not already exist, the
module will fail.
2012-03-26 23:03:09 -04:00
Seth Vidal
37f599efc3 make sure latest outputs an error if the thing you've listed as 'latest'
is not there at all or even updateable
2012-03-26 23:02:09 -04:00
Seth Vidal
1d04ec89b7 fix up latest so it behaves like latest should
if installed and updated available: apply update
if not installed and available: install
2012-03-26 23:02:09 -04:00
Seth Vidal
a27be2651c make yum module work with older yum for rhel5 :( 2012-03-26 23:02:09 -04:00
Matthew Williams
3046f743d9 removed hack 2012-03-27 11:12:33 -07:00
Matthew Williams
bf0f3eac1f catch jinja template errors in template module 2012-03-27 11:06:31 -07:00
Matthew Williams
9d9e3d8c56 resetting template.. previous commit not needed 2012-03-27 09:10:51 -07:00
Matthew Williams
d9a464ee9d added format_advanced jinja filter to template module 2012-03-27 08:51:37 -07:00
Matthew Williams
e2deb94e73 trimmed superfluous code from apt module 2012-03-26 13:53:22 -07:00
Matthew Williams
e85355f054 cleaned up apt module style 2012-03-26 13:48:02 -07:00
Matthew Williams
90ba14d60e preliminary apt module 2012-03-26 12:49:13 -07: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
b213437bfa Added 'shell' to modules with a note that it doesn't really exist :) 2012-03-23 21:39:39 -04:00
Michael DeHaan
6aa10691c1 Merge pull request #93 from sfromm/user-module
User module
2012-03-22 19:24:53 -07:00
Stephen Fromm
f4835477b0 Add user module to create, modify, and delete user accounts
This relies on useradd, usermod, and userdel utilities on the system.
The argument name is required; if state is not provided, present is
assumed.  Other options supported for creating or modifying an existing
account:  uid, gid, comment, home, shell, and password.  If managing the
password, it must already be encrypted.  When creating an account, you
can also provide the argument createhome to control whether the home
directory is created.  Arguments supported for deleting an account are:
force (remove account even if user is logged in) and remove (remove home
directory).
2012-03-22 11:21:41 -07: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
faa59e5ef1 Add the failtest module, primarily for easy development testing purposes. RPMs/etc need not ship this. 2012-03-18 17:35:49 -04:00
Michael DeHaan
60bf82d266 Remove comment about FIXME that is already resolved 2012-03-15 23:05:34 -04:00
Michael DeHaan
311b93995c Add some comments 2012-03-15 22:37:37 -04:00
Michael DeHaan
6874d853c9 Fix changed=True/False detection when specifying mode= 2012-03-15 22:35:59 -04:00
Michael DeHaan
4ad885111b Disable debug 2012-03-15 22:04:32 -04:00
Michael DeHaan
5004d21f10 Return file info about the file regardless of changes made 2012-03-15 22:04:04 -04:00
Michael DeHaan
be55145a1e Initial crack at the file module 2012-03-15 21:53:14 -04:00
Michael DeHaan
a735dd2b17 Added the 'test-module' script, useful for testing modules without running them in Ansible. 2012-03-14 21:49:27 -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
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
aeea46678d Fix the copy module to use the argsfile method 2012-03-14 19:09:44 -04:00
Michael DeHaan
917f929e86 Fix template module 2012-03-14 19:08:10 -04:00
Michael DeHaan
6b152c94b9 Correct the setup module 2012-03-14 19:06:35 -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
1f53c89b14 convert so they handle argsfiles rather than arguments 2012-03-14 18:47:13 -04:00
Seth Vidal
a9a9e3af65 modify yum to be used with argsfile and fix a number of items with
how it handles "advanced" pkgspecs for the state= cases
2012-03-14 18:46:53 -04:00
Seth Vidal
0b94c78042 yum module
add state=latest and clean up the output cases
added some fixmes on verification
2012-03-12 16:31:13 -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
Seth Vidal
a99b491b32 touch up to yum module.
fix a couple of bugs
comment about state='latest'
2012-03-10 02:19:57 -05:00
Michael DeHaan
209760f8f6 Add manpage for ansible-playbook, since it is a command. More detailed docs will remain on the web site. 2012-03-09 22:06:44 -05:00
Michael DeHaan
1699013fbd Rename 'ensure' to 'state' so it lines up with the service module 2012-03-09 18:50:34 -05:00
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
2012-03-09 18:33:58 -05:00
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.
2012-03-05 20:09:03 -05:00
Michael DeHaan
cb5929dad7 Setup module tests 2012-04-04 11:55:24 -04:00
Michael DeHaan
c71afe35d6 Async tests complete. Fixed bug in async_wrapper 2012-04-04 11:30:14 -04:00
Michael DeHaan
c86b388812 Strip trailing newlines from command module, which happens in some shell commands 2012-04-04 10:30:22 -04:00
Michael DeHaan
6a0b793578 Remove debug comments 2012-03-03 13:42:37 -05:00
Michael DeHaan
8e07d83ad1 Async module, mostly operational, daemonizing/watch code may have bugs 2012-03-03 13:19:33 -05:00
Michael DeHaan
718e2930b2 async module now forks 2012-03-03 13:06:43 -05:00
Michael DeHaan
45c40524ef Time limit needs to be passed to async_wrapper. 2012-03-03 12:47:31 -05:00
Michael DeHaan
a06d8859fa Added start of async_status script.
Parameters:
  jid=X
  mode=status|cleanup (default status)

status = returns results from the job
cleanup = deletes the job file, should also kill the job if still running (TODO)
2012-03-03 12:41:22 -05:00
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.
2012-03-03 12:25:56 -05:00
Michael DeHaan
e9a24cdad4 Extensive refactoring of bin/ansible, moving most output functions into lib/ansible/utils to
encourage readability and make things more maintainable.
2012-03-02 21:08:48 -05:00
Michael DeHaan
1420c49277 Still seeing some weirdness from ohai but we can probably simplify
this until we figure out what that is.
2012-03-02 19:48:37 -05:00
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 2012-03-02 19:44:50 -05:00
Michael DeHaan
c8b1bbc7ea make command module error when no -a more obvious as command is the default module and someone
may forget about -a.  The CLI already warns about no host pattern by pulling up usage.
2012-03-01 22:25:01 -05:00
Michael DeHaan
847846af0e -p has been replaced by a required option. Various docs changes. 2012-03-01 22:10:47 -05:00
Michael DeHaan
19fdb7305d have command module raise an error if no arguments are supplied 2012-02-28 04:02:29 -05:00
Michael DeHaan
281f96b8dd merge Seth's ansible-command script with ansible proper, so we can do nice output, one line output,
and treeish saving everywhere.

there are probably some quirks here we'll want to refine further later, for instance, we should
be able to do nicer things with "can't contact host tracebacks".
2012-02-28 03:54:41 -05:00
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
2012-02-28 02:32:14 -05:00
Michael DeHaan
7de661dd2c Add ansible command, fix import error in runner 2012-02-28 00:45:37 -05:00
Michael DeHaan
be4cb64c92 Relicensing to GPLv3, all previous committers ok'd on mailing list. 2012-02-28 19:08:09 -05:00
Michael DeHaan
320ce8f5f1 If ohai is present, do the same with facter and make it available for the templating engine 2012-02-27 23:15:11 -05:00
Michael DeHaan
186dab4dff Include facter variables for free in setup JSON (prefix with 'facter'.
Also sort keys in JSON file and pretty print
2012-02-27 23:06:32 -05:00
Michael DeHaan
ba4e36a9a9 Rename 'ensure' to 'state' because I think it's a bit cleaner and doesn't imply
all modules take a common parameter name.  But more or less we still work idempotently
in modules.
2012-02-26 22:31:42 -05:00
Michael DeHaan
228d1a0834 A really basic git module. Improvements welcome. 2012-02-26 22:17:31 -05:00
Seth Vidal
39f42cfd75 when it is an IOError or an OSError - return a normal error message instead of a traceback barf 2012-02-27 17:53:02 -05:00
Michael DeHaan
61d064d011 Fixed up KV munging in runner, misc fixes to copy, setup, and template modules 2012-02-26 19:55:26 -05:00
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
2012-02-26 19:21:44 -05:00
Michael DeHaan
deb71da91e trim md5sum string so it does not contain the filename
also fix a bug/typo in the reporting from playbook
2012-02-26 12:10:57 -05:00
Michael DeHaan
bfd93081ae Have to return the return code on failure, it's a rule! 2012-02-25 21:00:51 -05:00
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.
2012-02-25 20:27:11 -05:00
Michael DeHaan
b44ae0af90 applying indentation patch from skvidal 2012-02-25 17:16:23 -05:00
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.
2012-02-24 05:15:28 -05:00
Michael DeHaan
440bac4a95 Added remote templating engine using jinja2, see examples/playbook.yml for usage.
Cleanup is due in runner.py
2012-02-24 04:35:51 -05:00
Michael DeHaan
5d6b0280d5 Added stub for template execution, WIP. 2012-02-24 03:45:36 -05:00
Michael DeHaan
102385e4ad Added a setup module which can be used to place key-value JSON data
on the system for use in a later template module.   These values
could also be used for module-specific config.
2012-02-24 03:25:09 -05:00
Michael DeHaan
9e931f323c Update ohai module to run on older python clients. 2012-02-24 02:05:49 -05:00
Michael DeHaan
f17c4ca4b2 Added an 'ohai' module. Some weird JSON hackage to get it to work. 2012-02-24 02:04:50 -05:00
Jeremy Katz
24e10dc2e8 Don't use a shell and thus avoid a whole class of problems 2012-02-24 16:10:53 -05:00
Jeremy Katz
ef8ea13495 Fall back to standalone simplejson module
CentOS5 has python 2.4 which doesn't have a built-in json
module
2012-02-23 20:52:53 -05:00
Michael DeHaan
a2a8deaeaa Added command module 2012-02-23 17:19:06 -05:00
Michael DeHaan
3807824c6d Added file copy support w/ readme updates 2012-02-23 16:07:10 -05:00
Michael DeHaan
631ac37843 Example facter module. Look how quick that was. 2012-02-23 15:24:24 -05:00
Michael DeHaan
c4f6d493b3 Initial library directory 2012-02-23 14:18:51 -05:00