1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
Commit graph

812 commits

Author SHA1 Message Date
Will Thames
4fedb17e38 Apply templating to module arguments in playbook
Module arguments should have variable substitution applied
Also, replacing task.action with the templated task.name seems wrong
2012-08-01 22:22:46 -04:00
Will Thames
d43d81a9a4 Raise exception when sudo user does not exist
sudo can fail before getting to the password prompt if a user does not exist
<pre>
[will@tangerine ansible (sudo_missing_user)]$ sudo -u bobbins echo hello
sudo: unknown user: bobbins
sudo: unable to initialize policy plugin
</pre>
Fix raises a distinct exception when that occurs
2012-08-02 16:19:15 +10:00
Michael DeHaan
25acfa8170 Join with_items for the apt module, yum pending, and various fixes to the yum module to support aliases 2012-08-01 20:33:13 -04:00
Michael DeHaan
86ec639176 add error handling if you try to load files in the wrong data format 2012-08-01 19:51:52 -04:00
Michael DeHaan
08c5fe875b yell if input data for host or group vars are not hashes 2012-08-01 19:46:33 -04:00
Michael DeHaan
ed14312ad6 reinstate invalid argument checks where possible, daisy chainee/chained modules turn it off 2012-08-01 19:42:31 -04:00
Petros Moisiadis
2ac4acbf97 fixes for tests 2012-08-01 22:17:16 +03:00
Petros Moisiadis
5f4bf813b1 added an 'ignore_errors' option to tasks
Failed tasks with ignore_errors=True, allow the remaining tasks in the
play to be executed as if no failure happened. A failure notice is still
written to the output as well as an '...ignoring' message.
2012-08-01 19:13:07 +03:00
Michael DeHaan
f60517aa33 temporarily disable failing check on some things 2012-08-01 09:33:20 -04:00
Ahmad Khayyat
6728b6cdda Allow = symbols in variable values in host inventory 2012-07-31 23:36:26 -04:00
Michael DeHaan
8700de964c Teach the common module code to warn users about typo'd arguments and also set everything to None automatically such
that code doesn't have to do a lot of params.get('foo', None) everywhere.
2012-07-31 21:23:34 -04:00
Timothy Appnel
b30f4688cd concatenating stdout and stderr in runner/__init__'s _low_level_exec_command. 2012-07-31 16:59:45 -04:00
u348095
7e279f972e Use sudo_user as an argument in the sudo command 2012-07-31 16:21:24 +10:00
Michael DeHaan
8e60ad986a Do not log login_password params to DB module 2012-07-30 21:21:30 -04:00
Michael DeHaan
da44fb1e43 Fixes #731 by reinstating variables for inventory scripts 2012-07-30 19:26:46 -04:00
Michael DeHaan
ff82f0a168 Further service module tweaks 2012-07-28 16:48:04 -04:00
Peter Sankauskas
0188889aea Making inventory pattern matching handle group names 2012-07-30 12:51:29 -07:00
Michael DeHaan
d0f0315c9d Merge pull request #723 from skvidal/devel
fix trace-creating error in apt module - also make the default setting a...
2012-07-30 10:45:42 -07:00
Seth Vidal
21a35bde00 new patch - adds a 'boolean' function to the module_common class and cleans up
the apt module to use it
2012-07-30 13:41:42 -04:00
Derek Carter
547395a2be added inventory_hostname_short varible 2012-07-30 13:26:48 -04:00
willthames
ad9b8e2312 Output version string when --version is passed using optparse's version argument 2012-07-30 14:19:02 +10:00
Michael DeHaan
17be5537d6 When sudoing to another user, the umask may be set such that the next user might not be able to read/execute
the file.  Deal with this.
2012-07-28 08:48:05 -04:00
Michael DeHaan
fcdc281c28 If sudoing to a user other than root, the home directory of the original user is very unlikely to be readable by the
sudoed to user, so just use tmp.  Data will be readable by others (briefly before deletion) but never writeable.
2012-07-27 20:53:50 -04:00
Michael DeHaan
aa40c5f3b3 remove commented out debug lines 2012-07-27 20:44:55 -04:00
Michael DeHaan
ee5f12cd40 Slight tweaks on vars_prompt upgrades 2012-07-27 19:00:48 -04:00
Petros Moisiadis
c717934b7e Improved 'vars_prompt' syntax to support prompt text and (non-)private input
An example of the new syntax:

vars_prompt:
 - name: 'secret_variable_name"
   prompt: "Enter secret value: "
   private: "yes"
 - name: "nonsecret_variable_name"
   prompt: "Enter non-secret value: "
   private: "no"
2012-07-27 19:00:48 -04:00
Michael DeHaan
a65b4fef97 Fix up chain invocations of template 2012-07-26 00:39:44 -04:00
Michael DeHaan
19fc8eea80 Things that happen inside multiprocessing shouldn't make side effects, ergo append ansible_facts only
in playbook code.

