Commit graph

1073 commits

Author SHA1 Message Date
Daniel Hokka Zakrisson
d703f92077 Disable authentication methods that weren't specified 2012-11-27 15:24:33 +01: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
Michael DeHaan
da90c5f75e Document 'when' and tweak the code to be a little more comprehensive on what is false. 2012-11-26 18:37:44 -05:00
Daniel Hokka Zakrisson
43bdec8b20 Throw an error if multiple actions have been specified 2012-11-26 22:42:44 +01:00
Daniel Hokka Zakrisson
1e0295c7e2 Template handlers late
This allows overriding variables in name, and removes templating from
parsing.
2012-11-26 22:07:57 +01:00
Daniel Hokka Zakrisson
ebd31af940 Don't prompt for vars in extra-vars
Fixes #1622.
2012-11-26 22:07:57 +01:00
Daniel Hokka Zakrisson
94fc3006e9 Make variables local to the play
Fixes #1677.
2012-11-26 22:07:57 +01:00
Daniel Hokka Zakrisson
0c70abfaa9 Make sure any existing groups gets reused 2012-11-25 12:42:30 +01:00
Daniel Hokka Zakrisson
5504f13c68 Create groups in the first run through the file
Fixes #1208.
2012-11-25 01:00:14 +01:00
Daniel Hokka Zakrisson
2bfb7deec0 Set all in the returned dict
Otherwise the group is lost, and group_vars/all isn't used.
2012-11-25 00:15:22 +01:00
Michael DeHaan
33196ec131 Merge pull request #1669 from dagwieers/ssh-tcgetattr2
Use proper pseudo-tty's instead of pipes when using subprocess
2012-11-24 08:30:26 -08:00
Dag Wieers
7192eb3047 Use proper pseudo-tty's instead of pipes when using subprocess
This change avoids the "tcgetattr: Invalid argument" error by making sure the ssh we start does have a proper pseudo-tty.

We could also check whether our current terminal is a proper terminal (by doing a tcgetattr ourselves) but I don't think this adds anything.

This closes #1662 (if all use-cases have been tested: sudo, passwd)
2012-11-23 22:39:30 +01:00
Daniel Hokka Zakrisson
db1a65342a Set -c local cwd to . if basedir is empty 2012-11-23 13:36:09 +01:00
Daniel Hokka Zakrisson
715d875dcb Group should only return its own variables
Otherwise, a host in two groups, A and B, using a variable defined
in group A and all will get the value of all, as B's variables will
include the all variable.

Partially fixes #1647.
2012-11-23 00:54:07 +01:00
Daniel Hokka Zakrisson
e44b85daba Remove special-casing for all group
global_vars has higher precedence than inventory. Putting the all
group's variables into it overrides all other groups and hosts.

