Commit graph

2489 commits

Author SHA1 Message Date
James Cammarata
a72dc2ec34 Use finalize method in jinja2 to convert None values to empty strings
Fixes #4812
2014-02-06 00:43:31 -06:00
Will Thames
7600c664fe Create a common EC2 connection argument spec for EC2 modules
Refactor the currently well-factored ec2 modules (i.e. those that already use ec2_connect) to
have a common argument spec. The idea is that new modules can use this spec without duplication
of code, and that new functionality can be added to the ec2 connection code (e.g. security
token argument)
2014-02-06 15:27:41 +10:00
jctanner
28933de84d Merge pull request #5771 from bcoca/play_hosts2
added new play_hosts var
2014-02-05 23:52:20 -05:00
James Cammarata
959a156195 Properly count newlines appearing at the end of templates after rendering
Fixes #4633
2014-02-05 15:14:19 -06:00
James Cammarata
ca0ec800d8 Revising method for parsing ranges from --limit subsets
Also added a new test (test_subset_range) for future validation.

Fixes #4620
2014-02-05 13:58:03 -06:00
Richard C Isaacson
ac0a5c8ad5 Dug into the remaining FIXME and replaced with comments to document the expected behavior. 2014-02-05 11:39:22 -06:00
Luca Berruti
75b7a1d9c7 Fix slow ssh
We break the read while loop after waiting "the end of the process" and
the pipes are empty, otherwise we do another select that waits all the
timeout.
2014-02-05 09:45:03 +01:00
jctanner
a0f91f2aaa Merge pull request #5576 from xyrix/symlink-bug-fix
fixed bug causing symlinks to fail in the host_vars, group_vars etc dire...
2014-02-04 11:39:54 -08:00
jctanner
253fe7be50 Merge pull request #5662 from RSpiertz/update_playbook_error
PlayBook: better error message
2014-02-04 11:16:44 -08:00
Richard C Isaacson
a3261500dd Addresses #5739 and cleans up copy.py
The copy action_plugin is not easy to read. Part of this commit is taking that file, restructuring it, and adding comments. No functionality changed in how it interacts with the world.

The fix for #5739 ends up being the assumption that there is a cleanup 'rm -rf' that happens at the end of the copy loop. This was not the fact before and we made a bunch of tmp directories that we hoped would end up being cleaned up. Now we just use the tmp directory that the runner provides and cleanup inline if it is a single file to be coppied or after the loop if it is a recursive copy.

