Commit Graph

353 Commits (276ad32a4535c262b9aa42c08981656344959f53)

Author SHA1 Message Date
Abhijit Menon-Sen ac98fe9e89 Implement ssh connection handling as a state machine
The event loop (even after it was brought into one place in _run in the
previous commit) was hard to follow. The states and transitions weren't
clear or documented, and the privilege escalation code was non-blocking
while the rest was blocking.

Now we have a state machine with four states: awaiting_prompt,
awaiting_escalation, ready_to_send (initial data), and awaiting_exit.
The actions in each state and the transitions between then are clearly
documented.

The check_incorrect_password() method no longer checks for empty strings
(since they will always match), and check_become_success() uses equality
rather than a substring match to avoid thinking an echoed command is an
indication of successful escalation. Also adds a check_missing_password
connection method to detect the error from sudo -n/doas -n.
2015-09-23 01:55:00 -04:00
Brian Coca f96255f7fd fixed typo 2015-09-21 10:10:21 -04:00
Florian Apolloner d9f873495e Ported over #7158 to support SELinux context switches. 2015-09-17 15:03:46 +02:00
Brian Coca 4aea1f6568 normalized plugin paths and names and configs 2015-09-15 11:44:09 -04:00
Brian Coca a7231c2203 actually implemented flags correctly for all priv escalation methods 2015-09-02 11:31:39 -04:00
Brian Coca e156d9b677 fixed and generalized privilege escalation exe settings 2015-09-02 09:29:34 -04:00
James Cammarata 2761df232e Small tweak to 7551b75 to correct the ordering of tests 2015-09-01 14:48:59 -04:00
James Cammarata 7551b75e61 Add ispath type for constants and make sure all local paths are ispath=True
Fixes #12180
2015-09-01 14:47:45 -04:00
Brian Coca a4ffa09414 Merge pull request #11880 from bcoca/configurable_squash
made squashable with_ plugin list configurable
2015-08-23 13:32:15 -04:00
Feanil Patel 892e230514 Don't convert nulls to strings.
This change is similar to https://github.com/ansible/ansible/pull/10465

It extends the logic there to also support none types.  Right now if you have
a '!!null' in yaml, and that var gets passed around, it will get converted to
a string.

eg. defaults/main.yml
```
ENABLE_AWESOME_FEATURE: !!null # Yaml Null
OTHER_CONFIG:
  secret1: "so_secret"
  secret2: "even_more_secret"

CONFIG:
  hostname: "some_hostname"
  features:
    awesame_feature: "{{ ENABLE_AWESOME_FEATURE}}"
  secrets: "{{ OTHER_CONFIG }}"
```

If you output `CONFIG` to json or yaml, the feature flag would get represented in the output
as a string instead of as a null, but secrets would get represented as a dictionary.  This is
a mis-match in behaviour where some "types" are retained and others are not.  This change
should fix the issue.

I also updated the template test to test for this and made the changes to v2.

Added a changelog entry specifically for the change from empty string to null as the default.

Made the null representation configurable.

It still defaults to the python NoneType but can be overriden to be an emptystring by updating
the DEFAULT_NULL_REPRESENTATION config.
2015-08-19 18:35:07 -04:00
Brian Coca 961bee00d5 centralized the definition of 'localhost' 2015-08-19 15:49:37 -04:00
Brian Coca e081a73aa1 make new inventory config take precedence over old hostfile config
fixes #11907
2015-08-18 03:29:14 -04:00
Damian Gerow 1c5611100e Add become support for OpenBSD doas 2015-08-17 21:31:18 -04:00
Brian Coca 49d88cef9c meta: refresh_inventory and several inventory fixes 2015-08-12 10:35:12 -04:00
Brian Coca 4d853a5d3c implemented for v2, missing --tree option for adhoc 2015-08-11 19:18:10 -04:00
Abhijit Menon-Sen 3d581e5306 Don't stat None
Fixes #11794, regression introduced by #11010
2015-07-30 08:02:27 +05:30
Brian Coca 4b8e368039 Merge pull request #11010 from sillydong/devel
Add judgment to to fix path0 if ANSIBLE_CONFIG is set to a dir
2015-07-29 21:36:07 -04:00
James Cammarata 3a50c08c01 Merge branch 'pluggable_jinja_tests' of https://github.com/quixoten/ansible into quixoten-pluggable_jinja_tests 2015-07-29 15:16:27 -04:00
Brian Coca 0b6fadaad7 started implementing diff
diff now works with template
also fixed check mode for template and copy
2015-07-26 12:22:22 -04:00
Brian Coca a6ba149c49 implemented simplified output for adhoc adn command modules as in v1 2015-07-23 13:42:20 -04:00
James Cammarata 7a9916422a Fixing up error handling for fetch_file ops in connection plugins
* enable batch mode (configurable with a config option, on by default)
  for sftp transfers, so we can catch errors more easily
* general cleanup in the local connection plugin and fetch action plugin

