Ansible Week

Hi,

First of all thank you for creating Ansible. I've been working on a few scripts this past week and I have a few questions / feedback.

[1] Module defaults
One of my scripts installs a couple of packages via Aptitude. For every call I have to specify the update check interval and that I don't want to install recommended packages. Yes I could merge these commands into one big apt-module call, but I like the separate steps. With version 1.8.1 args: now accepts a variable, but I have to repeat that over and over. It would be great if I could specify something like "module_defaults" at the top and write "apt: <default args>" (key: module name, value: dict of args).

[2] YAML-friendly variable notation
Quite often I forget to wrap variables in quotes because of the brackets and the YAML parser gets confused. Perhaps a pre-parse could make this a bit friendlier or a different choice of variable notation? Perhaps look at JSON to replace YAML (similar to Gulp files), all the cool kids are doing it :wink:

[3] Shortcut to this task
If you want to check the stdout of the task for a specific text to report it as changed you have to register it as a variable. It would be nice if an task was by default registered to "this" for the scope of the task (so that you can check this.stdout).

[4] Silent variable assignment
In my deployment script I want to generate a folder name based on the current date. For this I have to make a set_fact task which isn't particulairly interesting during execution. The same applies to tasks with the stat module.

[5] When "skipped" and when "ok"?
In my script I install RVM and add "creates=~/.rvm" to prevent the install in consecutive runs. Ansible reports this as "skipping" the step. I'd rather report it as "ok", because just like my apt packages RVM is now present. How can I control the "when" and "creates" directives to output "ok"?

Thank you.

With regards to point 5, I noticed that Ansible 1.8.1 no longer reports "creates=" as "skipped". So that's great. Is there an option we can use to report "when:" as "ok" too?

About [2]: of your file starts with { or [ it’s parsed as JSON, so if you can use it (if you can stand it ;-))

Yvo van Beek yvo@codegazer.com napisał:

Thomasz nice, but what does the syntax look like :)?

changed_when: False

Changed_when will report the task never as changed right?
My goal is to to use “when”, but to report it as “ok” or “changed”, but never as “skipped”.

Changed_when will report the task never as changed right? My goal is
to to use "when", but to report it as "ok" or "changed", but never as
"skipped".

Yeah; I can think of use cases for all of "I don't want to see skipped
things", "I don't want to see ok things", and "I don't want to see changed
things", and the various combinations of those. It'd be great if the
output plugin had options to configure each of those, ideally at various
levels, so you could set one globally, override it for a play, override it
for a task, etc...

                                      -Josh (jbs@care.com)

This email is intended for the person(s) to whom it is addressed and may contain information that is PRIVILEGED or CONFIDENTIAL. Any unauthorized use, distribution, copying, or disclosure by any person other than the addressee(s) is strictly prohibited. If you have received this email in error, please notify the sender immediately by return email and delete the message and any attachments from your system.

Changed_when with the same conditional as used on the when will basically do that.

It’s definitely a minority use case, but it will work.