Commit graph

1672 commits

Author SHA1 Message Date
Serge van Ginderachter
129c7522d9 allow ansible_ssh_host to be templated
Use case: e.g. dual homed hosts on production en management network

The inventory_hostname is the regular host name and matches the
dns name on the production network; ansible connects to the host
through a management network; the dns name on the management network
is standardized and equals ${inventory_hostname}-mgt.mynetwork.com

Now this can be configured as the default in group_vars/all:

   ansible_ssh_host: {{ inventory_hostname + '-mgt.mynetwork.com' }}
2013-07-05 18:05:26 +02:00
Michael DeHaan
2cb7c30834 Improve interlaced output prevention when asking for host key approval. 2013-07-04 18:17:45 -04:00
Michael DeHaan
c55adc9ac9 Default to 'smart' transport, which will use OpenSSH if it can support ControlPersist. 2013-07-04 16:47:17 -04:00
Michael DeHaan
1683d44d2e Lock around SSH connectivity to new hosts in host checking mode such that prompts for host approval
messages do not get interlaced.
2013-07-04 16:04:31 -04:00
Michael DeHaan
cb26945d54 Close the named temporary file. 2013-07-05 01:24:08 -04:00
Michael DeHaan
3b1aa092f8 Closing stdin too early. 2013-07-05 01:20:08 -04:00
Michael DeHaan
ffadbc520a Enable paramiko to ask whether to add keys to known hosts. 2013-07-04 14:05:41 -04:00
Michael DeHaan
9db4f7a9a6 Makes host key checking the default behavior but can be disabled in ansible.cfg or by environment variable. 2013-07-03 16:47:20 -04:00
Stoned Elipot
0b3483cf03 Add Jinja2 filter |bool : return boolean interpretation of the value
'yes', 'on', '1', 'true', insensitively, and 1 are true,
 everything else is false
2013-07-03 02:13:19 +02:00
Michael DeHaan
6ba72854ee Merge pull request #3296 from ninetythirty/devel
Added flexible filename handling for main files
2013-06-30 16:42:57 -07:00
Michael DeHaan
c2988dfdb0 Merge branch 'option-updates' of git://github.com/jlund/ansible into devel
Conflicts:
	bin/ansible-pull
2013-06-30 19:31:37 -04:00
Michael DeHaan
2bbad5dae3 Merge pull request #3275 from madduck/implicit-negations
Enable negated patterns
2013-06-30 16:12:37 -07:00
Michael DeHaan
f2fc185651 Styling: indentation 2013-06-30 18:49:49 -04:00
Michael DeHaan
c265c761d0 Slight message tweak. 2013-06-30 18:27:15 -04:00
Michael DeHaan
e6adc2f066 Merge branch 'devel' of git://github.com/arturaz/ansible into devel 2013-06-30 18:25:33 -04:00
Michael DeHaan
146455fd0a Merge pull request #3375 from jhoekx/mandatory-filter
Add a mandatory jinja2 filter for use in templates.
2013-06-30 14:16:17 -07:00
Michael DeHaan
98e7eaf07a Merge pull request #3316 from dsedivec/devel
expanduser on each component of plug-in paths
2013-06-30 09:12:15 -07:00
Stoned Elipot
b7f89837bb Remove redundant call to _get_path() in PluginLoader.find_plugin() 2013-06-30 16:38:26 +02:00
Jeroen Hoekx
a37f55d32e Add a mandatory jinja2 filter for use in templates. 2013-06-29 16:01:34 +02:00
Joshua Lund
dc984d94ac Updates to Ansible command options
* Moved the --list-hosts option that is common to both `ansible` and
  `ansible-playbook` into utils/__init__.py (corrects a FIXME)
* Wrote new help text for the --list-hosts option that makes sense
  for both of the commands that it applies to
* Changed the usage argument in `ansible-playbook` so that it is
  setup in the base_parser method the same way that it is in
  the `ansible` executable
* Updated the help text for several options to correct typos,
  clarify meaning, improve readability, or fix grammatical errors.
  In the case of `ansible-pull`, I changed the help text so that
  it adheres to the same standards as the other executables.
2013-06-26 19:57:31 -06:00
Jesse Keating
e1dd83f2b6 add_host should not be a changed action
The action doesn't actually change anything on a system, so setting
the status to changed is wrong. add_host is much like set_fact in that
regard.

