Commit graph

700 commits

Author SHA1 Message Date
Dag Wieers
b64821d543 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
Michael DeHaan
1bd1e3ed1f Added documentation on file force parameter 2012-10-03 20:57:36 -04:00
Michael DeHaan
d404737543 various small doc tweaks 2012-10-02 22:43:46 -04:00
Michael DeHaan
2d096ea425 Fixing various module related things. 2012-10-02 22:32:17 -04:00
Michael DeHaan
f3e8ffce43 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
Dag Wieers
2886084ac0 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
Petetin Ludovic
e3cb4163a9 Fix issue https://github.com/ansible/ansible/issues/1194 2012-10-02 15:12:33 +02:00
Michael DeHaan
873013363c Merge pull request #1189 from jpmens/nagpause
standardize DOCUMENTATION for nagios, pause
2012-10-02 05:15:56 -07:00
Jan-Piet Mens
c01354d12d attempt at DOCUMENTATION for async_status 2012-10-02 09:56:55 +02:00
Jan-Piet Mens
d27706f7c5 standardize DOCUMENTATION for nagios, pause 2012-10-02 09:15:11 +02:00
Michael DeHaan
ef7811e4d4 Teach fireball mode to disable the fireball by paying attention to 'minutes=N' (default 30) and do not let fireball module crash
on input.
2012-10-01 22:41:00 -04:00
Michael DeHaan
413a03f723 Merge pull request #1185 from tbielawa/pause_docs
Add DOCUMENTATION to pause task
2012-10-01 19:09:24 -07:00
Tim Bielawa
6f7b3e9907 Add DOCUMENTATION to pause task 2012-10-01 12:42:03 -04:00
Tim Bielawa
3eff193e4c Add DOCUMENTATION to nagios module. 2012-10-01 12:26:57 -04:00
Michael DeHaan
ac4d62d4dc Merge pull request #1176 from jpmens/fireball-doc1
fireball DOCUMENTATION
2012-10-01 05:46:02 -07:00
Jan-Piet Mens
8baea3d38a fireball DOCUMENTATION
- amended
2012-10-01 14:39:15 +02:00
Michael DeHaan
2f14545f2c Merge pull request #1170 from jpmens/docspatch01
Jumbo DOCUMENTATION patch
2012-10-01 05:19:16 -07:00
Michael DeHaan
0f83fefeda Merge pull request #1173 from dhozac/command-quote-less
Use a regexp to filter out arguments instead
2012-10-01 05:17:29 -07:00
Jan-Piet Mens
a790c399f4 Added attribution to all module DOCUMENTATION strings 2012-10-01 12:37:51 +02:00
Daniel Hokka Zakrisson
98be6a328b Use a regexp to filter out arguments instead
pipes.quote is a bit overzealous for what we want to do, quoting ;
and other characters that you most likely want to use in your shell
invocations. The regexp is the best I could come up with to be able
to only replace the parts of the arguments that shouldn't be
executed.
2012-10-01 12:13:17 +02:00
Jan-Piet Mens
c78a0a4a49 Jumbo DOCUMENTATION patch 2012-10-01 09:18:54 +02:00
Michael DeHaan
d7ee918419 Merge pull request #1167 from jpmens/slurp01
module docs for slurp
2012-09-30 08:15:19 -07:00
Jan-Piet Mens
a722e4fc79 module docs for slurp 2012-09-30 16:58:15 +02:00
Michael DeHaan
85b98abe33 Merge pull request #1166 from mavimo/documentation-seboolean
Added DOCUMENTATION to seboolean module.
2012-09-30 06:44:02 -07:00
Marco Vito Moscaritolo
054f99b10d Added DOCUMENTATION to seboolean module. 2012-09-30 15:41:00 +02:00
Michael DeHaan
20da86d1fd Merge pull request #1165 from mavimo/documentation-selinux
Added DOCUMENTATION to selinux module.
2012-09-30 06:36:27 -07:00
Michael DeHaan
51dbc211a0 Merge pull request #1164 from jpmens/modformatter
module_formatter now also uses Jinja2 trim_blocks
2012-09-30 06:36:09 -07:00
Marco Vito Moscaritolo
6cf1c78335 Added DOCUMENTATION to selinux module. 2012-09-30 15:34:26 +02:00
Jan-Piet Mens
4c57b1672e module_formatter now also uses Jinja2 trim_blocks
- Updated man template accordingly
- seem to have left in illegal char in facter DOCUMENTATION...
2012-09-30 15:06:18 +02:00
Jan-Piet Mens
a804eb8866 template DOCUMENTATION added to fireball 2012-09-30 14:50:32 +02:00
Jan-Piet Mens
4a4979314f Attribute author of virt correctly (sorry) 2012-09-30 14:08:47 +02:00
Michael DeHaan
5b8e8ca395 Merge pull request #1156 from jpmens/m-docs5
DOCUMENTATION for virt
2012-09-30 04:59:24 -07:00
Michael DeHaan
4b911a237c Merge pull request #1155 from jpmens/m-docs4
DOCUMENTATION for fetch,mount,ohai,easy_install; .rst template tweaks
2012-09-30 04:57:50 -07:00
Michael DeHaan
b7571f56c2 Merge pull request #1152 from sfromm/moduledocs
Add module documentation for git, group, service, and user
2012-09-30 04:56:37 -07:00
Jan-Piet Mens
a692b4bba2 DOCUMENTATION for virt 2012-09-30 12:40:11 +02:00
Jan-Piet Mens
eef198144f DOCUMENTATION for fetch,mount,ohai,easy_install
- .rst now supresses default if none is set (looks better in HTML)
  - .rst now handles empty options list
  - Fixed postgresql_user and mysql_user because YAML contained colons
  - docs for facter
