Commit graph

2989 commits

Author SHA1 Message Date
Michael DeHaan
a1c23af6fc Merge pull request #1239 from jpmens/shelldoc
fix wording of shell documentation
2012-10-05 06:11:31 -07:00
Jan-Piet Mens
91dc8bc136 fix examples in hpilo_facts DOCUMENTATION 2012-10-05 15:07:45 +02:00
Jan-Piet Mens
70907f574e fix wording of shell documentation 2012-10-05 14:59:49 +02:00
Michael DeHaan
0679537495 Merge pull request #1235 from jpmens/man3
man pages have wrong chapter number
2012-10-05 05:10:08 -07:00
Michael DeHaan
1737d6b884 Merge pull request #1236 from jpmens/manansible1
remove duplicate private-key option from manpage
2012-10-05 05:09:57 -07:00
Michael DeHaan
9f1690ab64 Merge pull request #1237 from dagwieers/lineinfile-alias
Use the standard 'dest' option for target files, make 'name' an alias
2012-10-05 05:09:36 -07:00
Dag Wieers
70b063ce0e Use the standard 'dest' option for target files, make 'name' an alias 2012-10-05 11:03:14 +02:00
Jan-Piet Mens
a9dad7f3bd remove duplicate private-key option from manpage 2012-10-05 09:18:19 +02:00
Jan-Piet Mens
ba22ca13ba man pages have wrong chapter number 2012-10-05 09:09:49 +02:00
Michael DeHaan
f470ebe6b7 Merge pull request #1213 from dagwieers/debug-module
Module debug to assist users in understanding Ansible
2012-10-04 16:28:25 -07:00
Michael DeHaan
0592e1be79 Merge pull request #1222 from alopropoz/devel
Indicate errors with exit code.
2012-10-04 16:26:00 -07:00
Michael DeHaan
ebc2fe08c3 Merge pull request #1218 from jpmens/jtempl3
Allow user-specified $ansible_managed string
2012-10-04 16:18:57 -07:00
Michael DeHaan
a95bff0f5f Merge pull request #1230 from dagwieers/module-vsphere_facts
Module vsphere_facts to add facts from a VMWare vSphere guest
2012-10-04 16:18:39 -07:00
Michael DeHaan
5d7ab8a300 Merge pull request #1231 from dagwieers/fail-doc-fix
This hopefully fixes the documentation for the fail module
2012-10-04 16:18:10 -07:00
Michael DeHaan
adfc4d6f59 Merge pull request #1232 from dagwieers/module-hpilo_facts
Module hpilo_facts to add facts from HP iLO interfaces
2012-10-04 16:17:40 -07:00
Dag Wieers
8c8552ac32 Module vsphere_facts to add facts from a VMWare vSphere guest
This module gathers facts from a VMWare vSphere guest by querying vSphere. The facts include OS, network info (vlan, macaddress) and system info (cpu, memory, uuid) information. Useful information for provisioning and management.
2012-10-04 21:55:16 +02:00
Dag Wieers
e07674d756 Module hpilo_facts to add facts from HP iLO interfaces
This module gathers facts from the hardware interface by querying HP iLO. The facts include network info (vlan, macaddress) and system info (cpu, memory, uuid) information. Useful information for provisioning and management.

This module was previously named ilo_facts and mentioned in #1080, #1085, #1125 and #1217.
2012-10-04 21:50:34 +02:00
Dag Wieers
3d5c4df2ac This hopefully fixes the documentation for the fail module 2012-10-04 20:58:07 +02:00
Michael DeHaan
184523ecac Merge pull request #1220 from tbielawa/pause_variables
Fix variable injection in pause module args. Closes #1209
2012-10-04 05:14:41 -07:00
Michael DeHaan
c3f443f56c fix sorting 2012-10-04 07:08:13 -04:00
Michael DeHaan
8f5beb74c5 Fix sort order issue 2012-10-04 07:08:01 -04:00
Aleksej Romanov
05464816c2 Different return codes for different errors. 2012-10-04 17:43:25 +07:00
Dag Wieers
03af450bdc Module to assist users in understanding Ansible
After helping someone on IRC he was interested to have this debug module in upstream. This module simply 'prints' a message, and can be ordered to fail if needed. It helps to troubleshoot or understand inventory/facts issues and/or experiment with statements and conditions using only_if.