This technically means with_items calls can't continuously add facts I guess, but I can't see anyone
ever trying that.
2012-07-25 21:30:49 -04:00
Michael DeHaan
da4562f495 changes to not clear the setup cache between runs, and also decide to run plays with no tasks
in them if it looks like they are not tagged, because if that is the case, then we may just
be gathering facts about them.
2012-07-25 20:45:51 -04:00
Michael DeHaan
f371092845 rm stray comment 2012-07-25 20:31:57 -04:00
Michael DeHaan
e035ce97ce blue on black, tears on a river, push on a shove, it don't mean much
(make colorized playbook runs not suck on black terminals)
2012-07-25 20:31:26 -04:00
Lorin Hochstein
b63a3bd0c7 Save module name and args when processing list of items.
This is necessary because daisy-chained modules will overwrite
these values.
2012-07-25 13:26:07 -04:00
Michael DeHaan
8d7f526df6 importing/not-importing methods should be colorized 2012-07-24 20:41:24 -04:00
Michael DeHaan
d3e8e8ff54 Fix output message 2012-07-24 20:37:27 -04:00
Michael DeHaan
c16b691883 Copy module needs to use src as transfer path. 2012-07-24 20:35:10 -04:00
Michael DeHaan
263432daa1 Changed no hosts to red. Not sure this is the right color choice, but there is no orange :) 2012-07-24 20:21:49 -04:00
Michael DeHaan
82cca242e3 use AnsibleError so that if there is an error it does not print a traceback 2012-07-24 20:16:35 -04:00
Michael DeHaan
8fa4dc3920 Small change to previous patch, make ranges of hosts inclusive. 2012-07-24 20:10:05 -04:00
Michael DeHaan
416b8d59a9 Merge branch 'devel' of https://github.com/fangchin/ansible into devel 2012-07-24 19:57:51 -04:00
Michael DeHaan
15062b38e1 Fix typo 2012-07-24 19:50:16 -04:00
Michael DeHaan
12ff9b5b9a Move color coding bits to module, use over rest of playbook 2012-07-24 19:30:02 -04:00
Chin Fang
5315dd146d Added lib/ansible/inventory/expand_hosts.py 2012-07-24 12:43:35 -07:00
Chin Fang
e3b2521f01 Added a host expansion feature to ansible's inventory parsing 2012-07-24 12:38:52 -07:00
Jan-Piet Mens
44a9226ece file mode now correctly set after chaining from copy 2012-07-24 16:43:36 +02:00
Michael DeHaan
3a2df329af Tweak the way chained callbacks work 2012-07-23 22:12:26 -04:00
Michael DeHaan
dd6399b5ae Fixup args being passed into file from copy, tweak preservation of changed attribute. 2012-07-23 21:56:21 -04:00
Michael DeHaan
153f3932b5 reinstate delete_remote_files 2012-07-23 21:30:09 -04:00
Michael DeHaan
632a83c79e Remove unused function 2012-07-23 21:28:18 -04:00
Michael DeHaan
479f8b8c26 Templating neccessary here. 2012-07-23 21:10:16 -04:00
Michael DeHaan
9b8793e42e Fix a glitch with daisy chain logic 2012-07-23 21:01:59 -04:00
Michael DeHaan
183330a9fa Merge pull request #662 from tima/regex-cond-tasks
Importing re in runner for doing conditional tasks using pattern matching i.e. re.search(). Also conditionally outputting item when skipping.
2012-07-23 17:52:52 -07:00
Michael DeHaan
cbea17e4c5 Fix up async 2012-07-23 20:46:35 -04:00
Michael DeHaan
cac7afd700 async is under construction 2012-07-23 20:06:18 -04:00
Michael DeHaan
1f44c07ddf Fix assemble usage, some issues still with async. 2012-07-23 19:40:21 -04:00
Timothy Appnel
4b9b9a8a5b Importing re in runner for doing conditional tasks using pattern matching i.e. re.search(). Also conditionally outputting item when skipping. 2012-07-23 19:36:26 -04: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
Michael DeHaan
617f9dc942 Added some caching logic to improve external inventory scripts, removed some debug statements. 2012-07-22 11:53:19 -04:00
Michael DeHaan
57f12ac9e3 Using __slots__ in more places, in particular, hosts and groups, where we are apt to create a fair amount of objects. 2012-07-22 11:40:02 -04: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
396b81b647 Remove this check as it wasn't really needed and in recent refinements keeps the group_vars stuff from working
as desired.
2012-07-22 10:06:10 -04:00
Michael DeHaan
d0f4358730 Port the copy module over to the new "common module" logic. 2012-07-21 17:07:42 -04:00
Michael DeHaan
d76c8c9c85 Various cleanup around runner's constructor and how daisy chaining is invoked. 2012-07-21 16:51:31 -04:00
Michael DeHaan
1682dd06c0 Avoid duplicate call to fetch inventory variables 2012-07-21 16:23:00 -04:00
Michael DeHaan
54c9c1e25c Some streamlining of first_available_file code 2012-07-21 16:15:36 -04:00
Michael DeHaan
2d06ee4c0d Fix some subtle things that were keeping 'hostvars' from being usable in templates. 2012-07-20 12:34:26 -04:00
Michael DeHaan
2b6d8a8be5 Fix some issues with the setup cache 2012-07-20 11:58:08 -04:00
Michael DeHaan
5a67a556cd Script to migrate YAML users to the INI format, so we can deprecate YAML inventory (which we are now doing). 2012-07-20 11:15:57 -04:00
Michael DeHaan
dcca08b27b Don't let with_items erase 'hostvars' 2012-07-20 10:02:35 -04:00
Michael DeHaan
b574c70006 host and group vars should update the setup cache 2012-07-20 10:00:51 -04:00
Michael DeHaan
ba3466af95 The following paths are now implict and optional in vars_files:
./group_vars/groupname.yml (for all groups the host is in)
./host_vars/hostname.yml (for the hostname given in the inventory)

