Matt Martz
eb8759176f
Allow sudo to another user from root
2014-04-23 16:14:48 -05:00
James Cammarata
38b49476f8
Merge branch 'raw-script-su-support' of https://github.com/sivel/ansible into sivel-raw-script-su-support
2014-04-23 10:02:13 -05:00
James Cammarata
a6068b09ac
Fix collision in random filter name by merging functionality
...
Merges the functionality of the original jinja2 random filter with
the one we provide.
Fixes #7113
2014-04-22 14:21:00 -05:00
James Cammarata
086b877719
Merge pull request #7079 from mscherer/fix_error_whitespace_in_config
...
Clean a bit more the ssh_args configuration
2014-04-21 10:43:31 -05:00
Michael Scherer
c87afc1109
Clean a bit more the ssh_args configuration
...
If someone add ssh_args = " " to his .ansible.cfg, it will result into
strange failure later :
<server.example.org> ESTABLISH CONNECTION FOR USER: misc
<server.example.org> REMOTE_MODULE ping
<server.example.org> EXEC ['ssh', '-C', '-tt', '-q', ' ', '-o', 'KbdInteractiveAuthentication=no',
'-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no',
'-o', 'ConnectTimeout=10', 'server.example.org', "/bin/sh -c 'mkdir -p /tmp/ansible-tmp-1397947711.21-5932460998838
&& chmod a+rx /tmp/ansible-tmp-1397947711.21-5932460998838 && echo /tmp/ansible-tmp-1397947711.21-5932460998838'"]
server.example.org | FAILED => SSH encountered an unknown error during the connection. We recommend you re-run the
command using -vvvv, which will enable SSH debugging output to help diagnose the issue
The root cause is the empty string between -q and -o, who kinda break mkdir.
2014-04-20 00:47:00 +02:00
Michael Scherer
3a09c99811
Enhance error message about missing ControlPersist
...
ansible_ssh_args is good for playbook, but in the ~/.ansible.cfg
file, it should be ssh_args in a specific section.
2014-04-20 00:35:10 +02:00
James Cammarata
a32dd34359
Make sure HostVars object is instantiated before assigning it
...
Fixes #7006
2014-04-18 16:23:01 -05:00
Sébastien Gross
22d6572270
Honor ansible_private_key_file for delegated hosts
...
If a delegated host is not found in the inventory specified
private_key_file for primary host was not used.
This allows running playbooks without having to define any inventory at
all and to use the same ssh private key for both primary host and
delegated one.
2014-04-18 01:48:02 +02:00
smoothify
48bf7a000d
Try to pass in item to on_skippped callback.
2014-04-16 15:40:07 +01:00
James Cammarata
ba1a6c2e11
Removing .orig file merged in accidentally
2014-04-15 10:58:53 -05:00
James Tanner
aad128bac7
Use combined cache for templating module vars
...
Fixes #6901
2014-04-15 10:56:48 -05:00
James Cammarata
40b958e348
Don't turn complex args back into a k=v string for the synchronize module
...
Fixes #6951
2014-04-14 16:35:16 -05:00
Brian Coca
80cd217eb7
simple random filter
2014-04-09 09:03:38 -04:00
James Cammarata
5ce6c86595
Merge branch 'sudo_pass_typo' of https://github.com/tyll/ansible into tyll-sudo_pass_typo
2014-04-08 14:52:42 -05:00
James Tanner
318e752b6f
Fixes #6845 evaluate changed_when only if task is not skipped
2014-04-07 10:51:04 -04:00
James Tanner
5a65dc3b6a
Fixes #6820 fix erroneous missing vault password error when using the template module
2014-04-04 13:06:35 -04:00
James Cammarata
82b24c162e
Adding delimiter fixes to action_plugin + fixing local assembling with a delimiter
...
Also added a new integration test for assemble using local assembly
with a delimiter.
2014-04-03 16:32:35 -05:00
Michael DeHaan
2c7275e8a9
Merge pull request #6835 from sivel/version-compare-filter
...
Add version_compare filter
2014-04-03 17:07:05 -04:00
James Tanner
cdc0819939
Fixes #6088 turn off sudo and su if the connection is local the sudo user matches the current user
2014-04-03 12:02:51 -04:00
jctanner
2a9fcdd87c
Merge pull request #6711 from j2sol/raw-unreachable
...
Treat 255 errors from raw as dark host
2014-04-03 11:16:54 -04:00
jctanner
f6db60cbce
Merge pull request #6787 from tyll/pull_ssh_prompt
...
ssh: propagate prompt to _communicate()
2014-04-03 09:55:17 -04:00
Matt Martz
5770428e91
Add version_compare filter
2014-04-02 20:21:30 -05:00
Michael DeHaan
904f331210
Merge pull request #6788 from tyll/pull_ssh_verbose_comments
...
ssh connection plugin: Make comments more verbose
2014-04-02 17:24:16 -04:00
James Cammarata
e2d86e4f43
Splitting SETUP_CACHE into two caches, one for host vars and one for setup facts
2014-04-01 16:23:33 -05:00
Till Maas
e6cb32f284
ssh connection plugin: Make comments more verbose
...
Explain _communicate() more.
2014-04-01 09:46:51 +02:00
Till Maas
1da69309e5
ssh connection plugin: Report missing sudo password
...
If no password is provided, sudo hangs at the prompt. Identify this and
report that the password is missing as an error.
2014-04-01 09:36:59 +02:00
Till Maas
2cae7472ad
ssh: propagate prompt to _communicate()
...
_communicate() uses the prompt variable to detect wrong passwords early,
therefore it needs to be passed to it from exec_command().
2014-04-01 09:24:44 +02:00
James Cammarata
b9c044b8c9
Making the exception caught during os.dup of stdin explicit
...
Related to f23bb34
2014-03-31 13:50:23 -05:00
James Cammarata
f23bb344aa
Catch errors when duping stdin
...
Fixes #6657
2014-03-31 13:38:12 -05:00
James Cammarata
4f140be711
Merge branch 'devel' of https://github.com/Synforge/ansible into Synforge-devel
2014-03-31 13:04:56 -05:00
James Tanner
efba8b4771
Merge branch 'regexreplace' of git://github.com/jacobweber/ansible into jacobweber-regexreplace
2014-03-31 13:48:13 -04:00
James Tanner
2492c2714a
Fixes #5307 set relative paths to the files dir for roles and the inventory dir for non-role tasks
2014-03-31 12:25:40 -04:00
Till Maas
b07113f358
ssh: Properly check for wrong su password
2014-03-31 15:51:12 +02:00
Matt Martz
7e3dd1066c
Allow raw and script to support su
2014-03-28 16:46:31 -05:00
Paul Oyston
1942a69ed2
Added template call to _executor_internal to allow the passing of arbitrary data to modules.
2014-03-27 17:06:20 +00:00
Jesse Keating
3315ba0b99
Treat 255 errors from raw as dark host
...
Any other module is able to detect a dark host, but raw was treating 255
as a return code from the module execution, rather from the connection
attempt. This change allows 255 to be treated as a connection failure
when using the raw module.
2014-03-26 16:40:50 -07:00
James Tanner
88462729aa
Addresses #6708 fill in missing keywords for ssh.py _communicate
2014-03-26 15:55:54 -04:00
jctanner
7dc3dc5279
Merge pull request #6708 from sivel/put-file-control-master
...
Share p.communicate alternative logic between exec_command and put_file
2014-03-26 15:02:14 -04:00
James Cammarata
e09313120c
Make async jid's unique per host
...
The jid will now also contain the PID of the async_wrapper process,
and can each unique jid from each host is tracked rather than just
relying on one global jid per task.
Fixes #5582
2014-03-26 13:48:47 -05:00
Matt Martz
b8cb23d309
Share p.communicate alternative logic between exec_command and put_file
2014-03-26 13:41:33 -05:00
James Cammarata
7a3fa63db5
Fix for unicode environment variable handling
...
Fixes #5395
2014-03-25 20:45:04 -05:00
James Cammarata
c9bf7eb9bb
Don't run {failed|changed}_when checks until async_status is done
...
Fixes #5117
2014-03-25 14:18:47 -05:00
Michael DeHaan
a062912a1f
Merge pull request #6658 from pilou-/fix_fix
...
'changed' key is not defined when task fails
2014-03-25 11:49:18 -04:00
James Cammarata
dc658eaa1c
Check to make sure the host is in the inventory vars cache before clearing it
...
Fixes #6660
2014-03-24 15:59:43 -05:00
Pierre-Louis Bonicoli
c76501b8a3
'changed' key is not defined when task fails
...
fix KeyError introduced by fix of #6591 .
2014-03-24 19:31:52 +01:00
Michael DeHaan
a24d3f78d9
Merge pull request #6634 from pilou-/fix
...
Remove print statements
2014-03-23 16:12:04 -04: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
Pierre-Louis Bonicoli
d3a470db0c
Remove print statements
...
"print item" raises an exception when type of item is
jinja2.runtime.StrictUndefined
2014-03-23 03:58:44 +01:00
Michael DeHaan
d0cbb51170
Merge pull request #6615 from 8191/devel
...
Addresses #6591 Hide diff for lineinfile if file did not change.
2014-03-21 10:46:29 -04:00
Manuel Faux
b8158f5f6a
Addresses #6591 Hide diff for lineinfile if file did not change.
2014-03-21 08:40:38 +01:00
Joshua Conner
1c504eff68
etcd lookup: use $ANSIBLE_ETCD_URL if it exists in the env
2014-03-20 15:16:28 -07:00
James Tanner
ea5186ca63
Fixes #6590 add set_remote_user parameter to synchronize
...
This allows usage of custom ssh configs for remote hosts where
the inventory user does not match the configured user.
2014-03-20 13:56:07 -04:00
James Cammarata
c9fcbf7bdd
Change print message to vvv for missing known hosts in ssh.py
2014-03-18 12:26:10 -05:00
James Tanner
49807877fa
Fixes #6550 Use shell for pipe lookup subprocess.popen calls
2014-03-18 12:21:26 -04:00
Michael DeHaan
94e3350b38
Catch a unquoted line error. Fixes #6532
2014-03-17 17:15:42 -04:00
James Tanner
20262b6c15
Remove unused variable in _executor_internal
2014-03-17 15:53:48 -04:00
James Tanner
ebb6b8442b
Catch unicode unescape failures in copy action plugin
2014-03-17 12:14:29 -04:00
Michael DeHaan
6144c5e1e2
Merge pull request #5714 from eggsby/patch-2
...
Allow templates in ansible_sudo_pass inventory var
2014-03-16 15:42:12 -05:00
Michael DeHaan
3d44f7cd51
Merge pull request #6217 from ashokrajar/patch-1
...
pause plugin doesn't flush raw_input prompt
2014-03-16 12:32:58 -05:00
Cristian Ciupitu
0749112286
Micro-optimization: replace s.find(x)!=-1 with x in s
...
timeit shows a speedup of ~3x on Python 2.7.5 x86_64.
It also makes the code a bit shorter.
2014-03-16 13:10:28 -04:00
brdo
3963a64a4f
Set keepalive to 5 seconds in paramiko_ssh.py
...
This update resolves https://github.com/ansible/ansible/issues/6476 .
2014-03-15 11:18:47 -07:00
James Cammarata
6c25e78299
Merge branch 'devel' of https://github.com/dparalen/ansible into dparalen-devel
2014-03-11 15:34:15 -05:00
James Tanner
e4e64a9699
Rename lxc to libvirt_lxc
2014-03-11 16:16:24 -04:00
James Cammarata
bca6adc812
Merge pull request #4064 from mscherer/lxc
...
Add a plugin that permit to use ansible for lxc system, using libvirt
2014-03-11 15:12:51 -05:00
James Tanner
ba0fec4f42
Force command action to not be executed by the shell unless specifically enabled
2014-03-10 16:13:30 -05:00
Richard Isaacson
4993cb57f4
Merge pull request #6283 from magicrobotmonkey/upstream
...
fix missing stdin in _parallel_runner
Tested with GIST https://gist.github.com/risaacson/7290d30a612e0c70ea1b .
Passes "make tests"
Passes non_destructive tests.
2014-03-10 14:38:56 -05:00
Michael DeHaan
d2cb35f898
Merge pull request #6320 from angstwad/instance-redo
...
Use isinstance() rather than a check using type()
2014-03-07 20:41:33 -06:00
James Cammarata
f80d02d841
Properly wrap logical elements together for su/sudo detection
2014-03-07 00:07:10 -06:00
Paul Durivage
3cce3650e5
Use isinstance() rather than a check using type()
2014-03-06 16:16:25 -06:00
James Cammarata
9b79591f23
Merge branch 'devel' of https://github.com/aresch/ansible into aresch-devel
2014-03-06 15:17:55 -06:00
Andrew Resch
4d80019ac8
Fix logic checking for both sudo and su, and their respective users
2014-03-06 10:24:16 -08:00
James Cammarata
9f2999df79
Un-escape newlines in delimiters for assemble module
2014-03-06 09:44:56 -06:00
aresch
23a0468a4b
Fix respecting remote_tmp when sudo is used
2014-03-05 16:25:42 -08:00
James Tanner
4e8ed92130
Fixes #6077 decode escaped newline characters in content for the copy module
2014-03-05 18:49:54 -05:00
James Tanner
6129ea7566
Fixes #6298 and adds a sudo unit test for synchronize
2014-03-05 14:51:40 -05:00
Luca Berruti
7cf363910a
fixes #6244
2014-03-05 09:18:01 +01:00
Aaron Bassett
5c589af191
fix missing stdin in _parallel_runner
2014-03-04 16:00:26 -05:00
Richard Isaacson
92aacb198c
Merge pull request #6156 from iiordanov/devel
...
Add support for checking host against global known host files.
The effect of this is that before this fix if files are spread across the known_hosts file but not in the ~/known_hosts file the hosts will execute sequentially. This PR augments the functionality so that all of the knowns hosts will execute in parallel.
2014-03-03 23:51:51 -06:00
Richard Isaacson
e79d859dfb
Merge pull request #6213 from sergevanginderachter/fix-delegate-templating
...
Fixes templating of ansible_ssh_host for delegates.
Tested that this works. Confirmed.
2014-03-03 23:10:09 -06:00
Tefnet
c652802d29
missing import in assert module
...
Fixed missing ansible.errors import in assert module
2014-03-02 00:59:17 +01:00
Michael DeHaan
46ec8759d5
Remove the legacy templating code, which was guarded by deprecation warnings in the previous two releases, and undocumented for a long time. use {{ foo }} to access variables instead of ${foo} or $foo.
2014-02-28 18:38:45 -05:00
James Cammarata
79645535c0
Handle empty results from failed connections in _remote_md5()
...
Fixes #5800
2014-02-28 12:50:03 -06:00
Gilles Cornu
04f6367172
Fully clean 'ssh_old' and 'paramiko_alt' options
...
These transports have been removed in 33857855ad
2014-02-28 18:28:04 +01:00
Ashok Raja R
cb3c6417dd
pause plugin doesn't flush raw_input prompt
...
##### Issue Type:
Bugfix Pull Request
##### Ansible Version:
ansible 1.4.3
##### Environment:
N/A
##### Summary:
We are using a wrapper python script to run ansible-playbook. We use subprocess to execute and print the stdout as and when its written. Problem is when we use pause it doesn't display the prompt string as raw_input does not flush stdout before reading from stdin.
It looks like a dirty fix to add "\n" to the prompt string but i don't see any other way to over come this. If anyone else have a better fix please do propose/suggest.
##### Steps To Reproduce:
```yaml
#File: test_play.yml
- name: Test
hosts: $nodes
gather_facts: false
tasks:
- name: Waiting for User
local_action: pause prompt="Do you want to continue (yes/no)? "
```
```python
#!/usr/bin/env python
#File: test.py
import shlex, subprocess
def run_process(process):
process = process.encode("utf-8")
command = shlex.split(process)
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
for line in iter(p.stdout.readline, b''):
print line,
cmd = "/usr/bin/python -u /usr/bin/ansible-playbook -i hosts.txt test_play.yml -e 'nodes=local'"
run_process(cmd)
```
```
shell $ python test.py
```
##### Expected Results:
```
PLAY [Test] *******************************************************************
TASK: [Waiting for User] ******************************************************
[localhost]
Do you want to continue (yes/no)? :
```
##### Actual Results:
```
PLAY [Test] *******************************************************************
TASK: [Waiting for User] ******************************************************
[localhost]
```
2014-02-28 11:28:38 +05:30
James Cammarata
df9de6ea71
Expand the source path in the action plugin when not using a remote source
...
Fixes #6209
2014-02-27 12:50:35 -06:00
Serge van Ginderachter
9833263417
Fixes templating of ansible_ssh_host for delegates
2014-02-27 18:06:34 +01:00
James Cammarata
c11e2100e0
Save the original transport in runner after detecting the smart transport
...
Fixes #6192
2014-02-27 10:30:50 -06:00
Michael DeHaan
cd7d7eb1bc
Merge pull request #6202 from muffl0n/unarchive_destdir
...
unarchive: output dest in error-message
2014-02-27 10:36:10 -05:00
muffl0n
17946b23d5
output dest in error-message
2014-02-27 13:29:26 +01:00
James Cammarata
2a383786dd
And remove the expanduser calls from the action_plugin
2014-02-26 15:29:00 -06:00
James Cammarata
96f1c3ce2e
Move where the expanduser call is made, to avoid issues with None
2014-02-26 12:33:17 -06:00
James Cammarata
e659d55d62
Merge branch 'devel' of https://github.com/muffl0n/ansible into muffl0n-devel
2014-02-26 12:28:26 -06:00
Michael DeHaan
33857855ad
removing some unusued files. Paramiko alt was an experiment to attempt pipeline for paramiko, ssh_old is the non-pipelining-supported earlier
...
version of the OpenSSH transport, which is configurable now and unified.
2014-02-26 11:26:52 -05:00
Richard C Isaacson
af616fe15e
Rename flatten funciton.
...
flatten(x) is used a lot in the various lookup plugins where in each it is slightly different. This is to make this name slightly more unique.
2014-02-25 14:59:06 -06:00
Kent R. Spillner
1fcc9ff666
lookup_plugins: loop over hashes
...
Create a lookup plugin named dict that can be used to loop over hashes.
It converts a dict into a list of key-value pairs, with attributes named
"key" and "value." Also adds a brief explanation and simple example to
the docs.
Signed-off-by: Kent R. Spillner <kspillner@acm.org>
2014-02-25 11:20:15 -06:00
James Tanner
876035c0b1
Fixes #6161 Get the delegate host info properly from the hostvars object
2014-02-25 11:18:06 -05:00
James Tanner
9209581565
Fixes #6155 Inject checkmode into synchronize module args
2014-02-25 08:58:58 -05:00
James Tanner
0f95a905d9
Fixes #5965 Ensure the inject for each item in a loop is un-altered
2014-02-24 20:54:26 -05:00
Iordan Iordanov
a1854bb762
Add support for checking host against global known host files.
2014-02-24 16:05:03 -05:00