Commit graph

165 commits

Author SHA1 Message Date
Serge van Ginderachter
94028852d9 Make debug module always verbose in playbooks
Created a new flag 'verbose_always' handled by
on_ok callback, similar to the 'verbose_override'
flag used by the setup module.
2013-05-25 00:27:23 +02:00
Michael DeHaan
cd57d59913 If ansible is configured to use a log file but cannot write to it, exit, but don't traceback. 2013-05-19 20:05:04 -04:00
Brian Coca
8dd72d2828 changed lockfile to be opened in write mode (solaris for one doesn't like
exclusive locks on read)
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
2013-05-15 16:56:20 -04:00
Michael DeHaan
2a091a3505 Remove duplicate import. 2013-05-11 17:26:47 -04:00
Michael DeHaan
ea8302e68d Indentation. 2013-05-11 17:24:40 -04:00
James Cammarata
2440861b1b BUGFIX - --start-at-task= works only with --step
From issue #2820, --start-at-task does not actually run tasks
unless --step is specified. This appears to be because skip_task
is being evaluated as True in PlayBook._run_task(). This patch
ensures skip_task is set to False in the callback.
2013-05-05 11:05:32 -05:00
Michael DeHaan
e90023281d Slightly refine log output to include username in addition to pid. 2013-04-28 20:57:32 -04:00
Matt Coddington
3b8f69bac8 add pid to log 2013-04-27 13:00:02 -04:00
Michael DeHaan
bcac289667 Cows don't need to display brackets around strings. 2013-04-27 11:50:53 -04:00
Michael DeHaan
b8fdcff524 Merge branch 'nocows' of git://github.com/jpmens/ansible into devel
Conflicts:
	lib/ansible/callbacks.py
	lib/ansible/constants.py
2013-04-27 11:34:39 -04:00
Michael DeHaan
aa55268514 Adds a logfile for ansible playbooks that can be set by the environment or configuration file. 2013-04-27 10:24:26 -04:00
Michael DeHaan
515fbd5a17 Restructure output to prevent rare cases of interlaced I/O in multiprocessing paths. 2013-04-27 09:46:48 -04:00
Jan-Piet Mens
dfd885a012 Make ANSIBLE_NOCOWS configurable
nocows = 1 in ansible.cfg
	or old environment variable ANSIBLE_NOCOWS=1
add to ansible.cfg example
2013-04-23 16:43:23 +02:00
Michael DeHaan
53ac0bbec2 Instantiate callback plugins only once so we can set play/task objects on them and they'll stick. 2013-04-20 09:09:35 -04:00
Seth Vidal
690738ea32 implement --start-at-task option to hop to a specific task before starting running them 2013-04-09 01:53:40 -04:00
Michael DeHaan
00252353b9 Decided I liked the asterisks 2013-04-06 18:58:55 -04:00
Michael DeHaan
bc0be456da Modify output banners to have constant length and use dashes instead
of "-" to be less visually heavy (unless cowsay is installed of course)
2013-04-06 18:52:30 -04:00
Michael DeHaan
e9d11173cd Remove obsolete comment 2013-04-06 18:38:31 -04:00
Seth Vidal
a7a083d882 when --step isn't specified make sure to print the banner 2013-03-11 09:48:32 -04:00
Seth Vidal
7687c2caf8 add --step option to ansible-playbooks to let people step through a playbook
one by one - asking for confirmation along the way.

also allows to 'continue' after a certain point
2013-03-11 00:39:05 -04:00
Michael DeHaan
c92bfb7234 Merge branch 'madcow2' of git://github.com/bcoca/ansible into devel 2013-03-01 16:23:41 -05:00
Jimmy Tang
81a34c2d1d Cowsay on OSX macports 2013-03-01 16:51:13 +00:00
Stephen Fromm
fa07604d43 Fix CliRunnerCallbacks.on_file_diff in callbacks.py
When running ansible -C, I get a traceback that ends with
    AttributeError: Values instance has no attribute 'diff'