This requires an actual inventory file, not script and the paths are relative
to the directory of the inventory file.
2012-07-20 09:43:45 -04:00
Michael DeHaan
db1a4d8fac Make 'assemble' use the new daisychain logic 2012-07-20 09:17:42 -04:00
Michael DeHaan
6fb74ae2f9 preserve 'changed' attributes in daisychain logic 2012-07-20 09:13:10 -04:00
Michael DeHaan
d72c0c8898 replace module daisy-chaining logic 2012-07-20 08:57:50 -04:00
Michael DeHaan
6e84374c2a Make hostvars work post refactoring 2012-07-20 08:29:44 -04:00
Michael DeHaan
b0eedfbf92 Merge pull request #639 from goozbach/issue-627
improved output in with_items fixes: #627
2012-07-20 16:36:49 -07:00
Michael DeHaan
85b9fa580c Merge pull request #644 from bradobro/common_fix
AnsibleModule now correctly reads param values with '"'.
2012-07-20 14:31:24 -07:00
bradobro
a4a09fec82 AnsibleModule (in module_common.py) now correctly reads param values containing '='. 2012-07-20 21:19:38 +00:00
Stephen Fromm
8195375412 Sanitize possible password argument when logging invocation; taken from user module 2012-07-20 11:57:36 -07:00
Derek Carter
34e2584220 improved output in with_items fixes: #627 2012-07-20 14:01:54 -04:00
Rodney Quillo
5f068913ee Suppress Ubuntu ssh -tt error ioctl error. 2012-07-20 13:23:14 +08: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
4b66d98332 Adding missing colon... can't believe I missed that... sorry 2012-07-18 17:48:13 -07:00
Michael DeHaan
b38f8bfa80 Merge pull request #620 from pas256/patch-1
Conditional Imports should only import the first vars_file found in list
2012-07-18 16:31:45 -07:00
Peter Sankauskas
413fb15e0a Conditional Imports should only import the first file in the list, not all of them. This change stops looping through the vars_files list as soon as a file is found. 2012-07-18 15:31:04 -07:00
Seth Vidal
5ad9bc8833 when using -i"hostname," on the cli - don't complain about the host named "" not being a host - just clip it from the list 2012-07-18 16:56:41 -04:00
Michael DeHaan
bfed0f14ec Merge pull request #613 from ludovicc/devel
Allow local plays to execute when --ask-sudo-pass is used on the command line
2012-07-18 10:27:51 -07:00
Ludovic Claude
26dc607c5c Revert "Change previous fix to a one line change relative to upstream"
This reverts commit 0d53b1b097.
2012-07-18 19:02:56 +02:00
Ludovic Claude
0d53b1b097 Change previous fix to a one line change relative to upstream 2012-07-18 17:52:51 +02:00
Ludovic Claude
c4303c8c04 Avoid spurious error when mixing a local play with remote plays depending on --ask-sudo-pass 2012-07-18 12:05:12 +02:00
Jeroen Hoekx
f1b1611956 Fix typo while handling custom facts.
This fixes #611.
2012-07-18 11:50:34 +02:00
Michael DeHaan
8bb8314d10 Inject vars need to pushed further up to make with_items work as desired. 2012-07-17 20:09:18 -04:00
Michael DeHaan
3c2cbae68e Plays and tasks now yell when they see parameters they do not understand, so that typos like 'var' for 'vars'
don't result in people having to ask questions about what is wrong with their playbook
2012-07-17 19:09:36 -04:00
Michael DeHaan
e4a546e8bb Make it possible to use variables from 'vars' in the paths to task level include statements. 2012-07-17 18:57:02 -04:00
Dave Hatton
72ca9e58e7 meaningful messages if the remote md5 fails 2012-07-17 09:14:16 +01:00
Michael DeHaan
0edd0d4736 Fixing template calls 2012-07-16 20:26:39 -04:00
Michael DeHaan
5f69c557b9 Fix for the way host variables were being swallowed, plus some overall simplification. Deciding what
dictionary to use for templating now happens in exactly one place (executor_internal) and the "inject"
dictionary is passed to what needs it.
2012-07-15 14:19:11 -04:00
Dave Hatton
c3205595b3 format fixes to make fetch more usable 2012-07-16 11:43:37 +01:00
Michael DeHaan
b542dd8466 Fix import in ssh connection 2012-07-15 13:12:11 -04:00
Michael DeHaan
80edea2934 with_items handling code should apply to all modules, was screwed up in refactoring to only apply to 'normal'
modules.
2012-07-15 12:51:56 -04:00
Michael DeHaan
1754de3335 Misc code cleanup, mostly whitespace preferences, removing unused imports, plus a few fixes here and there. 2012-07-15 12:29:53 -04:00
Michael DeHaan
4b73931351 misc code cleanup, don't pass parameters to the connection object we can already get from Runner 2012-07-15 11:54:39 -04:00
Michael DeHaan
6341e75e33 misc code cleanup 2012-07-15 11:20:59 -04:00
Michael DeHaan
031ba43d22 minor code cleanup 2012-07-15 11:09:15 -04:00
Michael DeHaan
1d8bb17785 misc code cleanup 2012-07-15 10:57:22 -04:00
Michael DeHaan
5a63a48e6b No need to feed variables into the setup module for preservation since the file is no longer saved to disk. 2012-07-15 10:24:38 -04:00
Michael DeHaan
227c500ad7 Misc cleanup/formatting 2012-07-15 10:22:15 -04:00
Michael DeHaan
867b2437cc consolidate output code in callbacks.py, from utils, remove extra functions 2012-07-15 10:12:49 -04:00
Michael DeHaan
bc71c6ddd7 add space between function 2012-07-15 09:33:48 -04:00
Michael DeHaan
cb55cd6f8d removed unused function 2012-07-15 09:33:22 -04:00
Michael DeHaan
68a9adc1be Indentation cleanup (partial) 2012-07-15 09:32:47 -04:00
Michael DeHaan
244b923559 No longer need to calculate setup metadata location since we don't write
the setup file to disk.
2012-07-15 09:25:17 -04:00
Michael DeHaan
61d8e2e7c7 with_items should be processed inside the task class, also make first_available_file
and with_items incompatible.  Most cases that would need this could be solved
with vars_files.
2012-07-15 09:17:04 -04:00
Michael DeHaan
706cfd9ade Misc cleanup -- moved function out of utils, removed debug statement. 2012-07-15 08:50:23 -04:00
Michael DeHaan
19a2fc00dc Clean up imports in utils, add nicer recursion depth limit check. 2012-07-15 08:46:58 -04:00
Michael DeHaan
60d64251f8 Allow gather_facts: False in a playbook as a way of disabling the fact step if you know
you aren't going to need it.
2012-07-14 19:49:42 -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
028f216689 Error handling and magic around with_items, to let you know when variables are usable inside it and when not. 2012-07-14 13:23:14 -04:00
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.
2012-07-14 13:12:19 -04:00
Michael DeHaan
15b2b3a020 Warn if something loaded by vars_files is not a dictionary 2012-07-14 12:39:06 -04:00
Michael DeHaan
279b5965b8 Much streamlining around setup steps in playbooks, now only run setup once per play. 2012-07-14 12:24:19 -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
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 649963ca2c2610b97a90d2449132a57ae6b39ec9
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 7f9718f185ec991bc165c4a52b2468cf41f4c349
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 eb63b9e899318ce0c26902ca73af50135a6224e4
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 aa13d233078b825a8057bebf35ed478342cf4e43
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 264ebaa77c4243f2e9117e8d1168dc2f2eed7ee2
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 7db49a8048e78402c4c9a0a6cb2604689280fbbb
Author: Dag Wieërs <dag@wieers.com>
Date:   Thu Jul 12 16:46:53 2012 +0200

    Might as well fix this too