Since changed is False by default, there is no need to explicity set
it, so just create an empty dict for result and add to it from there.
2013-06-25 10:58:55 -07:00
Arturas Slajus
9be93d6ac7 Better error for fireball + sudo mode. 2013-06-25 10:45:01 +03:00
Dale Sedivec
b32131c867 expanduser on each component of plug-in paths
ansible.constants was calling expanduser (by way of shell_expand_path)
on the entire configured value for the library and *_plugins
configuration values, but these values have always been interpreted as
multiple directories separated by os.pathsep.  Thus, if you supplied
multiple directories for one of these values, typically only the first
(at least on *nix) would have e.g. "~" expanded to HOME.

Now PluginLoader does expansion on each individual path in each of
these variables.
2013-06-22 17:01:12 -05:00
Ninety Thirty
7b1e87b62d Added flexible filename handling for main files
tasks, handlers, and vars main files can now be any of main, main.yml, or main.yaml
2013-06-20 22:03:17 -06:00
martin f. krafft
fd02443d42 Enable negated patterns
A host pattern of the form '!foo' by itself does not work, but
'all:!foo' does. If the first pattern is a negation, this commit
automatically prepends 'all'.

Signed-off-by: martin f. krafft <madduck@madduck.net>
2013-06-20 07:55:35 +02:00
Michael DeHaan
010440dc47 Merge pull request #3114 from laggyluke/roles_combine_vars
Added basic support for hash_behaviour=merge in roles
2013-06-19 19:27:27 -07:00
Michael DeHaan
fc45470162 Merge branch 'with_inventory_hostnames' of git://github.com/sdossett/ansible into inv_hostnames 2013-06-19 22:01:57 -04:00
Michael DeHaan
0ce7996bb6 Merge pull request #3266 from trbs/20130619_first_found
enable use of multiple terms in first_found
2013-06-19 18:39:29 -07:00
Michael DeHaan
d2721526de Small tweak, don't merge conditionals, just evaluate each in turn. 2013-06-19 21:18:05 -04:00
Michael DeHaan
d9c0a5c37d Revert "now modules can implement with_items list globbing w/o updating"
This reverts commit 4942a06bc2.

Conflicts:

	lib/ansible/runner/__init__.py
2013-06-19 19:00:18 -04:00
trbs
87c7fa9138 enable use of multiple terms in first_found 2013-06-19 16:37:29 +02:00
George Miroshnykov
c642ba77ae Added basic support for hash_behaviour=merge in roles
Dict vars passed to roles are now properly merged
instead of simply overriding dict vars that are
coming from vars_files.
2013-06-19 09:14:20 +03:00
Jesse Keating
1074896105 make name the parameter, with hostname as alias
name is used throughout Ansible, it's the "standard". This change
applies that standard to the add_host routine and updates the docs to
reflect that. Related to https://github.com/ansible/ansible/pull/3254
2013-06-18 21:11:52 -07:00
Michael DeHaan
fc2d25eb82 Merge pull request #3127 from bennojoy/devel
bug fix for #3077, environment settings for script
2013-06-18 17:57:10 -07:00
Michael DeHaan
132c89e681 Merge branch 'callbackinit' of git://github.com/sergevanginderachter/ansible into devel 2013-06-18 20:52:43 -04:00
Michael DeHaan
7193ff5fbf Merge pull request #3250 from gildegoma/more_magical_ansible_ssh_user
Make 'ansible_ssh_user' available in templates
2013-06-18 17:08:29 -07:00
Michael DeHaan
2123507315 Merge branch 'sha256' of git://github.com/jlund/ansible into devel
Conflicts:
	library/network/get_url
2013-06-18 14:46:57 -04:00
Michael DeHaan
92754065bf Remove debug statement. 2013-06-18 14:41:52 -04:00
Michael DeHaan
5a504e3a3b Tweak error messages for undefined variables feature. 2013-06-18 13:30:02 -04:00
Michael DeHaan
637983cf31 cleanup example config file + Squashed commit of the following:
commit c36b66dc952dfff91043ecbca56cf3f1f8f00703
Merge: 240d7bf f4cf934
Author: Michael DeHaan <michael@ansibleworks.com>
Date:   Tue Jun 18 13:04:51 2013 -0400

    Merge branch 'unevaluated-vars' of git://github.com/lorin/ansible into lorin_undefined

    Conflicts:
    	lib/ansible/runner/__init__.py