This fixes on_file_diff to behave similar to
PlaybookRunnerCallbacks.on_file_diff().
2013-02-27 13:26:29 -08:00
Brian Coca
e9907e9c8a added random cow pick through ANSIBLE_COW_SELECTION env var
Signed-off-by: Brian Coca <bcoca@tablethotels.com>
2013-02-26 22:41:01 -05:00
Stoned Elipot
10e9f1fc1e Implement --diff for the copy module. 2013-02-25 23:32:52 +01:00
Michael DeHaan
c4779d95b8 Removing unused import, 'make pyflakes' is now clean. 2013-02-17 19:49:50 -05:00
Blair Zajac
fa8e653011 Simplify and correct comparisons with None. 2013-02-16 13:32:48 -05:00
Michael DeHaan
72a05ae2a0 Move diff code more into runner code. 2013-02-09 23:24:03 -05:00
Michael DeHaan
a9162a86f2 Very basic --diff option for showing what happens when templates change.
Probably output is not useful if not used with --limit

Works well with --check mode
2013-02-07 22:52:25 -05:00
Rodney Quillo
395093e0bf Move default arguments to the end of the function call. 2013-01-19 08:34:47 +08:00
Rodney Quillo
7ae100611c Adding default on vars_prompt 2013-01-18 19:00:57 +08:00
Dag Wieers
cd930d2e34 Change message when a play matches no hosts
I guess my previous pull request was confusing, by changing the message to something we already do for tasks, it makes it more clear.

Just like we say:

    TASK: [foo bar]
    skipping: [system01]

The message now is more clear:

    PLAY [wagawaga] *******************************
    skipping: no hosts matched

It makes it clear that we are skipping the play, just as is done for a task when a condition is not met.
2012-12-13 13:31:41 +01:00
Dag Wieers
d42eb2563b Make --oneline return one line (except with multiline output)
Currently the message prepared for --oneline mode adds a newline to the msg-string, which is then printed (adding another newline). This change removes the added newline so that successes and failures do not differ in output (except if the output is multiline).
2012-11-08 14:49:40 +01:00
Daniel Hokka Zakrisson
e05e514861 Create a plugin loader system 2012-11-02 01:24:14 +01:00
Lorin Hochstein
1c5ac5cac8 Pretty-print "msg" when task fails
Several modules (e.g., pip) return stdout and stderr together in a "msg" variable (and the module development docs seem to suggest that the standard practice is to return status in this variable).