commit f36c6c8c5b419865939c7e2b0b26f6c97255fdc8
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 a96f6813522c5ae8b2be4514a2de56a775c6b7b0
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 ]
    ----
2012-07-12 01:29:51 -04:00
Michael DeHaan
611e5b0c90 Make adding tags to a playbook work as shorthand to tagging all tasks in the play. 2012-07-12 00:58:48 -04:00
Michael DeHaan
cf313cde96 Soft import of paramiko since we have the SSH and local connection types now. Packaging will still
require it.
2012-07-12 00:43:51 -04:00
Michael DeHaan
a765deccce Allow top level playbook files to import other playbook files, added some basic
playbook structure checking.
2012-07-12 00:19:44 -04:00
Dag Wieërs
cb40778b84 Wrong evaluation of a local file before fetching the remote file 2012-07-13 11:07:32 +02:00
Timothy Appnel
84fa9dcaee The default private key file was getting set incorrectly from environment variables. My bad. 2012-07-12 13:30:30 -04:00
Ingo Gottwald
26aa4e2469 Enabled cowsay support for Ubuntu 2012-07-12 11:14:15 +02:00
Michael DeHaan
dc4ebab345 Merge pull request #576 from davehatton/adjust_playbook_output_formating
improve output formating for playbook
2012-07-11 17:42:39 -07:00
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!
2012-07-11 20:33:46 -04:00
Michael DeHaan
83f23ef861 Basic support for tagging tasks and selecting a subset of tasks to run with --tags. 2012-07-11 19:51:26 -04:00
Dave Hatton
7ecdb83800 improve output formating for playbook 2012-07-11 09:35:10 +01: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
Michael DeHaan
0d28466b22 When sudo'ing to root, keep the setup file location as /etc/ansible/setup 2012-07-07 09:29:03 -04:00
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.
2012-07-07 09:10:18 -04:00
Michael DeHaan
8220d57690 Clean up md5 functions + make the fetch module stay happy if the remote file does not exist. 2012-07-07 08:47:32 -04:00
Michael DeHaan
b551eba6d4 Comment uncommented methods in utils 2012-07-07 08:47:32 -04:00
Michael DeHaan
a490213d45 Release bump to start development on 0.6 2012-07-04 18:07:19 -04:00
Michael DeHaan
e3aba7770f Merge pull request #518 from brainpage/devel
adds 'groups' variable, essentially making hosts file accessible as a var
2012-07-04 11:28:46 -07:00
Daniel Hokka Zakrisson
9882dd56f6 Allow variables in variables in templates 2012-07-03 16:42:00 +02:00
alex
f72b1f4fd7 Fixed: pathname for tmp 2012-07-02 22:04:56 +02:00
alex
bbf2939063 Fixed: executing templates outside playbooks 2012-07-02 21:34:11 +02:00
Jonathan Palley
cedbcfcc0a adds 'groups' variable, essentially making hosts file accessible as a variable 2012-07-01 15:04:53 +08:00
Michael DeHaan
a5dd280149 Fix up the output of the raw module when run within /usr/bin/ansible 2012-06-29 18:48:37 -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
Jeroen Hoekx
d592e15dcc Correctly add ungrouped hosts to 'ungrouped' in YAML inventory. 2012-06-27 08:26:01 +02:00
Michael DeHaan
afb2e3e5ac Merge pull request #511 from dsummersl/devel
added ability to ovverride all ssh settings via ANSIBLE_SSH_ARGS
2012-06-26 15:28:49 -07:00
Dane Summers
37fce9c0f6 added ability to ovverride all ssh settings via ANSIBLE_SSH_ARGS 2012-06-26 14:59:42 -04:00
Michael DeHaan
8468e2255b Merge pull request #507 from jhoekx/convention-library-path
Add ./library to module search path.
2012-06-25 12:20:56 -07:00
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.
2012-06-25 21:08:43 +02:00
Jeroen Hoekx
6c92d2fa88 Import ansible errors in Poller. 2012-06-25 20:48:35 +02:00
Michael DeHaan
618924a24f Merge pull request #497 from davehatton/change_constants
shouldn't need a (slash) before /home/daveh
2012-06-22 12:01:15 -07:00
Dave Hatton
d42df3a82e change to STDOUT from PIPE to get ssh connection module working 2012-06-22 12:37:23 +01:00
Dave Hatton
d28bbe14ed shouldn't need a (slash) before /home/daveh 2012-06-21 15:37:43 +01:00
Dave Hatton
30d4f070a1 change STDOUT to PIPE to get ssh connection module working 2012-06-21 11:01:08 +01:00
Daniel Hokka Zakrisson
fa887bc90f Merge stdout and stderr for non-sudo 2012-06-20 20:49:52 +02:00
Daniel Hokka Zakrisson
7884bc02ea Wait for process to finish and then parse output 2012-06-20 20:49:52 +02:00
Seth Vidal
dca75033fe add -q to handle stdout/stderr being combined, add catch for ControlPersist not existing in ssh for rhel6, etc 2012-06-20 14:06:24 -04:00
Michael DeHaan
9662902c31 Merge pull request #492 from dhozac/unnecessary-parse_json
Remove unnecessary parse_json invocation
2012-06-20 10:26:17 -07:00
Michael DeHaan
071978a2e7 Merge pull request #493 from dhozac/ssh-merge-stdouterr
Merge stdout and stderr as that is what is expected
2012-06-20 10:24:32 -07:00
Daniel Hokka Zakrisson
f5ecd075f7 Remove unnecessary parse_json invocation 2012-06-20 14:54:36 +02:00
Michael DeHaan
bd653c8f3c Merge pull request #488 from dhozac/jinja2-env
Create a Jinja2 environment allowing includes
2012-06-19 13:09:02 -07:00
Michael DeHaan
e0f12292d8 Merge pull request #489 from dhozac/ssh-args-default
Default to using a ControlMaster connection
2012-06-19 13:01:09 -07:00
Daniel Hokka Zakrisson
7f6359b143 Default to using a ControlMaster connection 2012-06-19 21:58:24 +02:00
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.
2012-06-19 21:55:00 +02:00
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
2012-06-18 15:48:19 -04:00
Daniel Hokka Zakrisson
9f93839d13 Create a Jinja2 environment allowing includes 2012-06-17 22:18:08 +02:00
Daniel Hokka Zakrisson
ab08fea1aa Add an ssh command wrapper transport 2012-06-17 20:34:17 +02:00
Daniel Hokka Zakrisson
13b814a33c Run templating function until the text doesn't change
This allows variables to contain other variables.
2012-06-16 12:51:19 +02:00
Michael DeHaan
dad9695ac7 Merge pull request #478 from dhozac/not-host
Allow exclusion of hosts/groups
2012-06-15 17:39:47 -07:00
Jonte Norman
1b091a7e3e Fixed typo from results to result in _execute_raw method 2012-06-15 22:45:47 +02:00
Daniel Hokka Zakrisson
3d5c93bf44 Allow exclusion of hosts/groups 2012-06-15 11:01:30 +02: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
Michael DeHaan
c0a5d91592 Merge pull request #475 from nafeger/devel
Better error messaging in utils
2012-06-14 12:15:36 -07:00
Nathan A. Feger
9feb26ab28 Better error messaging in utils
When a command responds with json that is unparseable, dump that unpareseable response instead of swallowing it.
2012-06-14 13:17:38 -05:00
Michael DeHaan
2a8d1f07d4 Merge branch 'mktemp-vanish' of https://github.com/dagwieers/ansible into devel
Conflicts:
	lib/ansible/runner/__init__.py