2012-09-30 12:29:32 +02:00
Stephen Fromm
c0d2d76fe9 Add LSB facts, as derived from lsb_release -a
This gathers LSB facts via lsb_release.  This complements the
platform facts collected via the platform module.  This reoprts
release, id, description, release, and codename.  It also adds
'major_release', which is the major version number of a distribution.
2012-09-29 23:58:04 -07:00
Stephen Fromm
f5d39b8677 Add module documentation for git, group, service, and user 2012-09-29 23:50:25 -07:00
Michael DeHaan
b28ee354ca Merge pull request #1146 from dhozac/command-escape-args
Properly parse escaped special arguments
2012-09-29 16:25:37 -07:00
Michael DeHaan
59ace14dbc Merge pull request #1140 from mavimo/devel
Refs #1116: DOCUMENTATION string update
2012-09-29 13:26:42 -07:00
Michael DeHaan
34bb2a3abe Merge pull request #1145 from mavimo/documentation-supervisorctl
Added DOCUMENTATION to supervisorctl module.
2012-09-29 13:23:54 -07:00
Michael DeHaan
2e98c34686 Merge pull request #1144 from mavimo/documentation-pip
Added DOCUMENTATION to pip module.
2012-09-29 13:23:41 -07:00
Daniel Hokka Zakrisson
10d31fa872 Properly parse escaped special arguments
Fixes issue #1134
2012-09-29 21:05:49 +02:00
Marco Vito Moscaritolo
1637a05846 Fixed error in author name 2012-09-29 21:04:17 +02:00
Marco Vito Moscaritolo
35f6d71057 Added DOCUMENTATION to supervisorctl module. 2012-09-29 21:02:07 +02:00
Marco Vito Moscaritolo
f47530b044 Added DOCUMENTATION to pip module. 2012-09-29 20:53:28 +02:00
Marco Vito Moscaritolo
549bf4f07a Added DOCUMENTATION to shell module. 2012-09-29 20:40:06 +02:00
Marco Vito Moscaritolo
ea7f457c46 Fixed error on official docs (reported on DOCUMENTATION string). Name param must be pkg and is required. 2012-09-29 18:23:13 +02:00
Marco Vito Moscaritolo
babb2454c6 Added DOCUMENTATION to postgresql_user module. 2012-09-29 16:46:30 +02:00
Marco Vito Moscaritolo
0a263aea56 Added DOCUMENTATION to postgresql_db module. 2012-09-29 16:46:13 +02:00