This change ensures that it is printed out with correct formatting (most importantly, with newlines appearing as newlines instead of \n).
2012-11-01 13:23:18 -04:00
Michael DeHaan
8c3abe7e52 Fix cowsay! Moo. 2012-10-16 20:01:12 -04:00
Michael DeHaan
f3407dec0e Merge branch 'basedir-plugins' of git://github.com/dhozac/ansible into devel 2012-10-16 18:00:55 -04:00
Brian Coca
e98153d26d cowsay for BSD!
Signed-off-by: Brian Coca <briancoca+ansible@gmail.com>
2012-10-15 10:17:21 -04:00
Daniel Hokka Zakrisson
ab44a4abba Load additional plugins from path specified in configuration 2012-10-14 21:09:24 +02:00
Daniel Hokka Zakrisson
1aaf86069a Look for plugins in the playbook's basedir 2012-10-14 21:09:23 +02:00
Jan-Piet Mens
051f66cf16 Not for cow lovers: optionally disable cowsay
spaces now cow-compatible
2012-10-07 11:23:42 +02: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
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
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
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
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
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
Stephen Fromm
cf3e368d15 Add message reporting skipped action in cli callback 2012-09-30 08:54:20 -07:00
Michael DeHaan
c63189f650 Make output be cleaner on multi-line failed commands and parse errors. 2012-09-25 20:38:12 -04:00
Michael DeHaan
8e71b26264 Fix up 'changed' playbook output patch 2012-09-25 08:07:11 -04:00
Dane Summers
04c535b1e9 Modified 'ok' to 'changed' when a change has occured 2012-09-24 16:07:56 -04:00
Michael DeHaan
633e513a65 Modular server-side actions (squash merge) 2012-09-06 18:57:04 -04:00
Michael DeHaan
f41d3b9bd2 Fix skipped callback 2012-09-04 21:56:32 -04:00
Michael DeHaan
96f257cea1 Fix invocation-output-supression code to still provide invocation data to the callbacks. 2012-09-04 21:16:12 -04:00
Daniel Hokka Zakrisson
7a201dbb2e Keep result pristine for ignore_errors 2012-09-04 22:40:07 +02:00
Michael DeHaan
c04f00e3a6 Fix async callback 2012-09-02 11:20:56 -04:00
Daniel Hokka Zakrisson
2d448f2a34 Invoke cowsay without going through the shell 2012-08-30 00:11:40 +02:00
Ludovic Claude
b0a4a9e188 Issue #935: filter out __init__ module from the list of callbacks 2012-08-23 20:26:27 +02:00
Michael DeHaan
3de4e45741 Move plugin directories 2012-08-21 20:32:21 -04:00
Michael DeHaan
bf92a9e4e0 Store invocation differently from an API perspective, but hide in callbacks 2012-08-20 20:41:53 -04:00
Grzegorz Nosek
94f56614e7 Fix UTF-8 output when using executable inventory files
The 'hostname' variable is then unicode, which breaks interpolating
stdout etc. contents into the output strings (they are bytes and cannot
be converted to Unicode using ASCII codec)
2012-08-20 18:26:21 -04:00
Michael DeHaan
3017dc92d9 make callbacks modular 2012-08-18 19:43:08 -04:00
Michael DeHaan
0579b8b4e6 The command module was not reporting on errors like the other modules when the module failed
to parse or return other valid output.  This is a slight improvement.
2012-08-16 21:44:59 -04:00
Michael DeHaan
72faf8eb0a fix indents 2012-08-11 12:20:16 -04:00
Rodney Quillo
d1f821361d vars_prompt encrypt from mgw 2012-08-09 22:56:40 +08:00
Michael DeHaan
85ba71a7fe Split -vv from -vvv 2012-08-08 21:16:48 -04:00
Michael DeHaan
846186e2fc Add -vvv support for debugging activity 2012-08-08 21:09:14 -04:00
Michael DeHaan
faed4b5a33 whitespace + remove deprecated YAML parser (migration script lives in examples/scripts and warning was added
in 0.6 release)
2012-08-06 20:07:02 -04:00
Michael DeHaan
227dfc17f3 fix tree output 2012-08-02 20:42:32 -04:00
Seth Vidal
f924c96370 remove the tab I found
DIE TAB DIE
pep8
2012-08-02 17:26:04 -04:00
Petros Moisiadis
2ac4acbf97 fixes for tests 2012-08-01 22:17:16 +03:00
Petros Moisiadis
5f4bf813b1 added an 'ignore_errors' option to tasks
Failed tasks with ignore_errors=True, allow the remaining tasks in the
play to be executed as if no failure happened. A failure notice is still
written to the output as well as an '...ignoring' message.
2012-08-01 19:13:07 +03:00
Petros Moisiadis
c717934b7e Improved 'vars_prompt' syntax to support prompt text and (non-)private input
An example of the new syntax:

vars_prompt:
 - name: 'secret_variable_name"
   prompt: "Enter secret value: "
   private: "yes"
 - name: "nonsecret_variable_name"
   prompt: "Enter non-secret value: "
   private: "no"