Fixes #11612
2015-07-22 14:25:47 -04:00
Brian Coca b76cb8f655 now that invocation is only async again, no need to sanitize 2015-07-15 10:40:37 -04:00
James Cammarata 6971e92f39 Fixing up some output stuff 2015-07-14 00:23:17 -04:00
Brian Coca 1274ce565d added result sanitation to registered var and to callbacks
removed time display as it only is provided by command module
2015-07-11 01:05:29 -04:00
Carlos E. Garcia 657495d13f minor spelling changes 2015-07-10 12:42:59 -04:00
James Cammarata b520d5bc60 Lots of fixes for integration test bugs 2015-07-10 01:53:59 -04:00
Brian Coca 897e098b27 minor fixes to constants 2015-07-08 16:33:51 -04:00
Brian Coca 50efeb13ba made squashable with_ plugin list configurable
partially deals with #11383
2015-07-07 11:59:20 -04:00
Toshio Kuratomi 5b0b1f8da6 unquote strings in the ansible config file 2015-07-06 14:12:10 -07:00
Brian Coca 05be30168d return empty string when config file is not used 2015-07-05 12:51:05 -04:00
Brian Coca 5f791329ce now verbose mode shows config file used 2015-07-04 10:23:49 -04:00
Brian Coca 9e37402cb7 added ramfs to selinux ignored filesystems
as reported in #11442
2015-07-02 17:25:05 -04:00
James Cammarata b6c52ce115 Allow role variables to be optionally kept in a private scope 2015-07-01 11:33:14 -04:00
James Cammarata 21c14363fd Allow callback plugins to be whitelisted 2015-06-29 10:56:28 -04:00
Brian Coca b89071e485 now detects incorrect password with sudo and su (at least in english) 2015-06-15 01:30:03 -04:00
Brian Coca ff15f374ad fixed new become settings, rearranged constants to find PE related vars easier 2015-06-14 20:50:38 -04:00
Brian Coca eaddc0b309 removed duplicate retry config entries 2015-05-25 11:06:04 -04:00
Hugh Saunders 2e07567c16 Retry exec command via ssh_retry
This PR adds the option to retry failed ssh executions, if the failure
is caused by ssh itself, not the remote command. This can be helpful if
there are transient network issues. Retries are only implemented in the
openssh connection plugin and are disabled by default. Retries are
enabled by setting ssh_connection > retries to an integer greater
than 0.