Here is a small example playbook:

```yaml
- hosts: all
  tasks:
  - local_action: debug msg="System $inventory_hostname has uuid ${ansible_product_uuid}"
  - local_action: debug msg="System $inventory_hostname lacks a gateway" fail=yes
    only_if: "is_unset('$ansible_default_ipv4.gateway')"
  - local_action: debug msg="System $inventory_hostname has gateway ${ansible_default_ipv4.gateway}"
    only_if: "is_set('$ansible_default_ipv4.gateway')"
```

outputting:
```
[root@moria ansible]# ansible-playbook -v -l localhost:x220 test6.yml

PLAY [all] *********************

GATHERING FACTS *********************
ok: [localhost]
ok: [x220]

TASK: [debug msg="System $inventory_hostname has uuid $ansible_product_uuid"] *********************
ok: [localhost] => {"msg": "System localhost has uuid d125a48c-364f-4e65-b225-fed42ed61fac"}
ok: [x220] => {"msg": "System x220 has uuid d125a48c-364f-4e65-b225-fed42ed61fac"}

TASK: [debug msg="System $inventory_hostname lacks a gateway" fail=yes] *********************
failed: [localhost] => {"failed": true, "msg": "System localhost lacks a gateway", "rc": 1}
ok: [x220] => {"msg": "System x220 has gateway 192.168.1.1"}

PLAY RECAP *********************
localhost                      : ok=2    changed=0    unreachable=0    failed=1
x220                           : ok=3    changed=0    unreachable=0    failed=0

```

I had some other plans for the module, like displaying host inventory and complete inventory to help understand inventory and facts modules, but that would require an action-plugin for transfering inventory information etc... And I am not sure this is wanted/best done in a module.
2012-10-04 09:50:18 +02:00
Jan-Piet Mens
9ed59da294 Allow user-specified $ansible_managed string with named parameters 2012-10-04 08:50:51 +02:00
Tim Bielawa
9f6da7b885 Fix variable injection in pause module args. Closes #1209 2012-10-03 23:52:26 -04:00
Michael DeHaan
761330b125 Fix module formatter indexing 2012-10-03 23:31:50 -04:00
Michael DeHaan
94546831b4 Typo fix/rebuild 2012-10-03 23:31:19 -04:00
Michael DeHaan
348b49c166 Fix typo 2012-10-03 23:27:43 -04:00
Michael DeHaan
88433eb93f Fix typo / rebuild 2012-10-03 21:00:27 -04:00
Michael DeHaan
826c71fcb1 Fix patterns typo, rebuild 2012-10-03 21:00:26 -04:00
Michael DeHaan
e170d7304b Added documentation on file force parameter 2012-10-03 20:57:36 -04:00
Michael DeHaan
a6f64a8e04 Merge pull request #1219 from tbielawa/move_modulepages
Library functions and modules should be in the 3 man page section. Also ...
2012-10-03 17:49:03 -07:00
Aleksej Romanov
01e922aa69 Indicate errors with exit code. 2012-10-04 03:11:14 +07:00
Tim Bielawa
85fb7c6d4b Library functions and modules should be in the 3 man page section. Also the files should end in '.3' 2012-10-03 10:18:55 -04:00
Michael DeHaan
8fa2070074 Merge pull request #8 from jpmens/rstlist
Makefile uses module_formatter now creates list of modules to include in .rst
2012-10-03 05:38:30 -07:00
Michael DeHaan
53d24ef002 Check in generated manpage documentation from modules 2012-10-02 22:46:49 -04:00
Michael DeHaan
046c6c66f2 various small doc tweaks 2012-10-02 22:43:46 -04:00
Michael DeHaan
ad5433b166 include version added info for individual fields 2012-10-02 22:36:27 -04:00
Michael DeHaan
f67aa85c3f Fixing various module related things. 2012-10-02 22:32:17 -04:00
Michael DeHaan
85a31616de Call os.path.expanduser in the creates= and removes= section of the command module so ~/ and the like works. 2012-10-02 22:12:49 -04:00
Michael DeHaan
b3548703f7 Merge pull request #1203 from dagwieers/fail-module
A fail module in order to fail execution on certain conditions
2012-10-02 19:07:38 -07:00
Michael DeHaan
d14741799a Merge pull request #1204 from dagwieers/fatal-red
Make fatal errors red
2012-10-02 19:06:36 -07:00
Michael DeHaan
459d9ea30d Merge pull request #1205 from dagwieers/ignore-cyan
Make ignored/skipped different from changed
2012-10-02 19:06:14 -07:00
Michael DeHaan
212296e59c Merge pull request #1207 from dagwieers/gather_facts-fix
Fix gather_facts assumption that SETUP_CACHE for a host is empty
2012-10-02 19:05:54 -07:00
Michael DeHaan
cef73d1545 Merge pull request #1202 from dagwieers/abort-play-abort-playbook
Abort a play at the start when no hosts matches, or no hosts are remaining
2012-10-02 19:02:27 -07:00
Dag Wieers
fedfd18774 Fix gather_facts assumption that SETUP_CACHE for a host is empty
We now check explicitely for 'module_setup' in the SETUP_CACHE in order to avoid skipping setup because SETUP_CACHE was populated some other way. Other modules can implement the same mechanism to test if they've already run.