2012-07-27 19:00:48 -04:00
Michael DeHaan
e035ce97ce blue on black, tears on a river, push on a shove, it don't mean much
(make colorized playbook runs not suck on black terminals)
2012-07-25 20:31:26 -04:00
Michael DeHaan
8d7f526df6 importing/not-importing methods should be colorized 2012-07-24 20:41:24 -04:00
Michael DeHaan
d3e8e8ff54 Fix output message 2012-07-24 20:37:27 -04:00
Michael DeHaan
263432daa1 Changed no hosts to red. Not sure this is the right color choice, but there is no orange :) 2012-07-24 20:21:49 -04:00
Michael DeHaan
15062b38e1 Fix typo 2012-07-24 19:50:16 -04:00
Michael DeHaan
12ff9b5b9a Move color coding bits to module, use over rest of playbook 2012-07-24 19:30:02 -04:00
Timothy Appnel
4b9b9a8a5b Importing re in runner for doing conditional tasks using pattern matching i.e. re.search(). Also conditionally outputting item when skipping. 2012-07-23 19:36:26 -04:00
Michael DeHaan
d72c0c8898 replace module daisy-chaining logic 2012-07-20 08:57:50 -04:00
Derek Carter
34e2584220 improved output in with_items fixes: #627 2012-07-20 14:01:54 -04:00
Dave Hatton
c3205595b3 format fixes to make fetch more usable 2012-07-16 11:43:37 +01:00
Michael DeHaan
1754de3335 Misc code cleanup, mostly whitespace preferences, removing unused imports, plus a few fixes here and there. 2012-07-15 12:29:53 -04:00
Michael DeHaan
867b2437cc consolidate output code in callbacks.py, from utils, remove extra functions 2012-07-15 10:12:49 -04:00
Michael DeHaan
68a9adc1be Indentation cleanup (partial) 2012-07-15 09:32:47 -04:00
Michael DeHaan
706cfd9ade Misc cleanup -- moved function out of utils, removed debug statement. 2012-07-15 08:50:23 -04:00
Michael DeHaan
279b5965b8 Much streamlining around setup steps in playbooks, now only run setup once per play. 2012-07-14 12:24:19 -04:00
Ingo Gottwald
26aa4e2469 Enabled cowsay support for Ubuntu 2012-07-12 11:14:15 +02:00
Dave Hatton
7ecdb83800 improve output formating for playbook 2012-07-11 09:35:10 +01:00
Michael DeHaan
efac68b636 Remove the -D module debug flag, which no longer is functional due to sudo pty requirements, and replace with -v/--verbose.
This flag will show playbook output from non-failing commands.  -v is also added to /usr/bin/ansible, but not  yet used.

I also gutted some internals code dealing with 'invocations' which allowed the callback to know what module invoked
it.  This is not something 0.5 does or needed, so callbacks have been simplified.
2012-06-19 21:57:43 -04:00
Michael DeHaan
0972b761de Leverage cowsay if installed. 2012-05-30 19:44:00 -04:00
Michael DeHaan
6d580aea02 As part of a precursor to other refactoring, make returns less list-like throughout runner. 2012-05-25 18:44:29 -04:00
Jeroen Hoekx
f14c1e3e91 Async: print one poll message per polling cycle.
Instead of one per host per polling cycle.
2012-05-01 18:38:26 -04:00
Jeroen Hoekx
ce9a8c9ffc Introduce Async API in Runner. 2012-05-01 18:38:26 -04:00
Michael DeHaan
36e454c52f Because paramiko using a pty can't distinguish stderr and stdout, remove handling that
treated -D as a way to show stderr, and make sure modules don't include things on stderr.
Update docs and test module script to come into line.
2012-04-27 01:25:38 -04:00
Michael DeHaan
c00699d0ef Merge branch 'integration'
Conflicts:
	lib/ansible/playbook.py
	lib/ansible/runner.py
	library/apt
2012-04-23 21:05:06 -04:00
Michael DeHaan
321ed53e3a Fetch module doesn't set invocation parameter as it invokes nothing, so don't let that be an error. 2012-04-23 21:02:39 -04:00