2012-06-13 22:39:58 -04:00
Michael DeHaan
27c949ade9 Merge pull request #462 from tima/more-env-defaults
Most constants can be overriden with environment variables.
2012-06-13 19:20:33 -07:00
Michael DeHaan
2a49438c37 Merge pull request #461 from dhozac/only_if-early
Evaluate only_if early
2012-06-13 19:19:25 -07:00
Michael DeHaan
bd893b765b Merge pull request #459 from dhozac/with_items-variable
Allow a variable in with_items
2012-06-13 19:18:51 -07:00
Stephen Fromm
9cf182c225 Add assemble module
This adds a module that concatenates (ie. assembles) a file from
fragments in a directory in alphabetical order.  It chains the file
module afterward to fix up ownership and permission.  This also adds
tests for the assemble module with fragments in assemble.d.
2012-06-11 23:09:54 -07:00
Timothy Appnel
5ea8ad2d94 Most constants can be overriden with environment variables. Reserved doing anything with the connection options for further review. 2012-06-11 18:07:44 -04:00
Daniel Hokka Zakrisson
7942570411 Fix on_unreachable invocation with non-existing variable 2012-06-11 15:15:29 +02:00
Daniel Hokka Zakrisson
eba81ee36f Evaluate only_if early to do as little work as possible 2012-06-11 15:15:29 +02:00
Matt Goodall
c1b38f62c8 Search multiple paths for modules.
Minimal change to allow a list of paths (separated by the typical path
separator) to be searched in sequence for the named module.
2012-06-10 16:22:59 +01:00
Daniel Hokka Zakrisson
a05da2d312 Allow with_items to specify a variable 2012-06-09 21:59:22 +02:00
Daniel Hokka Zakrisson
933b5e8631 Reduce code duplication 2012-06-09 21:50:46 +02:00
Michael DeHaan
e8e6c98016 Merge pull request #455 from dhozac/vars_files-non-list
Expand vars_files identically for lists and non-lists
2012-06-08 12:19:47 -07:00
Michael DeHaan
01387520e9 Merge pull request #451 from phred/fix-fetch-module
Make 'fetch' test for local directories before creating.  Fixes issue #450
2012-06-08 12:06:02 -07:00
Michael DeHaan
e265cdfa1d Merge pull request #454 from jhoekx/configure-python-interpreter
Introduce ansible_python_interpreter variable.
2012-06-08 12:03:40 -07:00
Michael DeHaan
b1c2820a32 Merge pull request #456 from dhozac/notify-variable
Allow variables in notify list
2012-06-08 11:59:39 -07:00
Daniel Hokka Zakrisson
d0d036fd3f Expand $item for copy and fetch 2012-06-08 01:36:52 +02:00
Daniel Hokka Zakrisson
ad7b744764 Allow variables in notify list 2012-06-08 01:35:23 +02:00
Daniel Hokka Zakrisson
dff8d7be04 Expand vars_files identically for lists and non-lists 2012-06-08 01:32:56 +02:00
Jeroen Hoekx
1f63c47738 Introduce ansible_python_interpreter variable.
This allows configuration of the correct python interpreter on the managed system.
2012-06-07 09:50:38 +02:00
Dag Wieërs
b3b22c41e9 Get rid of mktemp dependency to support AIX
The function call has been renamed to better reflect what it does, and we
reduced the number of calls from two to one in case the remote user is not
root.

