Commit graph

16291 commits

Author SHA1 Message Date
Jeff '2 bits' Bachtel
8c11ea5666 Add an ec2 inventory option "boto_profile" that allows
the use of boto profiles for separating credentials as
specified in

http://boto.readthedocs.org/en/latest/boto_config_tut.html
2015-09-28 21:35:46 +05:30
willthames
9c967dd054 Allow ec2 inventory to use a boto profile
This allows the EC2 inventory plugin to be used with
the same configuration against different EC2 accounts

Profile can be passed using --profile variable or using
EC2_PROFILE environment variable e.g.

```
EC2_PROFILE=prod ansible-playbook -i ec2.py playbook.yml
```

Added documentation on profiles to EC2 dynamic inventory doc

Only tries to use profiles if --profile argument is given
or EC2_PROFILE is set to maintain compatibility will boto < 2.24.

Works around a minor bug in boto where if you try and use
a security token with a profile it fails (boto/boto#2100)
2015-09-28 21:35:46 +05:30
Toshio Kuratomi
fd267989fb Fix docs build 2015-09-28 08:23:12 -07:00
Toshio Kuratomi
69ebb899a7 Update submodule refs 2015-09-28 07:52:04 -07:00
James Cammarata
c860775b5d Another fix for --limit in adhoc 2015-09-28 10:39:33 -04:00
James Cammarata
babf47decb Clean up some bugs related to --limit on adhoc commands 2015-09-28 09:02:24 -04:00
James Cammarata
621575681a Merge pull request #12542 from amenonsen/qfix
Clarify why we add -q only for ssh
2015-09-28 08:18:31 -04:00
James Cammarata
ed73b45ec7 Merge pull request #12540 from mgedmin/py3k
Python 3: the StringIO module is gone
2015-09-28 08:18:07 -04:00
Abhijit Menon-Sen
2ce219b5af Clarify why we add -q only for ssh 2015-09-28 16:00:23 +05:30
Marius Gedminas
9b39af8e9a Python 3: the StringIO module is gone
Fixes 17 failing tests on Python 3.4, restoring the 8 failures we had
last Friday.
2015-09-28 09:28:53 +03:00
James Cammarata
4cd810a674 Only append -q option for ssh if we're using ssh 2015-09-26 21:27:38 -04:00
James Cammarata
46984a067c Don't wrap vars from include_vars with UnsafeProxy 2015-09-26 15:16:46 -04:00
James Cammarata
4c7843f268 Merge pull request #12532 from fboender/devel
Output proper JSON from vbox dynamic inventory contrib script
2015-09-26 14:20:45 -04:00
James Cammarata
abfeb104df Merge pull request #12529 from soarpenguin/bug-fix
fix no self pointer out of class.
2015-09-26 14:18:58 -04:00
Toshio Kuratomi
342bc97322 Port chroot conection plugin to the latest v2 connection API.
Also get pipelining working for people who look to chroot as an example
for their own connection plugins

Note: In the latest v2 API, action handles become but chroot doesn't
reliably handle become.  Maybe we need to add a has_become attribute
that the action can display an appropriate error.
2015-09-26 10:00:28 -07:00
Toshio Kuratomi
056a020357 Do not fail if /proc/uptime is not present
This can happen in chroot environments that don't have all of /proc
available
2015-09-26 10:00:28 -07:00
Toshio Kuratomi
ae66d01a33 Document how a command is executed on the remote machine
Helps connection plugin implementors understand how to structure
exec_command()
2015-09-26 10:00:28 -07:00
Ferry Boender
c6c3ce6616 Output proper JSON from vbox dynamic inventory contrib script 2015-09-26 18:25:58 +02:00
James Cammarata
6dd38c2a10 Fix parent attribute lookup to be default
Fixes #12526
2015-09-26 11:28:29 -04:00
James Cammarata
a1c38a3fda Adding delegate_to to Blocks 2015-09-26 11:28:01 -04:00
Brian Coca
a591582b24 Merge pull request #12530 from amenonsen/fixups
Update outdated comment
2015-09-26 08:16:14 -04:00
Abhijit Menon-Sen
8251ab2e37 Update outdated comment
Since #12165 was merged, hostnames are properly validated.
2015-09-26 17:32:13 +05:30
Abhijit Menon-Sen
6ff4d40d74 Update outdated comment
We now use "sudo -n" instead of "sudo -k && sudo …"
2015-09-26 17:28:22 +05:30
soarpenguin
1ea66e234f fix logic judgment error. 2015-09-26 15:15:53 +08:00
soarpenguin
2caa52a981 fix no self pointer out of class. 2015-09-26 14:09:56 +08:00
Brian Coca
b757798f3e Merge pull request #12483 from jeffwidman/patch-2
Clarified that .yml, .yaml, and .json are allowable file extensions for inventory vars files
2015-09-25 20:45:53 -04:00
James Cammarata
60e1a1f8eb Fix bug in nested lookup where pop is called indiscriminately 2015-09-25 17:16:56 -04:00
Brian Coca
191ae0831d fixed syntax error 2015-09-25 17:15:26 -04:00
Brian Coca
48412c13b2 fixed copy n paste typo on future code 2015-09-25 17:08:03 -04:00
James Cammarata
bb1101498d Clean up typo from cdc6c52 2015-09-25 16:58:27 -04:00
James Cammarata
cdc6c5208e Clean string data run through the template engine
Also strip UnsafeProxy off of low level srings and objects to ensure
they don't cause issues later down the road

Fixes #12513
2015-09-25 16:49:31 -04:00
James Cammarata
ae9b34b1d9 Fix for equality checking in Host to make sure things are like types 2015-09-25 16:49:31 -04:00
Toshio Kuratomi
fa9ea32a86 Fix test of whether a result has a failed host 2015-09-25 12:09:27 -07:00
Brian Coca
1c49e3b842 draft shared service code for modules, part of spliting service module 2015-09-25 11:26:21 -04:00
Toshio Kuratomi
41756be4d3 Update core module ref 2015-09-25 07:49:32 -07:00
Toshio Kuratomi
dcdcd9e9c5 Move is_executable to the toplevel of basic.py so we can utilize it from other code 2015-09-25 07:48:57 -07:00
James Cammarata
aedec951be Merge pull request #12521 from mgedmin/patch-1
Typo in shell command in example
2015-09-25 07:54:12 -04:00
Marius Gedminas
b57d549e16 Typo in shell command in example 2015-09-25 10:27:35 +03:00
James Cammarata
ccddda1ebc Merge pull request #12502 from mgedmin/py3k
Python 3: make test_variable_manager_precedence pass
2015-09-25 03:05:02 -04:00
James Cammarata
eb8d7dcd14 Make sure formatted strings don't bomb on tuples
Fixes #12501
2015-09-25 03:01:42 -04:00
James Cammarata
31d5f88a1d Use the task loop to calculate multiple delegated hosts
Due to the way we're now calculating delegate_to, if that value is based
on a loop variable ('item') we need to calculate all of the possible
delegated_to variables for that loop.

Fixes #12499
2015-09-25 01:41:09 -04:00
Toshio Kuratomi
a1428d6bed Remove tmp as a parameter to the connection plugins
There doesn't appear to be anything that actually uses tmp_path in the
connection plugins so we don't need to pass that in to exec_command.
That change also means that we don't need to pass tmp_path around in
many places in the action plugins any more.  there may be more cleanup
that can be done there as well (the action plugin's public run() method
takes tmp as a keyword arg but that may not be necessary).

As a sideeffect of this patch, some potential problems with chmod and
the patch, assemble, copy, and template modules has been fixed (those
modules called _remote_chmod() with the wrong order for their
parameters.  Removing the tmp parameter fixed them.)
2015-09-24 13:33:57 -07:00
James Cammarata
95b371dd60 Use AnsibleFileNotFound instead of AnsibleParsingError when YAML files are not found
And update portions of code to expect the proper error.

Fixes #12512
2015-09-24 16:27:25 -04:00
Toshio Kuratomi
0250beb68a Remove compress option from paramiko connection for now
It's not available on older versions of paramiko such as shipped in RHEL6
2015-09-24 13:18:00 -07:00
James Cammarata
12df9f2e31 Make hostvars more dynamic again to improve performance with large inventories
Fixes #12477
2015-09-24 13:53:44 -04:00
Abhijit Menon-Sen
82b33c381f We don't need even a token timeout here; just poll once
The process is already gone, so there's not going to be any new data
showing up on its stderr; we only want to make sure that we haven't
missed something that was already written. So polling once is enough.
2015-09-24 12:10:16 -04:00
Abhijit Menon-Sen
6e82df451a Clarify select() handling for ssh connections
This change is motivated by an ssh oddity: when ControlPersist is
enabled, the first (i.e. master) connection goes into the background; we
see EOF on its stdout and the process exits, but we never see EOF on its
stderr. So if we ran a command like this:

    ANSIBLE_SSH_PIPELINING=1 ansible -T 30 -vvv somehost -u someuser -m command -a whoami

We would first do select([stdout,stderr], timeout) and read the command
module output, then select([stdout,stderr], timeout) again and read EOF
on stdout, then select([stderr], timeout) AGAIN (though the process has
exited), and select() would wait for the full timeout before returning
rfd=[], and then we would exit. The use of a very short timeout in the
code masked the underlying problem (that we don't see EOF on stderr).

It's always preferable to call select() with a long timeout so that the
process doesn't use any CPU until one of the events it's interested in
happens (and then select will return independent of elapsed time).

(A long timeout value means "if nothing happens, sleep for up to <x>";
omitting the timeout value means "if nothing happens, sleep forever";
specifying a zero timeout means "don't sleep at all", i.e. poll for
events and return immediately.)

This commit uses a long timeout, but explicitly detects the condition
where we've seen EOF on stdout and the process has exited, but we have
not seen EOF on stderr. If and only if that happens, it reruns select()
with a short timeout (in practice it could just exit at that point, but
I chose to be extra cautious). As a result, we end up calling select()
far less often, and use less CPU while waiting, but don't sleep for a
long time waiting for something that will never happen.

Note that we don't omit the timeout to select() altogether because if
we're waiting for an escalation prompt, we DO want to give up with an
error after some time. We also don't set exceptfds, because we're not
actually acting on any notifications of exceptional conditions.
2015-09-24 12:10:16 -04:00
Toshio Kuratomi
03127dcfae remove the stdin return value from connection plugin exec_command() methods
The value was useless -- unused by the callers and always hardcoded to
the empty string.
2015-09-24 08:57:19 -07:00
James Cammarata
9d47eabfa4 Merge pull request #12506 from hyperized/devel
Add Weekday (0-6) as a number and add weeknumber (00-52)
2015-09-24 11:44:39 -04:00
Toshio Kuratomi
24b9e2e6d1 Update extras submodule ref 2015-09-24 07:18:23 -07:00