commit f4cf934367
Merge: 2531440 07a1365
Author: Lorin Hochstein <lorin@nimbisservices.com>
Date:   Thu Jun 6 11:07:41 2013 -0400

    Merge branch 'devel' into unevaluated-vars

commit 253144045c
Author: Lorin Hochstein <lorin@nimbisservices.com>
Date:   Thu Jun 6 11:06:37 2013 -0400

    Fail template from file on undefined vars

    If config option is set, raise an exception if templating from a
    file and a variable is undefined.

commit aecb71d8b7
Author: Lorin Hochstein <lorin@nimbisservices.com>
Date:   Wed Jun 5 17:12:12 2013 -0400

    Add fail_on_undefined flag

    Add a fail_on_undefined flag to the template and template_from_string methods.

    If this flag is true, then re-raise the ninja2.excpetions.UndefinedError instead of
    swallowing it.

commit cbb1808f05
Merge: d4bbf49 41425fb
Author: Lorin Hochstein <lorin@nimbisservices.com>
Date:   Wed Jun 5 16:14:12 2013 -0400

    Merge branch 'devel' into unevaluated-vars

commit d4bbf492b0
Author: Lorin Hochstein <lorin@nimbisservices.com>
Date:   Mon Jun 3 19:46:13 2013 -0400

    template: Raise UndefinedError exception

    In template_from_string, raise an undefined error if it occurs.

    Have the caller catch it and throw an AnsibleUndefinedVariable

commit c947802805
Merge: 8d919d6 be33bcf
Author: Lorin Hochstein <lorin@nimbisservices.com>
Date:   Mon Jun 3 10:09:43 2013 -0400

    Merge branch 'devel' into unevaluated-vars

commit 8d919d6c97
Merge: 0f68ad8 b8630d2
Author: Lorin Hochstein <lorin@nimbisservices.com>
Date:   Thu May 30 16:27:48 2013 -0400

    Merge branch 'devel' into unevaluated-vars

commit 0f68ad8193
Author: Lorin Hochstein <lorin@nimbisservices.com>
Date:   Thu May 30 14:32:03 2013 -0400

    Optionally fail task on undefined variables

    This patch introduces a new configuration option called
    error_on_undefined_vars, which defaults to false.

    If this option is set to true, then a task which has unevaluated
    variables in its arguments will fail instead of running. Output looks
    like this:

        TASK: [set rabbitmq password] *************************************************
        fatal: [10.20.0.7] => Undefined variables: rabbitmq_user, rabbitmq_password
2013-06-18 13:24:30 -04:00
Gilles Cornu
48fe7ac19d Enlarge scope of 'ansible_ssh_user' magic variable
Allow to use ansible_ssh_user variable in `sudo_user` or `when` clauses
2013-06-18 17:53:52 +02:00
Scott Sturdivant
b10b676158 Print the default value if one is provided. 2013-06-17 14:15:31 -06:00
Michael DeHaan
e128e8b563 Merge pull request #3162 from strawlab/apt-key-binary-fix
allow apt-key module to work with binary key
2013-06-16 20:27:10 -07:00
Michael DeHaan
aa340c1508 Merge pull request #3169 from Debilski/fix-duplicate-host-reads
Allow inventory to be read from a pipe
2013-06-16 20:22:54 -07:00
Michael DeHaan
70a9be27f6 Merge pull request #3217 from dagolden/topic/late-sudo_user
Expand sudo_user after variable merging
2013-06-16 19:56:01 -07:00
Michael DeHaan
d9f91be34a Merge pull request #3227 from bcoca/modules_wantlist
implementing with_items list globbing made easier for modules
2013-06-16 19:29:02 -07:00
trbs
a4223e119d fixed x-bits in git 2013-06-16 22:22:16 -04:00
Brian Coca
4942a06bc2 now modules can implement with_items list globbing w/o updating
hardcoded lists in ansible code, just add WITH_ITEMS_USES_LIST in a
comment anywhere, and of course, support recieving params as list.

Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
2013-06-15 16:28:43 -04:00
David Golden
d65f45f0b2 Expand sudo_user after variable merging
Previous commit c3659741 expanded sudo_user during task construction,
but this is too early as it does not pick up variables set during
the play.

This commit moves sudo_user expansion to the runner after variables
have been merged.
2013-06-14 09:59:31 -04:00
Serge van Ginderachter
2a7f9df109 add support for callback_plugins/ relative to playbook 2013-06-12 23:54:00 +02:00