This patch also fixes a string concatenation in _copy_module() that
should use os.path.join() instead.

This closes #436
2012-06-06 14:47:47 +02:00
Fred Alger
bee04de26a Fix exception in fetch module when src or dest parameter omitted. 2012-06-05 11:35:19 -04:00
Fred Alger
d0c4f4015c Fix remote md5 in fetch module, related to Issue #450 2012-06-05 11:35:19 -04:00
Fred Alger
51b460e8c6 Make 'fetch' test for local directories before creating. Fixes issue #450 2012-06-05 10:38:12 -04:00
John Kleint
e9f770fa11 More helpful message when ssh fails. 2012-06-01 17:16:02 -04:00
Michael DeHaan
1ee7ff2f7b To allow plays using different user accounts in the same playbook to function, clear the setup cache
between plays.
2012-05-31 22:08:00 -04:00
Michael DeHaan
16f0d7b333 Revert "Get rid of mktemp dependency to support AIX"
This reverts commit 4ad1b57b52d735393f6c6bcbd5524b947134fbf9.
2012-05-31 21:59:31 -04:00
Michael DeHaan
99430fa0a3 Fix for older version of sudo + some changes to imports so tests are happy 2012-05-31 21:44:56 -04:00
Michael DeHaan
634cf9aaba Merge pull request #437 from dagwieers/mktemp-vanish
Get rid of mktemp dependency to support AIX
2012-05-31 18:37:28 -07:00
John Kleint
70837469c6 Properly template list of hosts in playbooks.
In playbooks, hosts can be a YAML list. We templated the list before
converting it to a semicolon-separated string, which actually templated its
repr. This converts to a string first. A basic unit test is included.
2012-05-31 16:06:21 -04:00
Dag Wieers
a8fd6ee9c3 Get rid of mktemp dependency to support AIX
The function call has been renamed to better reflect what it does, and we
reduced the number of calls from two to one in case the remote user is not
root.

