Commit graph

2795 commits

Author SHA1 Message Date
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
Michael DeHaan
e1b1702616 Merge pull request #1201 from dhozac/setup-once-per-node
Only gather facts once per node per playbook run
2012-10-02 06:36:31 -07:00
Daniel Hokka Zakrisson
564a212b3c Only gather facts once per node per playbook run
Unless gather_facts: True is on the play
2012-10-02 15:30:19 +02:00
Michael DeHaan
56d45074af Merge pull request #1200 from broferek/master
Fix for issue #1194
2012-10-02 06:27:03 -07:00
Petetin Ludovic
17423c9268 Fix issue https://github.com/ansible/ansible/issues/1194 2012-10-02 15:12:33 +02:00
Michael DeHaan
9bab05bafc Merge pull request #1197 from dagwieers/utc-date
Make use of UTC dates for RPM timestamp
2012-10-02 05:32:10 -07:00
Dag Wieers
765061d445 Make use of UTC dates for RPM timestamp
So they can be shared/compared by people in different timezones
2012-10-02 14:29:57 +02:00
Michael DeHaan
4677699500 Merge pull request #1195 from jpmens/jtempl
Feature: file info on templates accessible to Jinja2 templates
2012-10-02 05:18:27 -07:00
Michael DeHaan
6616fba1ab Merge pull request #1189 from jpmens/nagpause
standardize DOCUMENTATION for nagios, pause
2012-10-02 05:15:56 -07:00
Jan-Piet Mens
5f04ef8b4c Feature: file info on templates accessible to Jinja2 templates
add ansible_managed
2012-10-02 14:15:27 +02:00
Michael DeHaan
7779da264d Merge pull request #1190 from jpmens/asy1
attempt at DOCUMENTATION for async_status
2012-10-02 05:15:21 -07:00
Jan-Piet Mens
a1f192976f attempt at DOCUMENTATION for async_status 2012-10-02 09:56:55 +02:00
Jan-Piet Mens
83029755f7 standardize DOCUMENTATION for nagios, pause 2012-10-02 09:15:11 +02:00
Michael DeHaan
f897f19fc5 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
14f7c85ce7 Include a space and a colon after prompts, so you don't have to put them in yourself. Consistent with documented behavior in examples/playbooks/prompts.yml 2012-10-01 22:15:34 -04:00
Michael DeHaan
b90eccc4f8 Merge pull request #1186 from dhozac/varreplacewi-nonstr
Allow non-string types in with_items variables
2012-10-01 19:10:05 -07:00
Michael DeHaan
2165351f2c Merge pull request #1185 from tbielawa/pause_docs
Add DOCUMENTATION to pause task
2012-10-01 19:09:24 -07:00
Michael DeHaan
b2ad63a860 Merge pull request #1183 from tbielawa/nagios_docs
Add DOCUMENTATION to nagios module.
2012-10-01 19:08:58 -07:00
Michael DeHaan
5683277e4a Be smarter about when to abort a playbook -- if it's early, we just didn't match any hosts, so keep on, hosts might be dynamic. 2012-10-01 22:07:08 -04:00
Tim Bielawa
ca87fa56d8 Add DOCUMENTATION to pause task 2012-10-01 12:42:03 -04:00
Tim Bielawa
f3d9f8da7b Add DOCUMENTATION to nagios module. 2012-10-01 12:26:57 -04:00
Michael DeHaan
35de8da108 Merge pull request #1180 from dhozac/remove-debug-print
Remove debug print statement
2012-10-01 08:24:21 -07:00
Daniel Hokka Zakrisson
48c5d696d2 Remove debug print statement 2012-10-01 17:23:21 +02:00
Michael DeHaan
f785f1ea15 Merge pull request #1179 from dhozac/fix-per-task-mv
Give each task its own module_vars
2012-10-01 08:19:43 -07:00
Daniel Hokka Zakrisson
a83aa1071b Give each task its own module_vars
Otherwise each task will overwrite the previous' items, among
other things.
2012-10-01 17:17:39 +02:00
Daniel Hokka Zakrisson
695b4bcb46 Allow non-string types in with_items variables 2012-10-01 17:07:51 +02:00
Michael DeHaan
886a17853f Merge pull request #1176 from jpmens/fireball-doc1
fireball DOCUMENTATION
2012-10-01 05:46:02 -07:00
Jan-Piet Mens
f2dc815e3f fireball DOCUMENTATION
- amended
2012-10-01 14:39:15 +02:00
Michael DeHaan
6600f7b7ac Merge pull request #1170 from jpmens/docspatch01
Jumbo DOCUMENTATION patch
2012-10-01 05:19:16 -07:00
Michael DeHaan
ac3ec0a410 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
Michael DeHaan
b86dc96d55 Merge pull request #1174 from jpmens/docs-authors
Added missing attribution to all module DOCUMENTATION strings
2012-10-01 05:14:44 -07:00
Jan-Piet Mens
a72a6e42c5 Added attribution to all module DOCUMENTATION strings 2012-10-01 12:37:51 +02:00
Daniel Hokka Zakrisson
6477bdc6fc 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
e620fed755 Jumbo DOCUMENTATION patch 2012-10-01 09:18:54 +02:00
Michael DeHaan
880328c10f organize changelog 2012-09-30 21:33:38 -04:00
Michael DeHaan
31a4fe412f Complain when modules do not have documentation. 2012-09-30 21:10:07 -04:00
Michael DeHaan
a2f76c1c69 If all hosts in a play fail, fail the whole playbook and don't bother printing out every remaining task. 2012-09-30 21:06:00 -04:00
Michael DeHaan
22f3aef4dc remove test for private function that is no longer present 2012-09-30 20:49:16 -04:00
Michael DeHaan
19b78cedc8 Abort a play when there are no more hosts in it. 2012-09-30 20:48:35 -04:00
Michael DeHaan
5846c1b8c4 Merge pull request #1125 from dagwieers/setup-retain
Make sure we retain facts between playbooks
2012-09-30 17:18:40 -07:00
Michael DeHaan
d0eba79760 Template out sudo_user so you can pass in variables using --extra-vars 2012-09-30 20:11:51 -04:00
Michael DeHaan
8e9344eef7 add an error when user tries to async something that can't be asynced 2012-09-30 20:06:55 -04:00
Michael DeHaan
d9bc01f443 Merge pull request #1169 from jpmens/modformatter01
module_formatter can output lists of files to process (.rst and .tex)
2012-09-30 12:59:18 -07:00
Michael DeHaan
635689b3af Merge pull request #1168 from sfromm/issue1007
Add message reporting skipped action in cli callback
2012-09-30 12:56:28 -07:00
Jan-Piet Mens
eb8a11237c module_formatter can output lists of files to process (.rst and .tex) 2012-09-30 19:07:40 +02:00