Partially fixes #1647.
2012-11-23 00:54:02 +01:00
Daniel Hokka Zakrisson
bd7e02d629 Get all groups' variables in order of depth
Fixes all not being processed, as well as the order of the variable
precedence
2012-11-23 00:20:52 +01:00
Daniel Hokka Zakrisson
d5dd89a8f7 Allow specifying when: ... 2012-11-22 23:11:42 +01:00
Daniel Hokka Zakrisson
fd732f8d3b Add when_boolean
Fixes #1567.
2012-11-22 23:10:11 +01:00
Daniel Hokka Zakrisson
ddef608c94 Wrap all remote commands in sh 2012-11-22 20:06:30 +01:00
Daniel Hokka Zakrisson
047d089cea Restore git output on --version
Broken by the move from utils.py to utils/__init__.py
2012-11-21 23:54:42 +01:00
Daniel Hokka Zakrisson
ef357ed1f2 Use the play's vars for the setup step
Allows using -e ansible_ssh_port=foo and have it apply to all actions.
2012-11-21 23:42:24 +01:00
Daniel Hokka Zakrisson
d1c285b70b Port may be an integer when parsed from the play 2012-11-21 17:20:03 +01:00
Michael DeHaan
82f4aef959 Merge pull request #1648 from dhozac/local-cwd-basedir
Use runner's basedir as cwd for -c local
2012-11-21 06:40:01 -08:00
Michael DeHaan
41af2fce64 Merge pull request #1650 from dagwieers/port-not-integer-exception
Provide a proper error when the remote_port is not an integer
2012-11-21 06:39:24 -08:00
Daniel Hokka Zakrisson
3ce63d845e remote_port is None by default 2012-11-21 14:10:10 +01:00
Daniel Hokka Zakrisson
6b69b37eb0 Merge pull request #1649 from dagwieers/template-port
Allow the remote port to be templated per play
2012-11-20 13:16:34 -08:00
Dag Wieers
85bba04a1c Provide a proper error when the provided port is not an integer
As reported on the mailinglist, the user received a ValueError when the port number was not templated (fixed in #1649) and therefore it was not an integer. This change will catch the exception and provide a proper error so it is more clear.
2012-11-20 19:06:27 +01:00
Dag Wieers
8458f53014 Allow the remote port to be templated
This was requested on the mailinglist and seems useful.
2012-11-20 18:53:40 +01:00
Daniel Hokka Zakrisson
48898993b9 Fix removing of temporary files 2012-11-20 16:51:19 +01:00
Daniel Hokka Zakrisson
0ebf4b2d5a Add destination path to fetch result 2012-11-20 15:39:48 +01:00
Daniel Hokka Zakrisson
bdf05ec9a0 Use runner's basedir as cwd for -c local 2012-11-20 15:36:43 +01:00
Daniel Hokka Zakrisson
f89f07871d Fix typo in first_available_file error path 2012-11-19 23:02:26 +01:00
Daniel Hokka Zakrisson
f95fefd8c5 Use plugin system to find modules 2012-11-18 19:09:21 +01:00
Daniel Hokka Zakrisson
5dd2ec2cae Add a way to add directories to just one type of loader 2012-11-18 19:08:59 +01:00
Daniel Hokka Zakrisson
d2abfb9ff8 Ensure runner adds its basedir, so ansible can benefit from plugins 2012-11-18 18:37:20 +01:00
Daniel Hokka Zakrisson
5183417de8 Reinstate ANSIBLE_KEEP_REMOTE_FILES
Fixes #1395.
2012-11-18 18:32:45 +01:00
Daniel Hokka Zakrisson
11175781b8 Use slurp for fetch is sudo is enabled and needed
Fixes #1020.
2012-11-18 17:54:00 +01:00
Daniel Hokka Zakrisson
11afd84d32 Drop dwim prefix from returned items in fileglob
Fixes #1618.
2012-11-18 00:25:38 +01:00
Michael DeHaan
1b78dabcd4 Merge pull request #1632 from dhozac/use-ssh-conn-section-for-scp
Use the ssh_connection section for scp_if_ssh
2012-11-17 07:41:35 -08:00
Michael DeHaan
3bc0adacbf Merge pull request #1634 from dhozac/ssh-password
Add password support to -c ssh via sshpass
2012-11-17 07:37:51 -08:00
Daniel Hokka Zakrisson
e6fed9f216 Add password support to -c ssh via sshpass 2012-11-16 23:46:49 +01:00
Daniel Hokka Zakrisson
021172f78d Use the configured remote_tmp even for root 2012-11-16 23:46:17 +01:00
Daniel Hokka Zakrisson
c906f44d90 Use the ssh_connection section for scp_if_ssh 2012-11-16 23:45:47 +01:00
Michael DeHaan
ab5c0dfe7e __new__ does not take arguments, remove deprecation warning 2012-11-14 19:58:44 -05:00
Michael DeHaan
096607eea4 Allow fireball to transfer binary files, fixup fireball docs, make fetch work with fireball. 2012-11-14 18:37:17 -05:00
Michael DeHaan
d500398e76 Merge pull request #1616 from dagwieers/skip-register
Do not register variable if host has been skipped
2012-11-14 06:33:30 -08:00
Michael DeHaan
52e2654faf Merge pull request #1621 from dhozac/lookup-with-vars
Lookup plugin arguments need to be templated
2012-11-14 06:32:39 -08:00
Daniel Hokka Zakrisson
17e4ce97a4 Create a set of all the hosts in a group to prevent duplicates
Fixes #1516.
2012-11-14 13:35:21 +01:00
Daniel Hokka Zakrisson
e74ffd6764 Lookup plugin arguments need to be templated 2012-11-14 11:17:30 +01:00
Dag Wieers
302eeae65d Do not register variable if host has been skipped
Executive summary: skipping a host corrupts a variable (when it is registered)

We have a play existing out of multiple tasks that check a condition, if one of these tasks fails we want to skip all next tasks in the playbook. I noticed that if we skip a task because a certain condition is met, and this task has a register-attribute, I loose the value in the variable. Which means we cannot use that variable in subsequent tasks to evaluate because it was skipped:

```
- action: command test -d /some/directory
  register: task

- action: command test -f /some/directory/file
  register: task
  only_if: '${task.rc} == 0'

- action: do something else
  only_if: '${task.rc} == 0'
```

In the above example, if the second task is skipped (because the first failed), the third action will end with a "SyntaxError: invalid syntax" complaining about the unsubstituted ${task.rc} (even though it was set by the first task and used for skipping the second).

The following play demonstrates the problem:

```
- name: Test register on ignored tasks
  hosts: all
  gather_facts: no

  vars:
    skip: true
    task: { 'rc': 666 }

  tasks:
  - action: debug msg='skip = ${skip}, task.rc = ${task.rc}'

  - name: Skip this task, just to test if task has changed
    action: command ls
    register: task
    only_if: '${skip} != True'

  - action: debug msg='skip = ${skip}, task.rc = ${task.rc}'

  - name: Now use task value
    action: command echo 'Works !'
    only_if: '${task.rc} == 0'
```

And the enclosed fix, fixes the above problem.
2012-11-13 16:57:10 +01:00