This patch also fixes a string concatenation in _copy_module() that
should use os.path.join()

This closes #436
2012-05-31 17:02:10 +02:00
Michael DeHaan
6034b5b0f3 Split connection code into submodules. 2012-05-30 20:16:31 -04:00
Michael DeHaan
0972b761de Leverage cowsay if installed. 2012-05-30 19:44:00 -04:00
Brad Olson
c34921fe7b Removed legacy comment. 2012-05-30 15:37:14 -04:00
Brad Olson
81591009ea Fixed Inventory.get_hosts() ignoring restriction when there are no hosts left.
get_hosts() was treating [] (meaning complete restriction, no hosts allowed)
the same as None (meaning no restriction, all hosts allowed). Fixed logic.
2012-05-30 15:34:21 -04:00
Michael DeHaan
af9651f015 Merge pull request #420 from bradobro/fix_no_varfiles
Test for play.vars_files == None, avoiding nasty traceback.
2012-05-29 08:32:47 -07:00
Brad Olson
7ea4a0e895 Avoid traceback when vars file has no vars items. Could warn or fail instead. 2012-05-29 10:23:09 -04:00
Brad Olson
32b9ea689a Test for play.vars_files == None, avoiding nasty traceback. Ignores for now. Could warn.
Playbook test for no vars_files with len(), but that excepts if play.vars_files==None, as can happen when there's a vars_files section with no vars files listed. What is the ansible way: ignore, warn, or fail with message (instead of traceback)?
2012-05-29 10:09:38 -04:00
Cosmin Luță
74bfd7eb81 Removed line that caused stacktrace 2012-05-27 14:15:30 +03:00
Michael DeHaan
4664e354c3 Get with_items to work with new play/task architecture. 2012-05-26 01:49:23 -04:00
Michael DeHaan
ecb944892d Tweaks on previous refactoring of playbook, version bump a 0.4 reference, remove some debug, etc 2012-05-26 01:20:53 -04:00
Michael DeHaan
b9b53d1941 Playbook refactoring -- work in progress. 2012-05-26 00:37:34 -04:00
Michael DeHaan
cf9ddf3a30 Reorganizing file structure. Not done. 2012-05-25 19:34:13 -04:00
Michael DeHaan
6f114a2e2c Delete poller code from runner.py now that it is moved. 2012-05-25 19:20:01 -04:00
Michael DeHaan
db1d5b154a Fix casing/underscore convention in method name, split polling logic away from runner. 2012-05-25 19:18:02 -04:00
Michael DeHaan
6d580aea02 As part of a precursor to other refactoring, make returns less list-like throughout runner. 2012-05-25 18:44:29 -04:00
Matt Goodall
639763c138 Allow "=" in k-v values. 2012-05-23 00:58:05 +01:00
Matthew Williams
7bbcf5d2d5 template path for handlers: include 2012-05-21 21:40:07 -07:00
Michael DeHaan
1125ca548a Merge pull request #411 from mgwilliams/bug-fetch-module
Fetch module: run dwim on dest after templating, not before
2012-05-20 07:01:11 -07:00
Matthew Williams
effd931031 dim fetch dest after templating 2012-05-19 18:59:23 -07:00
Michael DeHaan
8e88667f82 Fix hosts being in multiple groups, and duplicate host references in the same inventory file. 2012-05-19 17:24:54 -04:00
Michael DeHaan
7302b7bbc4 Merge pull request #402 from denen99/devel
updated connection.py to have the same interface for exec_command on both LocalConnection and ParamikoConnection classes
2012-05-17 04:06:02 -07:00
Adam Denenberg
3dfd240b86 updated connection.py to have the same interface for exec_command on both LocalConnection and ParamikoConnection classes 2012-05-17 00:11:50 -04:00
Jeroen Hoekx
3eff44a2b0 Arguments to setup module should be json. 2012-05-15 17:43:01 +02:00
Seth Vidal
d80fd74b64 make sure private_key_file is hooked up in playbooks, too 2012-05-14 16:52:48 -04:00
Seth Vidal
96ef6482c5 add --private-key option and related infrastructure to make paramiko work
with a private key file - not just an agent or pw
2012-05-14 16:14:38 -04:00
Daniel Néri
e4991d1a61 In the template module, use utils.template_from_file instead of reimplementing it inline 2012-05-13 20:57:01 +02:00
Daniel Néri
f8b17ef8d3 For utils.template_from_file, change 'no_engine' default to True
This now follows the other template functions, and implicitly also
fixes that playbook handler includes were still processed by Jinja2.
2012-05-13 20:42:11 +02:00
Daniel Néri
4b0480dd9d Set 'hostvars' before performing variable replacements 2012-05-13 20:36:08 +02:00
Michael DeHaan
60d44e1a01 Squashed commit of the following, plus some streamlining (MPD).
commit e00368e7c65c65bed11fcaaf83fe8b093dbf492e
Merge: 2ea7110 c039aa0
Author: Michael DeHaan <michael.dehaan@gmail.com>
Date:   Thu May 10 01:43:10 2012 -0400

    Merge branch 'devel' of https://github.com/weaselkeeper/ansible into weaselkeeper-devel