This closes #1206.
2012-10-02 23:17:45 +02:00
Dag Wieers
f11ab4383a Make ignored/skipped different from changed
Since a skipped/ignored action is _very_ different from actual changes to a system, it always bothered me that  it was not easily distinguishable when skimming the output. This change makes ignore/skip a different color, and I chose cyan. Contemplated using dark-gray/blue, but prefered something that is readable with most terminal colors.
2012-10-02 21:49:04 +02:00
Dag Wieers
7acc0a632b Make fatal errors red 2012-10-02 21:45:42 +02:00
Dag Wieers
1d27909ec0 Added a fail module in order to fail execution on certain conditions
In some cases you may want to deliberately fail the execution of a playbook. In our provisioning workflow we want to have safeguards in place to avoid provisioning systems that are already in production. Since we reboot physical and virtual systems, it is mandatory we take all the precautions to prevent accidental provisioning.

So in our use-case we have the following at the very start of the provisioning playbook:

    ### Safeguard to protect production systems
    - local_action: fail msg="System is not ready to be staged according to CMDB"
      only_if: "'$cmdb_status' != 'to-be-staged'"

and we repeat the same task in the (separate included) play that takes care of (re)booting the system using our own boot-media, so that it cannot be accidentally separately run by someone.
2012-10-02 21:40:28 +02:00
Dag Wieers
20c1a67711 Abort a play at the start when no hosts matches, or no hosts are remaining
This change makes a distinction between no_hosts_matched and no_hosts_remaining.

In both cases we do not start facts-gathering, or run any tasks.

In the case that there are no more hosts remaining, we abort running tasks and abort the playbook.

I also cleaned up the leftovers from the previous patchsets, as these are no longer required.

This closes #1187.

Example playbook:

```yaml
---
- hosts: emptygroup
  tasks:
  - action: command date
  - action: command false

- hosts: all
  gather_facts: False
  tasks:
  - action: command ls
  - action: command false
  - action: command true

- hosts: all
  tasks:
  - action: command true
  - action: command false

- hosts: all
  tasks:
  - action: command pwd
```
2012-10-02 15:54:24 +02:00