Running a long series of playbooks, or a short playbook against a large
cluster may result in transient ssh failures, some examples logged
[here](https://trello.com/c/1yh6csEQ/13-ssh-errors).

Ansible should be able to retry an ssh connection in order to survive
transient failures.

Ansible marks a host as failed the first time it fails to contact it.
2015-05-18 14:22:52 -07:00
Brian Coca 0913b8263c made special treatment of certain filesystem for selinux configurable 2015-05-15 13:52:27 -04:00
Chen Zhidong 14719a6f08 Add judgment to to fix path0 if ANSIBLE_CONFIG is set to a dir 2015-05-14 22:02:30 +08:00
James Cammarata ce3ef7f4c1 Making the switch to v2 2015-05-03 21:47:26 -05:00
Devin Christensen 1bf5224f82 Enable writing plugins for jinja2 tests 2015-04-28 09:32:11 -06:00
Jesse Rusak 652cd6cd5e Fix --force-handlers, and allow it in plays and ansible.cfg
The --force-handlers command line argument was not correctly running
handlers on hosts which had tasks that later failed. This corrects that,
and also allows you to specify force_handlers in ansible.cfg or in a
play.
2015-04-10 19:38:59 -04:00
Brian Coca 5ec1f3bd6e removed folding sudo/su to become logic from constants as it is already present downstream in playbook/play/tasks 2015-03-27 08:45:04 -04:00
Brian Coca 587ab17f10 fixes password error detection for ssh connection plugin
removes sycnronize test that does not work with current sudo setup
Fixes #10434
2015-03-11 16:11:27 -04:00
Brian Coca 5f6db0e164 preliminary privlege escalation unification + pbrun
- become constants inherit existing sudo/su ones
- become command line options, marked sudo/su as deprecated and moved sudo/su passwords to runas group
- changed method signatures as privlege escalation is collapsed to become
- added tests for su and become, diabled su for lack of support in local.py
- updated playbook,play and task objects to become
- added become to runner
- added whoami test for become/sudo/su
- added home override dir for plugins
- removed useless method from ask pass
- forced become pass to always be string also uses to_bytes
- fixed fakerunner for tests
- corrected reference in synchronize action plugin
- added pfexec (needs testing)
- removed unused sudo/su in runner init
- removed deprecated info
- updated pe tests to allow to run under sudo and not need root
- normalized become options into a funciton to avoid duplication and inconsistencies
- pushed suppored list to connection classs property
- updated all connection plugins to latest 'become' pe

- includes fixes from feedback (including typos)
- added draft docs
- stub of become_exe, leaving for future v2 fixes
2015-03-10 18:42:36 -04:00
Brian Coca 13d788021f Merge pull request #4820 from mscherer/add_local_config
Add path for user defined plugin
2015-02-11 14:44:07 -05:00
Brian Coca 17666a1939 changed default for new retry path to be teh same as current
also added commented out entries in ansible.cfg to show other options
2015-01-30 15:18:58 -05:00
Brian Coca 540d13cf52 Merge pull request #9404 from mmoya/configure-retry-files
Configure retry file usage and location
2015-01-30 15:14:27 -05:00
Brian Coca c73254543a made env var also consistent 2015-01-29 13:32:00 -05:00
Brian Coca 4fd760467b made inventory consistent in config file, deprecated old config hostfile 2015-01-29 13:28:33 -05:00
Brian Coca 78e1a7ed93 Revert "Fix: Add support for SSL protocol version configuration option" 2015-01-19 08:36:17 -05:00
Jason Holland eedc51f213 Add support for SSL protocol version configuration option. Also fix 2 places where the SSL version was not being set properly. 2014-12-13 21:20:33 -06:00
Michael Scherer 7bffc1a29e add a default path in ~/.ansible to place plugins, so ansible is a bit
more usable out of the box as simple user
2014-12-11 23:33:51 +01:00
Maykel Moya c15b47fb7b Configure retry file usage and location
Adds new settings for managing retry files:
* retry_files_enabled, defaults to True
* retry_files_save_path, defaults to ~/.ansible-retry

This change was adapted from PR #5515.
2014-10-23 00:38:30 +02:00
Michael DeHaan e5116d2f9b changes for package loading of modules 2014-09-26 11:25:56 -04:00
Michael DeHaan 2064d26085 Add documentation about bin_ansible_callbacks setting. Standardization and cleanup. 2014-09-10 09:38:24 -04:00
Bruno BAILLUET 16108e4a99 Adding a new 'load_callback_plugins' config option, defaults to False
This option, when set to True, allows "ansible" command to load callback plugins
2014-09-06 16:41:16 +02:00
Dionysis Grigoropoulos f948b4f293 Handle exceptions during config file parsing
Handle uncaught exceptions during config file parsing
2014-08-29 17:55:42 +03:00
Michael DeHaan a419ffdf41 Make command warnings off by default to minimize surprises. 2014-08-22 16:12:48 -04:00
Will Thames ab8490d003 Added warnings to command module
Generate warnings when users are shelling out to commands
rather than using modules

Can be turned off on a per-action line with the documented
warn=False flag. Can be turned off globally using
command_warnings = False in ansible config file.

Print out warnings using the standard playbook callbacks.

Created some additional tests in TestRunner.test_command
and also a demonstration playbook.
2014-08-22 15:37:07 -04:00
Michael DeHaan 3035f2dcc8 Merge pull request #8367 from msabramo/make_pip_install_editable_work
Make `pip install -e` work
2014-08-15 07:46:54 -04:00
Michael DeHaan 02b0e102e6 Rename some INI keys for fact caching defaults 2014-08-11 15:16:51 -04:00
Michael DeHaan 542aaa6ffe Use JSON instead of pickles for compatibility. 2014-08-11 12:23:05 -04:00
Michael DeHaan 2629cd3fce Fix some copyrights, fix a misc test. 2014-08-11 12:23:05 -04:00
Josh Drake aa419044c4 WIP on the re-implementation of fact caching and various backends. 2014-08-11 12:23:05 -04:00
Marc Abramowitz 44b9f5e752 Make `pip install -e` work
This allows `pip install -e` and `python setup.py develop` to work
without having to do the stuff in
http://docs.ansible.com/intro_installation.html#running-from-source so
it's a tad nicer for Python programmers who are accustomed to installing
packages as editable/in development mode.

Fixes GH-8355 (https://github.com/ansible/ansible/issues/8355)
2014-07-30 13:35:11 -07:00
Veeti Paananen 5780f3a8b4 Expand variables in configuration files, take two
e.g. $HOME.
2014-07-29 15:20:59 +03:00
Veeti Paananen e6bd049892 Don't expand remote_tmp path locally 2014-07-29 15:19:54 +03:00
Michael DeHaan 106f4ccc01 Revert "Expand variables in configuration files" - I feel I've been here before.
Breaks some test runs.

This reverts commit a9eef029b6.
2014-07-28 17:10:42 -04:00
Veeti Paananen a9eef029b6 Expand variables in configuration files
e.g. $HOME. Fixes #6373.
2014-07-28 17:36:14 +03:00
James Cammarata 4fc8d4b6fe Merge pull request #7649 from sivel/vault-password-script
Allow --vault-password-file to work with a script as well as a flat file
2014-07-14 10:57:16 -05:00
James Cammarata 5429b85b9f Change safe_eval to a strict white list 2014-06-25 14:00:21 -05:00
Matt Martz 19f5ce2c9c Allow --vault-password-file to work with a script as well as a flat file 2014-06-24 15:02:24 -05:00
Chris Hoffman cf997beb07 Shell expand DEFAULT_ROLES_PATH fixes #4897 2014-06-20 19:23:46 -04:00
James Cammarata 6069ff6e9e Adding a new system_warnings config option to supress warnings 2014-04-30 14:44:10 -05:00
James Cammarata c115c34a1f Set the default LANG to en_US.UTF-8 and also set LC_CTYPE
Fixes #6737
2014-04-22 00:48:32 -05:00
James Cammarata 31628d86a1 Adding in a configurable option for the accelerate daemon timeout
This was apparently an oversite, as it has never been configurable
despite having a module parameter for the timeout.
2014-03-23 14:45:49 -05:00
James Cammarata 3ea5d573aa Acclerate improvements
* Added capability to support multiple keys, so clients from different
  machines can connect to a single daemon instance
* Any activity on the daemon will cause the timeout to extend, so that the
  daemon must be idle for the full number of minutes before it will auto-
  shutdown
* Various other small fixes to remove some redundancy

Fixes #5171
2014-03-23 14:45:49 -05:00
Michael DeHaan e639b5382b Change default gathering policy, add to docs. 2014-03-19 18:03:03 -04:00
Brian Coca 4dfa40f18e added gathering control to ansible, defaults to 'smart' 2014-03-19 18:03:03 -04:00
Michael DeHaan fe696e4720 Merge commit. 2014-03-16 17:08:26 -04:00
James Cammarata 9730157525 Validate SSL certs accessed through urllib*
* Adds another module utility file which generalizes the
  access of urls via the urllib* libraries.
* Adds a new spec generator for common arguments.
* Makes the user-agent string configurable.

Fixes #6211
2014-03-10 16:06:52 -05:00
Michael DeHaan a4d01b0891 Also search .json filenames 2014-03-06 21:47:49 -05:00
Michael DeHaan 16d3be03af Remove a few extra legacy variable feature references. 2014-02-28 18:51:15 -05:00
Michael DeHaan 5443ddec75 Trim references to fireball as we want folks using accelerate or pipelining options. Fireball is pretty well deprecated at this point, but will still be part of the release. 2014-02-28 13:50:39 -05:00
James Tanner 427b8dc78d Ansible vault: a framework for encrypting any playbook or var file. 2014-02-18 15:35:12 -05:00
James Cammarata 92cbfff904 Merge branch 'sshdefault' of https://github.com/craigtracey/ansible into craigtracey-sshdefault 2014-02-18 09:44:19 -06:00
Richard C Isaacson 80ddd1ca75 Config resoution order correction and documentation. 2014-02-14 14:34:58 -06:00
xyrix 1de45bf687 made accelerate keys directory configurable, and permissions for the file and dir configurable, and gave them a safe default 2014-02-06 08:53:43 +00:00
Craig Tracey 8c6b3baf6f Make default ANSIBLE_REMOTE_PORT None
The ansible remote port should be None, not 22. Having a default value
of 22 means that '-o Port 22' will be appended to the ssh connection
all of the time. This is incorrect as when one would like to use
something like an ssh configuration file (-F) that sets the port to
something other than 22.

Part of this change requires that we check that, in get_config, the
value is not None before trying to cast it into an integer or float.
2014-01-23 12:49:07 -05:00
jeromew 3f23483022 Bug in constants.py, ANSIBLE_SSH_PIPELINING should be coerced to boolean 2014-01-22 13:54:28 +00:00
Paul Durivage f72f5a20df Revert "Revert "Merge pull request #5325 from angstwad/add-su-support""
This reverts commit c17d0e0357.

Conflicts:
	lib/ansible/runner/connection_plugins/paramiko_ssh.py
2014-01-20 19:19:03 -06:00
James Tanner c17d0e0357 Revert "Merge pull request #5325 from angstwad/add-su-support"
This reverts commit 6f4bfa2cff, reversing
changes made to c91ba3a7c7.
2014-01-20 16:10:11 -05:00
Paul Durivage 4088243deb Proposing fix for Issue #4324; adding support for su in connection plugins ssh, ssh_alt
Fixes for ssh_alt support, adding in references to in_data where appropriate
2014-01-20 11:25:10 -06:00
James Cammarata 02ce5af6df Added ANSIBLE_SSH_PIPELINING option to enable/disable pipelining support
Pipelining will be disabled by default, since it requires users remove
the 'requiretty' option from the servers sudoers configuration.
2014-01-16 12:41:33 -06:00
Michael DeHaan 10350d1639 Update various copyrights. Not complete, but sufficient. 2014-01-04 13:32:04 -05:00
Michael DeHaan 5b3c796641 Update constants.py
Lookup plugins for optional web services do not warrant advertising in ansible.cfg.
2013-12-21 08:46:11 -05:00
James Tanner 5d022182fe Fixes #5341 Use constants.py to set the roles directory 2013-12-18 22:40:58 -05:00
James Tanner f3a4705a9c Revert "Merge pull request #4874 from leth/editable_install"
This reverts commit 15b89b45e1, reversing
changes made to 3d836a1ab7.
2013-12-16 15:57:03 -05:00
jctanner 15b89b45e1 Merge pull request #4874 from leth/editable_install
Fix setup.py to work with 'pip install -e .'
2013-12-16 11:22:45 -08:00
Ferenc Grecu 56642f9b04 Remove unused parameter from _get_config 2013-12-12 18:48:02 +02:00
jctanner 0f0a89b34e Merge pull request #4758 from alanfairless/group-host-var-dirs
Support organizing group and host variables across multiple files in a directory
2013-11-14 11:57:11 -08:00
James Tanner f31cb7c6e8 Merge pull request #4664 from jpmens/ansible
Lookup plugin for etcd

with support for configurable etcd URL in ansible.cfg (and environment)
2013-11-12 15:29:05 -05:00
Marcus Cobden 8d98a55df1 Fix setup.py to work with 'pip install -e .' 2013-11-11 14:00:38 +00:00
Alan Fairless 0824f004d9 Revised patch for more password entropy 2013-11-01 09:51:35 -05:00
Alan Fairless babde9a84c refactor to catch edge cases, remove repeated code
- Move all the supported YAML file extensions into a constant
- Use helper functions to avoid duplicate code for group/host vars
- Catch and disallow some confusing situations, such as the presence of
  multiple group/host vars files for the same group/host, but with
  different extensions.  For example having both group_vars/all.yml and
  group_vars/all.yaml.
- Catch and report file system permission issues, symlink errors,
  unexpected file system objects
- Trivial performance improvement from making fewer stat system calls
- Restructuring that makes it easy for a following patch to support
  directory recursion
2013-10-31 12:18:17 -05:00
Jan-Piet Mens bd5cd8e652 Lookup plugin for etcd
with support for configurable etcd URL in ansible.cfg (and environment)
2013-10-24 21:28:48 +02:00
Thomas Omans 632232259a Adding config flag role_path for common/global roles
Using ANSIBLE_ROLE_PATH environment variable or role_path in ansible.cfg
can configure paths where roles will be searched for
extra paths will only be used as a backup once regular locations are exhausted
2013-10-12 10:15:30 -04:00
Michael DeHaan 9637f620d7 Deprecation warnings of several flavors, nice and purple and can be disabled
in ansible.cfg.
2013-10-11 18:37:39 -04:00
James Cammarata d73a5da9e5 Merge pull request #4453 from pschwartz/fix_cfg_load_order_to_match_docs
GH-4452 Corrected config load order to match docs
2013-10-11 07:25:05 -07:00
Philip Schwartz 65c8c691f7 GH-4452 Corrected config load order to match docs with
cwd > ~ > /etc

Signed-off-by: Philip Schwartz <philip.schwartz@rackspace.com>
2013-10-11 08:33:54 -05:00
Michael DeHaan 65178290e7 Merge branch 'devel' of git://github.com/nextus/ansible into devel
Conflicts:
	lib/ansible/constants.py
2013-10-07 08:39:23 -04:00
James Cammarata 912e3a7b0b Merge branch 'accelerate_improvements' into devel
Conflicts:
	library/utilities/accelerate
2013-10-01 21:22:17 -05:00
James Cammarata 8923a5b0d9 Drop default config value for accelerate timeout to 30 seconds 2013-10-01 16:10:48 -05:00
James Cammarata d317103371 Added in an accelerate connection timeout setting 2013-10-01 15:28:59 -05:00
James Cammarata 59a5ce23d9 Adding an accelerate_timeout parameter for plays
This setting makes the timeout for each play configurable, rather than
hard-coding it at 300 seconds (now the default if left unspecified)

Fixes #4162
2013-10-01 15:26:50 -05:00
James Cammarata 6cd8aacc81 Merge branch 'hide_skipped_hosts' of https://github.com/jsmartin/ansible into jsmartin-hide_skipped_hosts 2013-09-30 20:22:53 -05:00
Brian Harring d0ad6c581b For defaults that are integers, enforce it for config supplied values.
If a user supplies a string in the config (rather than an int), the code
should fix that- or blow up immediately- rather than allowing that value to
work it's way down and break w/in the connection object; when that happens,
the actual error is opaque and requires pdb.set_trace() to run down.
2013-09-29 23:56:41 -04:00
James Martin d5f20e6b21 Optionally display Skipping [host] messages. 2013-09-26 10:03:23 -04:00
nextus ca96d74572 #4227 in upstream repo 2013-09-25 16:15:49 +04:00
James Cammarata 503f062521 Merge branch 'ferringb-fixes/configurable-ControlPath' into devel 2013-09-18 21:12:15 -05:00
Brian Harring 5b1b831cc7 Make ssh's ControlPath configurable via ansible.cfg
This shouldn't generally be needed unless you're working in an environment
that uses rediculously long FQDNs; if the name is too long, you wind up
hitting unix domain socket filepath limits enforced by ssh.
2013-09-18 15:07:07 -04:00
Skylar Saveland 50bd14faa9 use DEFAULT_MODULE_PATH in setup.py so that there is a chance to override with ANSIBLE_LIBRARY env variable 2013-09-16 19:08:22 -07:00
Skylar Saveland 8dc31f3093 ANSIBLE_DIST_MODULE_PATH environment variable 2013-09-16 13:43:20 -07:00
James Cammarata 959138d00d Added accelerate_port to plays, and made it configurable 2013-08-28 11:14:58 -05:00
James Cammarata acc5d09351 Initial commit for the "fireball2" connection plugin
Still needs:
* chunked file transfer/receive
* should probably move all send/recv operations to separate
  functions to reduce code duplication
* initial connection setup over ssh? or do we handle that in runner?
2013-08-28 11:14:58 -05:00
James Cammarata ad595eadea Enable error_on_undefined_vars by default 2013-08-15 09:28:34 -05:00
Michael DeHaan baffa8df72 These fields are booleans. 2013-08-10 18:16:01 -04:00
Abhijit Menon-Sen 0c96d8af6e Add a nocolor setting to ansible.cfg 2013-08-08 21:37:33 +05:30
Brian Coca 18cb155bd5 now ANSIBLE_KEEP_REMOTE_FILE acts as boolean
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
2013-07-14 22:08:36 -04:00
Michael DeHaan fba1f7ef42 Revert "expand vars like $HOME used in config values too" -- breaks remote_tmp if set.
This reverts commit e5ff35bbdb.
2013-07-11 17:27:17 -04:00
Andreas Piesk e5ff35bbdb expand vars like $HOME used in config values too 2013-07-09 20:33:33 +02:00
Michael DeHaan cf6e1f8db9 Make it possible to tell paramiko to not record new host keys, which can be slow with a large number of hosts.
-c ssh is preferred in most cases if you have ControlPersist available, otherwise if you are comfortable you
can turn off recording while leaving host key checking on, etc.
2013-07-05 22:06:54 -04:00
Ton Kersten 37ee361be1 Repair issue #3447 2013-07-05 19:10:36 +02: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 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
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
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 f4cf93436767f73b62a16067ab5e628830045896
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 253144045cbafd7d72836f1017c62ac4ba623186
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 aecb71d8b75257f0f3e11a9b176fc3737aecef8d
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 cbb1808f0585f01536240aee05a1bfd06c4b4647
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 d4bbf492b0b63c789d66ab60d0ec634d100fca82
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 c94780280515f1f3756fdc429b2b1e87b365e9b7
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 8d919d6c97b28a42f47ca7248c542695baf6175f
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 0f68ad8193ac17488e339a258f8c63fdae399c26
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
Michael DeHaan a78edbb45c More pep8 2013-05-11 17:26:06 -04:00
Matt Coddington 542eeeb5d6 add option to ignore $legacy variable style substitution 2013-05-11 14:06:01 -04:00
Michael DeHaan b8fdcff524 Merge branch 'nocows' of git://github.com/jpmens/ansible into devel
Conflicts:
	lib/ansible/callbacks.py
	lib/ansible/constants.py
2013-04-27 11:34:39 -04:00
Michael DeHaan aa55268514 Adds a logfile for ansible playbooks that can be set by the environment or configuration file. 2013-04-27 10:24:26 -04:00
Jan-Piet Mens dfd885a012 Make ANSIBLE_NOCOWS configurable
nocows = 1 in ansible.cfg
	or old environment variable ANSIBLE_NOCOWS=1
add to ansible.cfg example
2013-04-23 16:43:23 +02:00
willthames e55e123c01 Added DEFAULT_EXECUTABLE as a constant
Use DEFAULT_EXECUTABLE when no executable is passed to
_low_level_command_exec

Works as a standard constant - can be overridden in all the normal ways
and defaults to /bin/sh

Motiviation is for a user that only has /bin/bash in /etc/sudoers
2013-04-04 13:32:23 +10:00
Michel Blanc 0cd0a7fda3 Fixes jina typos
Moved *jina* to *jinja2*
2013-02-16 13:32:48 -05:00
Michel Blanc 1c22f2146e Adds configurable jinja2 extension loading
Jinja extensions adds features to the jinja2 templating engine. This
patch allows module loading for the templating engine vian an
ansible.cfg configuration key (jinja_extensions).
The default behaviour doesn't change (no module loading).
Requested modules can be added coma separated in ansible.cfg

Adds whitespace handling in jinja_extension config

Added whitespace handling in jinja_extension configuration directive, so
things stay safe if user adds spaces around comas in the directives
list.

Adds config example for jinja_extensions

Added config example with multiple extentions for jinja_extensions
2013-02-16 13:32:48 -05:00
Daniel Hokka Zakrisson 5268d49bad Add sudo_flags configuration option to alter sudo behaviour
Default to -H to set $HOME appropriately.
2013-01-28 17:41:43 +01:00
fdavis 925c1a4611 add env vars for plugins action,callback,connection,lookup,vars,filter 2013-01-26 09:25:35 -08:00
Michel Blanc e28e538c6e Adds user-selectable hash merging support in vars
Hash variables are currently overriden if they are redefined. This
doesn't let the user refine hash entries or overriding selected keys,
which can, for some, be a desirable feature.
This patch let the user force hash merging by setting the
hash_behaviour value to "merge" (without the quotes) in ansible.cfg

However, by default, ansible behaves like it always did and if any value
besides "merge" is used ("replace" is suggested in the example ansible.cfg
file), it will also behave as always.
2013-01-23 21:39:34 +01:00
ron1 280660b8a7 Support sudo alternatives that offer sudo-compatible interfaces 2013-01-19 08:40:32 -05:00
Stephen Fromm 6a68d3813f Set LANG in module_common.py
Add constant DEFAULT_MODULE_LANG that defaults to C.  Can be set via
environment variable ANSIBLE_MODULE_LANG or configuration variable
module_lang.  Updated test-module to have same behavior.
2012-11-27 00:16:06 -08:00
Daniel Hokka Zakrisson 5183417de8 Reinstate ANSIBLE_KEEP_REMOTE_FILES
Fixes #1395.
2012-11-18 18:32:45 +01:00
Daniel Hokka Zakrisson c906f44d90 Use the ssh_connection section for scp_if_ssh 2012-11-16 23:45:47 +01:00
Stephen Fromm 06e54c0b97 Add ability to specify syslog facility for modules
Update constants.py so that one can specify environmental variable
ANSIBLE_SYSLOG_FACILITY or syslog_facility in ansible.cfg to define
the syslog facility to use.  Alternatively, you can specify
ansible_syslog_facility in inventory.  Runner now replaces
the syslog facility in the openlog() call with the default or
the injected variables ansible_syslog_facility.

This also updates hacking/test-module to behave similarly.
2012-11-11 00:14:08 -08:00
Michael DeHaan 3dc31a049f Merge pull request #1527 from fdavis/devel
Support scp in an ssh connection
2012-11-08 16:42:37 -08:00
fdavis b1dbeec66c Allows use of scp instead of sftp in
Added a boolean constant scp_if_ssh to the config
Added scp support for the ssh connection plugin
Refers to #1279
2012-11-05 14:25:40 -08:00
Jeroen Hoekx 8ffed6df75 Support custom jinja2 filters.
This uses the plugin framework to add filter plugins.
The previously hardcoded core filters are defined using the plugin
framework now.
2012-11-05 15:11:34 +01:00
Michael DeHaan 6f938c9f4c Merge branch 'playbook_ssh_ask_pass' of git://github.com/clatour/ansible into devel
Conflicts:
	examples/ansible.cfg

+ doc tweak
2012-11-03 19:23:38 -04:00
Michael DeHaan 908c43ad7f Merge branch 'devel' of git://github.com/skorokithakis/ansible into devel 2012-11-03 19:19:59 -04:00
Chandler Latour f436a8c88b Added config option for default ask for ssh_pass 2012-11-02 10:53:26 -05:00
Stavros Korokithakis 3616dffb68 Detect whether we're running in a virtualenv. 2012-11-02 01:42:04 +02:00
Stavros Korokithakis d9a377cbb1 Fix installing to virtualenvs. 2012-11-01 20:40:28 +02:00
Brian Coca 604bf9f58a Added config option to control default of asking or not for sudo password
Signed-off-by: Brian Coca <briancoca+ansible@gmail.com>
2012-10-30 23:36:07 -04:00
Michael DeHaan be300b562a pyflakes fixes (mostly unused imports, unused vars) 2012-10-30 20:47:05 -04:00
Michael DeHaan 6ba30170dd Make group_vars and host_vars available to usr/bin/ansible, and make vars_plugins exist 2012-10-26 19:55:59 -04:00
Michael DeHaan d509dfc969 delete extra else clause 2012-10-18 20:27:39 -04:00
willthames 5a769a5a4d Fixed tests to reflect desired configuration behaviour
Test for when environment variable and configuration file
variable both set now tests that the environment variable takes
precedence

Removed logic that would never be triggered from
lib/ansible/constants.py
2012-10-18 12:53:30 +10:00
Michael DeHaan fd6a26239c Env var vs config priority fixing 2012-10-17 22:34:59 -04:00
Michael DeHaan 63100c9bc0 Docs + fix variable precedence of environment variables (ok, ok, I give in!) 2012-10-16 18:40:01 -04:00
Daniel Hokka Zakrisson ab44a4abba Load additional plugins from path specified in configuration 2012-10-14 21:09:24 +02:00
Tim Bielawa baa91ebc95 Add DIST_MODULE_PATH so setup.py and ansible.spec can live in harmony. Closes #1277 2012-10-11 13:22:30 -04:00
Jan-Piet Mens 9ed59da294 Allow user-specified $ansible_managed string with named parameters 2012-10-04 08:50:51 +02:00
Lorin Hochstein aa5ef9561d ANSIBLE_CONFIG take precedence over ./ansible.cfg 2012-09-29 10:44:14 -04:00
Michael DeHaan 69612ba16d The very first start of 'fireball mode', which uses ansible in SSH mode to deploy a ephemeral zeromq daemon (entirely optional) that is will die after
it is no longer used.  No key signing will be required.  At this point, development use only -- NOT complete.
2012-09-26 23:51:59 -04:00
Marco Vito Moscaritolo 0cdd081b53 Add support for ./ansible.cfg file
Ansible support configuration in:
```
~/.ansible.cfg
/etc/ansible/ansible.cfg
```

this patch add current user (usefull where user have some different projects) with the oreder:
```
./ansible.cfg
~/.ansible.cfg
/etc/ansible/ansible.cfg
```
2012-09-10 17:57:32 +03:00
Michael DeHaan 7fd4051857 make connection types pluggable 2012-08-18 10:52:24 -04:00
Michael DeHaan 9851066f4d Adding ability to set ssh args from config file 2012-08-14 20:13:02 -04:00
willthames c01040ca72 Further fixes for constants following config introduction
Added an ANSIBLE_CONFIG variable to poteentially override
~/.ansible.cfg
Used os.path.expanduser against all paths that might be read in to allow
~ to be used in config files. I'd have preferred it if os.path.expanduser
took None as an argument but it doesn't.

If remote_port *is* set in the ansible config file, then it will be
interpreted as a string (at which point ssh.connect fails with an
obscure message). Most other numeric variables are handled by
the OptionsParser which takes a type variable when setting up the option -
but remote_port is not an option, so never cast to int.

It might be worth adding a type field to get_config that defaults to a string.
That could be e.g. file or int, which then casts it correctly.
2012-08-14 20:22:47 +10:00
Michael DeHaan 7ab0d60b1a update config code 2012-08-13 20:17:07 -04:00
Michael DeHaan 62fbbf7653 config file support 2012-08-13 19:17:59 -04:00
Michael DeHaan deec50fc3c Default -u (user) and "user:" in playbooks to the current user. 2012-08-11 17:33:34 -04:00
Michael DeHaan 1c81ddf8d4 add the limit option, which can be used to further confine the patterns selected by "hosts:" in ansible-playbooks
to an additional pattern (a subset) specified on the command line.  For instance, a playbook could be reusable
and target "webservers" and "dbservers", but you want to test only in the stage environment, or a few boxes at a time.
2012-08-10 02:45:29 -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
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
Dave Hatton d28bbe14ed shouldn't need a (slash) before /home/daveh 2012-06-21 15:37:43 +01:00
Daniel Hokka Zakrisson ab08fea1aa Add an ssh command wrapper transport 2012-06-17 20:34:17 +02: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
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
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
Jim Richardson 93a20a33e9 first bit of getting sudo -u functionality 2012-05-06 18:24:44 -04:00
Michael DeHaan f2465e0571 Add support for specifying sudo passwords to both ansible & playbook. Nopasswd sudo is no longer required. 2012-04-13 19:06:11 -04:00
Stephen Fromm 896f8de446 Add DEFAULT_TRANSPORT and DEFAULT_TRANSPORT_OPTS constants
DEFAULT_TRANSPORT is set to paramiko.  DEFAULT_TRANSPORT_OPTS is a list
of possible transport options; it is set to local and paramiko.
2012-04-10 16:09:20 -07:00
Christopher Johnston f06ec76fdb add support for using an alternate remote port 2012-03-28 14:05:31 -07: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
Tim Bielawa f2c2786a14 Update constants.py to pull module path and the hosts file from the
environment (ANSIBLE_{LIBRARY,HOSTS}) if defined.

Update manpages to represent this.

Also update the env-setup script to set ANSIBLE_{LIBRARY,HOSTS}.
2012-03-05 16:08:36 -05:00
Michael DeHaan 8d06c074b1 * Added uptime.py as an example of somewhat minimal API usage & reporting
* Pattern in API now has a default
* Fixed bug in template module operation detected from running playbook (tests for that pending)
* Workaround for multiprocessing lib being harmlessly squeaky (feeder thread got sentinel)
2012-04-04 10:27:24 -04:00
Michael DeHaan 687a315a80 Increasing default --forks to 5 2012-03-01 22:19:41 -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 bed29b7e11 Allow the /etc/ansible/hosts file to contain groups and those group names to be used in place
of pattern names.
2012-03-01 20:41:17 -05:00