commit c039aa091582cd31e206692df6f4f148394b41d6
Author: Jim Richardson <weaselkeeper@gmail.com>
Date:   Fri May 11 17:55:13 2012 -0700

    cleanup and simplification of ANSIBLE_REMOTE_TMP feature

commit d87f15b796b799c375808edc7cc0932d7809d325
Merge: 5917aba 4c2fd25
Author: Jim Richardson <weaselkeeper@gmail.com>
Date:   Fri May 11 17:30:16 2012 -0700

    Merge branch 'devel' of github.com:weaselkeeper/ansible into devel

commit 5917aba761af2e4163772d2d74e7efc0d169273a
Author: Jim Richardson <jrichardson@classmates.com>
Date:   Wed May 9 11:25:45 2012 -0700

     ANSIBLE_REMOTE_TMP environment variable sets where ansible will stuf tmp files on remote host.  Default is /var/tmp for root, and $HOME/.ansible/tmp for non-root

commit 4c2fd2577769a6392187585828168bcb4a1476da
Author: Jim Richardson <jrichardson@classmates.com>
Date:   Wed May 9 11:25:45 2012 -0700

     ANSIBLE_REMOTE_TMP environment variable sets where ansible will stuf tmp files on remote host.  Default is /var/tmp for root, and $HOME/.ansible/tmp for non-root
2012-05-10 01:50:22 -04:00
Michael DeHaan
ccab8ac2c0 Reinstate raw module 2012-05-10 01:14:30 -04:00
Michael DeHaan
b7bb0ab225 Do not read user's SSH config file because only reading it partially is confusing to everyone :) 2012-05-09 23:45:37 -04:00
Michael DeHaan
e060b06081 Allow hosts not in inventory to override inventory with -i "host1,host2:port" etc, which is the original intent
of --override-hosts.
2012-05-09 23:26:45 -04:00
Michael DeHaan
f8807da57b Merge pull request #363 from jhoekx/template-only-if
Fix correct variable expansion in includes only_if.
2012-05-11 15:55:09 -07:00
Jeroen Hoekx
cd9f926b5f Fix correct variable expansion in includes only_if.
There's not need to run the complete include through the templating engine.
Several variables were not included before the conditional was evaluated.
2012-05-11 15:55:33 +02:00
Michael DeHaan
dab50574e0 Merge pull request #356 from jkleint/singleton-notify
Support single handlers for notify.
2012-05-10 17:04:54 -07:00
John Kleint
d9427db14b Support single handlers for notify. 2012-05-10 15:37:30 -04:00
John Kleint
4cf0c5550e Fix YAML hosts list. 2012-05-10 15:13:32 -04:00
Jeroen Hoekx
3cbc229990 Support list indexing in varReplace. 2012-05-10 19:25:28 +02:00
Michael DeHaan
4819ce4989 Merge pull request #349 from jhoekx/template-unicode-fixes
Fixup unicode varReplace templating.
2012-05-10 05:05:50 -07:00
cocoy
c1fd1348b1 Fix for bug #264 2012-05-10 18:53:24 +08:00
Jeroen Hoekx
74e21e6154 Fixup unicode varReplace templating.
The original patches should have conflicted?
53bde0bf517d1302c80f80180f85995efa36a00e vs efde61e53729964f3e740dcbb9c52f889186719d
2012-05-10 10:11:14 +02:00
Stephen Fromm
fa9bfbba13 Fix for sudo to another non-root user (issue #353)
mktemp creates the temp directory 700 only.  If the sudo-user is not
root, the other user will not be able to run the command (Permission
denied error).  This adds the executable bit for all on the temp
directory.
2012-05-11 11:48:31 -07:00
Michael DeHaan
36639186e0 Merge pull request #362 from jhoekx/uppercase-vars
Allow camelCase variables in varReplace.
2012-05-11 10:06:21 -07:00