As a part of this we did end up having to change runner to provide a flag so that we could short the inline tmp directory removal. This flag defaults to True so it will not change the behavior of other modules that are being called.
2014-02-04 12:44:10 -06:00
James Tanner
5fafc61008 Fixes 5870 Template delegate hostname earlier in the process 2014-02-04 13:31:22 -05:00
James Tanner
d355d3c698 Fixes #5818 Default to all known connection information for the delegate host 2014-02-03 16:59:30 -05:00
Timur Batyrshin
658c15930e reword "except Error as e:" into "except Error, e:" to be compatible with Python 2.5 (#5852) 2014-02-03 13:00:40 -06:00
James Cammarata
2d0e9cd75d Revert "Fix for issue 5739. The copy module does not delete directories it will only unlinks symlinks."
This reverts commit b20dc4f578.
2014-02-03 12:54:52 -06:00
James Cammarata
ae9843fccd Fix issue with handler notifications being sent out incorrectly
This is a partial revert of e8ad36c, which introduced the bug.

Fixes #5848
2014-02-03 10:10:45 -06:00
James Cammarata
9ff99acaff Merge branch 'issue5739_3' of https://github.com/risaacson/ansible into risaacson-issue5739_3 2014-02-03 09:52:50 -06:00
Brian Coca
ff024b65b2 now with_items also accepts sets
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
2014-02-01 17:55:38 -05:00
Richard C Isaacson
b20dc4f578 Fix for issue 5739. The copy module does not delete directories it will only unlinks symlinks. 2014-01-31 17:19:44 -06:00
James Cammarata
75e3b59bbd Adding no_log: capability for tasks
Fixes #4088
2014-01-31 16:58:46 -06:00
James Tanner
e6aeb191d5 Revert "Merge branch 'slow_ssh' of git://github.com/lberruti/ansible into lberruti-slow_ssh"
This reverts commit fe091ec00d, reversing
changes made to aed2194b1d.
2014-01-30 16:02:05 -05:00
James Cammarata
9574f89471 Detect remote_user change in accelerate daemon and allow a restart
Fixes #5812
2014-01-30 14:40:41 -06:00
jctanner
6c25ea1b91 Merge pull request #5527 from sergevanginderachter/basedirdwim
path_dwim: fix when basedir not set
2014-01-30 10:54:19 -08:00
James Cammarata
f955d9db6a Handle implicit localhost when using '-i host,' syntax
Fixes #5820
2014-01-30 12:46:02 -06:00
jctanner
360f06b41d Merge pull request #5806 from sivel/rax-mod-utils-improvements
Rax mod utils improvements
2014-01-29 16:17:06 -08:00
James Cammarata
5cc354696d Build variable dictionary on included plays without using dict()
Using dict(k=v) means the key was always named 'k', as the variable
is not interpreted there.

Fixes #5801
2014-01-29 12:31:12 -06:00
Michael DeHaan
d07a3b5e9b AnsibleWorks -> Ansible 2014-01-28 20:29:42 -05:00
Heikki Hokkanen
b6875b3b87 Fix .ssh/known_hosts path expansion.
In particular, do not rely on the $USER environment variable always existing.
tmux for example seems to clear it, causing lots of invalid messages:
"previous known host file not found"

This broke in commit 80fd22dc, but instead of reverting that commit, we now
fall back to expanding just ~ when $USER is not set.
2014-01-28 15:11:44 -06:00
Matt Martz
ac666e63e0 Support providing a tenant_name also 2014-01-28 13:58:41 -06:00
Matt Martz
aa709012ba Make sure to also include the region when using keyring_auth 2014-01-28 13:58:41 -06:00
Matt Martz
021b926235 Only specify to USE_KEYRING as the api_key/password when we actually got a keyring_username from ~/.pyrax.cfg 2014-01-28 13:58:41 -06:00
Matt Martz
1ac7dffd55 Support using ~/.pyrax.cfg and multi environments 2014-01-28 13:58:41 -06:00
Matt Martz
139e905e98 identity_type is set dynamically above 2014-01-28 13:58:41 -06:00
Matt Martz
bc473c5be3 Support additional attributes that would allow the rax modules to work with other OpenStack clouds 2014-01-28 13:58:41 -06:00
Matt Martz
d7597414b8 Support keyring for the api_key 2014-01-28 13:58:40 -06:00
James Tanner
fe091ec00d Merge branch 'slow_ssh' of git://github.com/lberruti/ansible into lberruti-slow_ssh 2014-01-28 13:06:07 -05:00
Adam Heath
aed2194b1d self.su_user is done earlier in the code path, and is auto-vivified from
su_user_var.  My last PR was only half merged, and when the bug fix for
the su/su_pass typo was merged, the removed line in this commit was
mistakenly reintroduced.
2014-01-28 11:04:24 -06:00
James Tanner
3ec043ec17 Fixes #5750 Fail on missing ~/.ssh and ignore accept_hostkey if stricthoskeychecking is off 2014-01-28 11:49:35 -05:00
James Cammarata
88e2595a90 Fixing bug relating to su without an su_pass 2014-01-27 16:27:02 -06:00
Adam Heath
fac7c6d3fe Allow su_user to be templated, same as sudo_user. 2014-01-27 16:27:02 -06:00
James Cammarata
3fddd78ec5 Fixing traceback caused by incorrect argument passing to json.dumps
Fixes #5756
2014-01-27 11:28:07 -06:00
Brian Coca
59d5892fa3 added new play_hosts var
this variable has the 'current host list' to be executed over in the
play. Useful when using --limit to not iterate over hosts not included
in play in templates or with_items.

Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
2014-01-25 18:43:15 -05:00
jctanner
b2d594d24e Merge pull request #5724 from angstwad/su-tasks-fix
Fix bug where playbook tasks do not escalate privs with 'su'
2014-01-23 14:05:14 -08:00
jctanner
19e8742005 Merge pull request #5713 from angstwad/su-fix
Disallow su and sudo params in same play/task
2014-01-23 13:55:43 -08: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
Paul Durivage
e875089eba Fix bug where self.su was being set by the sudo param in play tasks 2014-01-22 11:04:19 -06:00
Paul Durivage
01d1bd61e7 Disallow su and sudo params in same play/task 2014-01-22 10:55:45 -06:00
James Cammarata
ff8eb5f454 Merge pull request #5722 from jeromew/pipelining_default
Bug in constants.py, ANSIBLE_SSH_PIPELINING should be coerced to boolean
2014-01-22 07:34:02 -08:00
jeromew
ef69d23715 Bug: chmod should be called only if the tmp dir was created in the first place 2014-01-22 14:04:39 +00:00
jeromew
3f23483022 Bug in constants.py, ANSIBLE_SSH_PIPELINING should be coerced to boolean 2014-01-22 13:54:28 +00:00
James Tanner
61d283e2ad Fix merge conflicts from #5519 2014-01-21 13:35:06 -05:00
jctanner
da136dbe7c Merge pull request #5694 from angstwad/add-su-support-revert
Add su support
2014-01-21 09:57:00 -08:00
Rob Smith
761fe8cc04 Fix an issue where git-pull fails with AttributeError
As part of 94f3b9bfab the code was changed to support dynamically adding localhost to the inventory. This change introduced an crash when run via ansible-pull

```
Starting ansible-pull at 2014-01-20 23:09:57
Traceback (most recent call last):
  File "/tmp/ansible/bin/ansible", line 157, in <module>
    (runner, results) = cli.run(options, args)
  File "/tmp/ansible/bin/ansible", line 82, in run
    hosts = inventory_manager.list_hosts(pattern)
  File "/tmp/ansible/lib/ansible/inventory/__init__.py", line 372, in list_hosts
    result = [ h.name for h in self.get_hosts(pattern) ]
  File "/tmp/ansible/lib/ansible/inventory/__init__.py", line 136, in get_hosts
    subset = self._get_hosts(self._subset)
  File "/tmp/ansible/lib/ansible/inventory/__init__.py", line 177, in _get_hosts
    that = self.__get_hosts(p)
  File "/tmp/ansible/lib/ansible/inventory/__init__.py", line 198, in __get_hosts
    hpat = self._hosts_in_unenumerated_pattern(name)
  File "/tmp/ansible/lib/ansible/inventory/__init__.py", line 275, in _hosts_in_unenumerated_pattern
    ungrouped.add_host(new_host)
AttributeError: 'NoneType' object has no attribute 'add_host'
```

The root cause is there is no group for the host to be added to. I fixed this case by creating the ungrouped group when it doesn't exist and then adding the host to the newly added group. This fixes the regression for me.
2014-01-20 20:10:47 -08:00
Rob Smith
953dc6b345 When not finding a host in ~/.ssh/known_hosts, the return value is 0 if the host just is not found. We then never check the system host file in /etc. This fixes the code to check /etc on any failure, not just a bad return code. 2014-01-20 18:56:39 -08: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
Paul Durivage
4c84ba74b0 Resolve su bug in paramiko libs 2014-01-20 19:16:37 -06:00
Jesse Keating
6013f0738e Store the list of hosts to run on in runner object
This reduces the number of times inventory.list_hosts is called, which
can be costly. When coming from a playbook that data is already known.
2014-01-20 16:22:28 -08:00
Jesse Keating
e8ad36c8d4 Store hosts for a play as a play attribute
Operate on that play attribute to make things faster for larger
inventories. Instead of making a round trip through inventory.list_hosts
and working through some lengthy list comprehensions over and over
again, calculate the potenital hosts for a play once, then reduce from
it the unavailable hosts when necessary.

Also moves how the %fail is done. The host count is a play level count
of available hosts, which then is compared after each task to the
current number of available hosts for the play. This used to get a new
count every task which was also time expensive.
2014-01-20 16:22:28 -08:00
James Tanner
94f3b9bfab Fixes #3129 Do not require localhost to be in inventory 2014-01-20 18:26:14 -05: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
8cf071f697 Hostvars support for su 2014-01-20 12:01:28 -06:00
Paul Durivage
dec9131735 Ensure playbook support for su params 2014-01-20 11:46:56 -06:00
Paul Durivage
d21281ff43 Resolve rebase conflicts 2014-01-20 11:46:05 -06:00
Paul Durivage
ab6ee1a282 Enable su support in paramkio; disable su support in fireball, local, accelerate, chroot, jail, funcd connection plugins 2014-01-20 11:25:10 -06: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
Michael Scherer
5c5c8fd7ce Make synchronize module work better with local transport, fix #5668 2014-01-17 17:32:36 +01:00
Rutger Spiertz
dec6345fe6 PlayBook: better error message
When a PlayBook has missing arguments the error message now shows which ones are missing.
2014-01-17 10:30:57 +01:00
James Tanner
559e89036b Fixes #5631 Return a unique list of hosts when joining groups 2014-01-16 14:24:11 -05: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
James Cammarata
233aae5861 Reverting paramiko_ssh/alt changes from yesterday 2014-01-16 09:45:28 -06:00
Matt Martz
d46037d64c Do not log the rax api_key argument in module invocation 2014-01-15 16:38:03 -06:00
James Cammarata
36e6709771 Don't use pipelining when ANSIBLE_KEEP_REMOTE_FILES is enabled 2014-01-15 16:03:18 -06:00
James Cammarata
df13b19fe1 Moving {ssh,paramiko}_alt connection types to be the defaults
The previous implementations will be kept for now as _old
2014-01-15 16:03:18 -06:00
James Cammarata
c27db84e41 Adding paramiko_alt - pipelining support for paramiko connections 2014-01-15 16:03:17 -06:00
jctanner
91c5c9da08 Merge pull request #5465 from deonbredenhann/false_mandatory_variable
Treat a False mandatory variable as defined.
2014-01-14 14:15:52 -08:00
jctanner
59d99c17b3 Merge pull request #5337 from bob-smith/bugfixFQDNParsing
Fix inventory parsing so that FQDN can be parsed without throwing ssh port error
2014-01-14 08:28:38 -08:00
jctanner
a6bc63512e Merge pull request #5308 from zecrazytux/fix/hash_merge_dynamic_inventory
Let merge hash_bahaviour work with dynamic inventory
2014-01-14 07:58:25 -08:00
jctanner
671b0454c6 Merge pull request #4987 from jpmens/lookup-csvfile
New lookup plugin csvreader
2014-01-14 07:17:52 -08:00
willthames
31f5ecea60 Allow float as an argument type in AnsibleModule 2014-01-13 14:15:23 +10:00
Rob Smith
c15cffabdd This fixes bugs added as a part of 8665b0638a
1. if accept_hostkey is false, no matter if the host key is known or not, it will fail.

2. We don't check for the host key in /etc/ssh/ssh_known_hosts

This fixes both of those issues.
2014-01-12 02:12:44 -08:00
James Tanner
3719f3f496 Do not fetch or add keys for http based git urls 2014-01-11 15:15:23 -05:00
James Tanner
eeee1e1c5a Set accept_hostkey to False by default in the git module and fail
early if the key is unknown
2014-01-11 11:02:01 -05:00
James Tanner
8665b0638a Add an "accept_hostkey" parameter to the git module to help automatically
accept hostkeys for git repos and prevent task hangs when the key is unknown
2014-01-11 10:36:45 -05:00
James Tanner
09e0d052ca Ensure sys.stdout has an istty method 2014-01-10 17:42:43 -05:00
James Tanner
d7c8cf6ca7 Fixes #4958 Truncate printed stdout if it contains non-printable characters 2014-01-10 15:08:45 -05:00
jay
e1f5b801cf fixed bug causing symlinks to fail in the host_vars, group_vars etc directories 2014-01-10 16:32:41 +00:00
James Tanner
78ec7c736f Fixes #3973 Second Revision of live ansible-pull output 2014-01-10 11:18:02 -05:00
Luca Berruti
ae543eecab Simplified p.poll handling 2014-01-10 11:34:21 +01:00
James Tanner
c408bcea31 Update sshpass hostkey error message 2014-01-08 17:25:50 -05:00
James Tanner
0b64408f5a Fixes #5531 Give the user a better error message when sshpass does not know the remote hostkey 2014-01-08 16:50:40 -05:00
jeromew
69febcefde remove useless create/delete remote tmp dir roundtrip in copy module 2014-01-08 15:22:12 +00:00
Serge van Ginderachter
836fb4143c path_dwim: fix when basedir not set 2014-01-08 02:21:10 +01:00
jeromew
c9b01febb3 Make sure 'tmp' is in the remote tmp dirname to ensure correct cleanup 2014-01-07 20:56:12 +00:00
jctanner
21b4212ff5 Merge pull request #5517 from lichesser/fix_set_depreciation_warning
Fixes #5513. set is built-in since 2.4 and deprecated since 2.6
2014-01-07 15:48:27 -05:00
jctanner
83dec044ab Merge pull request #5504 from smoothify/synchronize-sudo
Synchronize Module: Improved sudo override behaviour.
2014-01-06 14:52:59 -08:00
jctanner
9a69b1b0ec Merge pull request #5311 from willthames/ec2_refactor
ec2 modules: Move more responsibility to common EC2 module
2014-01-06 14:09:38 -08:00
James Tanner
d6b78e9dd6 Fixes #5238 Improve error messaging about unquoted variable references in playbooks 2014-01-06 16:47:19 -05:00
James Tanner
ab51bd23a2 Fixes #5196 return a unique list of hostnames for a single host pattern 2014-01-06 14:19:20 -05:00
smoothify
93a55e8dff Don't override sudo if transport is set to local.
https://github.com/ansible/ansible/pull/5251
2014-01-04 23:32:25 +00:00
Michael DeHaan
c039e276a2 Fact gathering on a second play against the same hosts should not be implicitly off since this is an undocumented beheavior and potentially
rather unwanted when a play could change a fact.

gather_facts: True/False can still be explicitly used per play.

Reverts 564a212b3c
2014-01-04 14:03:58 -05:00
Michael DeHaan
87258f6d42 Resolve merge commit 2014-01-04 14:03:42 -05:00
Michael DeHaan
1c632af2c9 Merge pull request #5468 from jeromew/ansible_ssh_alt
fix issue #5372 on ssh_alt: accept -K option for a user with NOPASSWD
2014-01-04 10:55:58 -08:00
Michael DeHaan
a3d90e8a87 Merge pull request #5498 from j2sol/exit_setup_early
Return early from setup step when possible
2014-01-04 10:47:35 -08:00
Michael DeHaan
227e8e31c9 Merge branch 'use_comps' of git://github.com/j2sol/ansible into devel 2014-01-04 13:36:40 -05:00
Michael DeHaan
10350d1639 Update various copyrights. Not complete, but sufficient. 2014-01-04 13:32:04 -05:00
Jesse Keating
23720ff19d Use list comprehensions for efficiency
For loops can be inefficient, particularly when doing a dot command with
them. https://wiki.python.org/moin/PythonSpeed/PerformanceTips#Loops and
https://wiki.python.org/moin/PythonSpeed/PerformanceTips#Avoiding_dots...

This patch makes use of list comprehensions to be as efficient as
possible while still retaining order. Efficiency was lost a bit when
switching away from sets() but this gains some of it back.
2014-01-03 18:07:00 -08:00
Jesse Keating
35328ed503 Return early from setup step when possible
The _list_available_hosts call can be lengthy, and in the case where
gather_facts is disabled the call is pointless. So re-arrange the logic
to return early from _do_setup_step when gather_facts is false.
2014-01-03 16:39:13 -08:00
Michael DeHaan
c41a23a35a Complete removal/refactoring of conditional deprecations. 2014-01-03 19:23:19 -05:00
Michael DeHaan
8e5b7d3095 Remove code underlying when_* and only_if, which are deprecated features slated for removal in the 1.5 release. 2014-01-03 19:13:21 -05:00
Michael DeHaan
28b9fd4e30 We have had only_if, when_foo, etc, deprecated for a while and said they would be removed in 1.5. Now they are, with friendly error messages still.
Users of these features should use "when:" as documented at docs.ansible.com.

Similarly, include + with_items has been removed.  The solution is to loop
inside the task files, see with_nested / with_together, etc.
2014-01-03 13:47:54 -05:00
James Tanner
21fdb2bbc7 Fixes #5200 Handle template contents with unicode strings better 2014-01-03 11:18:20 -05:00
James Tanner
fc473b3246 Fixes #5146 Handle missing stdin when running under celery with rabbitmq or redis 2014-01-03 09:46:16 -05:00
Michael DeHaan
de2ffc1276 Don't need to document these guys. 2014-01-02 17:55:59 -05:00
James Tanner
cb2214d6f8 Fixes #4935 Synchronize module: set destination to an fqdn if connection is not local, and abide by ansible_remote_user 2014-01-02 14:58:12 -05:00
jctanner
99560e3902 Merge pull request #5047 from sergevanginderachter/synch_template_ansiblesshhost
synchronize: allow ansible_ssh_host to be templated
2014-01-02 09:05:14 -08:00
jeromew
b2cd4a62de fix issue #5372 on ssh_alt: accept -K option even for a user with NOPASSWD 2013-12-31 14:29:46 -05:00
Deon Bredenhann
c85aac8b17 Treat a False mandatory variable as defined. 2013-12-31 13:41:40 +02:00
Deon Bredenhann
4f1f13b100 Remove trailing space 2013-12-31 13:40:21 +02:00
Levi Gross
dc6a26123b
Fixed syntax error and removed unused imports 2013-12-25 11:04:47 -05:00
Michael DeHaan
643690ffec Remove depedency of lookup plugin on setting in ansible.cfg 2013-12-21 08:49:08 -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
Stephen Fromm
833e1f6e2a Make sure action plugin copy cleans up tmp dir
The copy action plugin creates its own tmp dir for each file that it
copies to the target machine.  However, it does not clean up the
original tmp path it was given when run() is called.  This cleans up the
tmp path before it begins looping on source files.
2013-12-20 14:58:34 -08:00
James Tanner
993e0f057e Allow for no role dependencies in role metadata 2013-12-19 14:19:14 -05:00
James Tanner
1ef9930b80 Addresses #5341 Expand home directories when searching for roles in ansible-playbook 2013-12-18 23:31:03 -05:00
James Tanner
5d022182fe Fixes #5341 Use constants.py to set the roles directory 2013-12-18 22:40:58 -05:00
John Barker
4bf9f714d0 Fix inventory parsing so that FQDN can be parsed without throwing ssh
port parsing errors
Fixes problesm introduced by 948d019fef
Adds testcases to defend
2013-12-18 21:33:05 +00:00
jctanner
ea8cd62b19 Merge pull request #5259 from mvo5/bugfix/improve-error-on-invalid-vars-file
improve error on invalid vars file (if its a list instead of a dict)
2013-12-17 11:12:53 -08:00
jeromew
e4a3f49fa2 ssh_alt - only trigger 'fatal' when returncode == 255 (interpreted as 'could no connect') 2013-12-17 11:42:00 -05:00
willthames
12005a1cd0 Move more responsibility to common EC2 module
Moved `AWS_REGIONS` into `ec2` module
Created `ec2_connect` method in `ec2` module
Updated modules able to use `ec2_connect` and `AWS_REGIONS`
2013-12-17 14:07:24 +10:00
jctanner
cd3144af5d Merge pull request #5178 from cavassin/devel
Prevents UnicodeEncodeError
2013-12-16 13:23:16 -08: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
Sébastien Bocahu
c8d5846ab9 Let merge hash_bahaviour work with dynamic inventory 2013-12-16 19:55:20 +01:00
jctanner
3d836a1ab7 Merge pull request #5247 from jeromew/ansible_ssh_alt
ssh_alt.py / decrease # of ssh roundtrips
2013-12-16 07:08:35 -08:00
jeromew
5c965a75f0 ssh_alt.py / decrease # of ssh roundtrips 2013-12-13 14:23:40 -05:00
jctanner
1679d83637 Merge pull request #5131 from janeznemanic/devel
Fix for issue #4730 - stacktrace when deferenencing a non-existent group
2013-12-13 11:00:41 -08:00
jctanner
301a1189dd Merge pull request #5122 from willthames/openlog_str
Make first argument to syslog.openlog be a string
2013-12-13 08:51:48 -08:00
Ferenc Grecu
56642f9b04 Remove unused parameter from _get_config 2013-12-12 18:48:02 +02:00
Michael Vogt
bef5ee2c3b improve error on invalid vars file (if its a list instead of a dict) 2013-12-12 09:56:30 +01:00
Jesse Keating
8cef210aea Make sure ssh pipes are empty before moving on
Resolves issue #5082

Code as it was would hit a scenario where one of the FDs was not ready for
reading the first time through -- but p.poll() would show the process as
complete. This would cause ansible to continue on, while leaving some content
left in a pipe.

The other scenario -- the one that causes the unclosed quote, is if we go
through select.select() and we do get stdout in the ready for reading -- we
read from it (9000 bytes), but that's not all that is there. Again we'd get to
the p.poll() check and it would be indeed not none, but we would have left some
of stdout on the FD and thus the json blob would be malformed.

Tested with and without full ssh debugging.
Tested with and without ControlPersist
Tested with and without ControlPersist sockets already created
2013-12-11 21:32:37 -08:00
Michael DeHaan
929f8a5c93 Had to revert commits due to async. 2013-12-10 19:24:08 -05:00
Michael DeHaan
74e4ccb59b Revert "ssh_alt.py / decrease # of ssh roundtrips"
This reverts commit 7f8863f96d.
2013-12-10 19:23:52 -05:00
jeromew
7f8863f96d ssh_alt.py / decrease # of ssh roundtrips 2013-12-10 06:00:21 -05:00
jeromew
db182ba498 copy ssh.py to ssh_alt.py 2013-12-09 14:11:29 -05:00
Steve Smith
5b81f88c8f Cast the retrieved retries var to an int before incrementing as it may be in string form.
For example, the following method of calculating the value will result in a type error:

    appstatus_waitfor: 4  # Minutes
    appstatus_delay: 5 # seconds
    appstatus_retries: "{{ mins * 60 / delay }}"
2013-12-07 10:35:14 +01:00
Wanderlei Antonio Cavassin
6ba93817a9 Avoid UnicodeDecodeError exception when passing module args 2013-12-06 12:59:43 -02:00
James Tanner
bf78d8cf73 Addresses #5090 setup module was using path.is_file instead of path.isfile 2013-12-05 11:36:54 -05:00
cavassin
10f5af82f9 Prevent UnicodeEncodeError
Prevents UnicodeEncodeError: 'ascii' codec can't encode character, while printing shell commands output
2013-12-05 13:17:57 -02:00
jctanner
7aa35d64c2 Merge pull request #5091 from EspadaV8/5089_assemble_fix
#5089 hack-fix assemble module
2013-12-04 10:13:16 -08:00
Paul Bonser
58acd8cce1 If there is no tmp_src, don't modify the args 2013-12-03 18:59:50 -06:00
Paul Bonser
4afcd50487 properly convert arg into boolean 2013-12-03 18:46:37 -06:00
Michael DeHaan
801ca96a8b Merge pull request #5152 from sivel/too-many-ps
The word skipped only has 2 p's not 3
2013-12-03 16:21:11 -08:00
Matt Martz
5f0f3566a6 Skipped only has 2 p's not 3 2013-12-03 15:42:34 -06:00
Matt Martz
8873c3675b Ensure we are looking for the right import to determine if the module_style is new. Fixes #5148 2013-12-03 15:36:33 -06:00
jctanner
2670529671 Merge pull request #5090 from dragon3/hostname_support_amazon_linux
hostname module: add support for Amazon Linux
2013-12-03 12:34:55 -08:00
James Tanner
d227614529 Fixes #5109 synchronize module ssh port
Added a parameter for dest_port and also check ansible_ssh_port inventory variable.
2013-12-03 14:48:20 -05:00
Paul Bonser
5626efba7e Optionally unarchive a file already on the remote machine 2013-12-02 19:51:10 -06:00
jctanner
93159cb9cd Merge pull request #4996 from sivel/rax-module-utils
Implement ansible.module_utils.rax
2013-12-02 11:55:59 -08:00
Janez Nemanic
8752ae6909 Fix for issue #4730 - stacktrace when deferenencing a non-existent group 2013-12-02 18:25:43 +01:00
Will Thames
76aca4d547 Make first argument to syslog.openlog be a string
syslog.openlog expects its first argument to be a string.
Without this change running under ipython fails.
2013-12-02 19:11:27 +10:00
James Cammarata
9101c2af98 Fix traceback in template error detection code
Fixes #5081
2013-11-29 08:47:54 -06:00
Andrew Smith
eed32ea70c dest_contents isn’t always defined, so don’t pass it around
I think this is also a bit of a hack since it should probably be set
before being used, I’m just not sure what it should be set to.
2013-11-28 10:59:51 +10:00
Andrew Smith
e2d03173d2 The file module doesn’t have it’s module_args reset
I believe that this should be reset in the same way that the copy module
does
2013-11-28 10:58:14 +10:00
Andrew Smith
7b01c83159 Passing in complex_args throws ‘unsupported parameter for module’ errors
When using assemble only params (e.g. remote_src) the copy (and I’m
guessing file) modules throw an error that the param isn’t supported.
Simply removing the complex_args param fixes it for me, but I’m not sure
that’s the correct thing to do
2013-11-28 10:55:35 +10:00
Andrew Smith
da44a7f0cb I think that resultant is meant to be the contents of the combined file
It is used for the transfer and as a diff param but isn’t actually
defined anywhere before it’s used. This seemed like the least bad place
to set it.
2013-11-28 10:53:00 +10:00
Andrew Smith
4503413baa ReturnData is used throughout but not actually imported 2013-11-28 10:51:04 +10:00
dragon3
d39e6fda92 hostname module: add support for Amazon Linux 2013-11-28 09:31:25 +09:00
Andrew Smith
7d007cac16 Correct the invocation of ‘_assemble_from_fragments’ 2013-11-28 09:44:14 +10:00
jctanner
920bc6e75b Merge pull request #5086 from j2sol/fix-accelerate_inventory
Avoid a traceback when using accelerate
2013-11-27 14:46:12 -08:00
James Tanner
b6879ca2bd Fixes #5030 compare connection user and sudo user and disable sudo if identical 2013-11-27 17:01:53 -05:00
Jesse Keating
5522d489e3 Avoid a traceback when using accelerate
This bit of code is attempting to access accelerate_inventory_host,
which may not have been set/created. This will cause a traceback.
Instead use getattr with a fallback to False.
2013-11-27 13:58:11 -08:00
James Tanner
12ed39ef7b Fixes #5056 Append new hosts to the groups cache 2013-11-27 13:04:31 -05:00
James Cammarata
1f80aa768a Fix bug in error detection code, where a zero-length string was causing a traceback
Fixes #5064
2013-11-27 11:57:15 -06:00
Brian Coca
65885feeeb fixed typo for assemble function 2013-11-26 08:30:28 -05:00
James Tanner
b8146e3bc7 Fixes #4979 Check for the correct context when inside the inventory_hostnames plugin 2013-11-25 10:57:10 -05:00
James Tanner
903c4cae7b Fixes #5031 Template the delay value and cast to float for loops 2013-11-25 10:13:55 -05:00
Serge van Ginderachter
2f9470ec1d synchronize: allow ansible_ssh_host to be templated
This is already enabled in the runner also.
2013-11-25 15:33:04 +01:00
Antonio Zanardo
8dbd91b5ad fix typo in deprecation warning 2013-11-23 19:15:51 -02:00
James Tanner
bca2634d54 Fix missing eval for string search in ssh controlpersist 2013-11-22 12:22:53 -05:00
James Tanner
a16fe923ed Addresses #5011 check for proper string in smartos ssh error output 2013-11-22 12:13:24 -05:00
jctanner
5c84d7e445 Merge pull request #5002 from ovcharenko/devel
Allow to specify ansible_ssh_private_key_file location related to user home directory
2013-11-22 06:39:07 -08:00
James Tanner
512ebdb971 Revert "Merge pull request #5001 from ovcharenko/devel"
This reverts commit d6c3103a00, reversing
changes made to b11f96eaa4.
2013-11-22 00:09:37 -05:00
Aleksey Ovcharenko
9af44b1b42 Update to 4 space indent 2013-11-22 04:20:14 +02:00
Aleksey Ovcharenko
30678e04ac Make tests happy 2013-11-22 04:06:10 +02:00
Aleksey Ovcharenko
2222f6df58 Allow to specify ansible_ssh_private_key_file location related to user home directory 2013-11-22 01:47:03 +02:00
Matt Martz
3f2cbb7583 Add ansible.module_utils.rax 2013-11-21 15:46:25 -06:00
James Tanner
9b991b9154 Version bump for 1.5 2013-11-21 16:33:23 -05:00
Jan-Piet Mens
252a51be91 New lookup plugin csvreader 2013-11-21 09:39:52 +01:00
James Tanner
b815a09529 Fix pep8 error in password lookup 2013-11-19 16:36:18 -05:00
James Tanner
e81c976636 Fix pep8 errors in unarchive module 2013-11-19 16:35:06 -05:00
jctanner
68afd9da9f Merge pull request #4866 from sergevanginderachter/known_hosts_sudo
Check real user's known_hosts when sudo ansible...
2013-11-19 12:13:24 -08:00
Brian Coca
34c33f7ea1 now correctly spell symmetric
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
2013-11-19 14:48:11 -05:00
Brian Coca
460bbfaec1 added union filter
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
2013-11-19 14:40:55 -05:00
Brian Coca
afe30a6633 added difference and symetric difference filters
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
2013-11-19 00:06:38 -05:00
Michael DeHaan
fc909b453f Make the legacy template detection system not hit a false positive when
replacing a \$ with $.
2013-11-18 17:51:57 -05:00
jctanner
93223510af Merge pull request #4936 from stoned/group-get_hosts-perf2
Improve Group.get_hosts() performance.
2013-11-18 14:13:08 -08:00
Matt Haggard
389602b8dd Merge pull request #4920 from iffy/ansible
Collect all stdout over ssh transport before returning data
2013-11-18 15:09:21 -05:00
Michael DeHaan
f18acee779 Merge pull request #4937 from skyl/synchronize-keyerror
KeyError: 'delegate_to' lookup in sync module needs to be checked to see if defined for ad hoc
2013-11-18 11:40:27 -08:00
James Tanner
e8b54dd073 Fixes #4852 properly evaluate log_path writability 2013-11-18 10:40:49 -05:00
Skylar Saveland
7bc64581d7 KeyError: 'delegate_to' no more 2013-11-17 21:26:17 -08:00
Stoned Elipot
b00bf02129 Improve Group.get_hosts() performance.
- reduce hosts group list to unique elements faster
- add a cache of already computed hosts group list
2013-11-18 03:48:55 +01:00