Re: [ansible-project] skip a task with_subelements if its dictionary is undefined

2014-08-20 Thread C. Morgan Hamill
Excerpts from Michael DeHaan's message of 2014-08-20 08:51:01 -0400: > With a simple list, you can do stuff like: > > - shell: echo {{ item }} > with_items: alist_that_may_be_undefined | default([]) I'm fairly sure this works also: - shell: echo {{ item }} with_subelements: - some_

Re: [ansible-project] Target name question

2014-08-13 Thread C. Morgan Hamill
Excerpts from Tiglath's message of 2014-08-12 23:08:48 -0400: > Is the verbatim name still available (in another variable?) after assigning > a value to ansible_ssh_host ? 'inventory_hostname' should always refer to the primary name in the hosts file. -- Morgan Hamill -- You received this messa

Re: [ansible-project] Templated file used as variable?

2014-08-11 Thread C. Morgan Hamill
Excerpts from AJ Daws's message of 2014-08-08 17:30:33 -0400: > Michael, no need to apologize, you've already helped a lot, thank you! > > One thing that would really help here and is general enough I'm sure it > would find use elsewhere as well is to have the template module capable of > outp

Re: [ansible-project] How do I recursively set directory/file permissions

2014-07-30 Thread C. Morgan Hamill
Excerpts from Michael DeHaan's message of 2014-07-30 07:51:22 -0400: > The general situation is that change detection on a tree of 5000 files > would be remarkably slow. People think they want that, they do not. Just though I'd point out that there is a pull request for this: https://github.com/a

Re: [ansible-project] Module argument syntax styles?

2014-07-25 Thread C. Morgan Hamill
Excerpts from Steffen Prince's message of 2014-07-25 03:24:19 -0400: > Pros and cons of module argument syntax styles? > > INI style > > - module: > > key1=val1 > key2=val2 > key3=val3 > key4=val4 > > > yaml style > > - module: > key1: val1 > key2: val2 > k

Re: [ansible-project] Best way to import ENV variables with defaults

2014-07-18 Thread C. Morgan Hamill
Excerpts from Michael DeHaan's message of 2014-07-18 09:21:53 -0400: > The lookup plugin will return empty string, not None, if that env is not > found. > > However that is still False in Python. That's curious and may be related > to how "default" is implemented. Will have to try that. Jinja

Re: [ansible-project] Input on module to resize filesystems.

2014-07-15 Thread C. Morgan Hamill
Excerpts from Michael DeHaan's message of 2014-07-15 11:37:33 -0400: > Can you share more about what the proposed syntax might be for this flag > (such as an example playbook line?) That's actually where I run into trouble; the filesystem module's arguments and their semantics don't leave a lot of

[ansible-project] Input on module to resize filesystems.

2014-07-15 Thread C. Morgan Hamill
I have need of this. Should I add this ability to the existing `filesystem` module, or do folks think it ought to be a separate module? -- Morgan -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receivi

Re: [ansible-project] --skip-tags equivalent inside playbooks

2014-07-09 Thread C. Morgan Hamill
Excerpts from Dmitry Makovey's message of 2014-07-08 18:49:22 -0400: > Hi everybody, > > http://docs.ansible.com/playbooks_tags.html mentions several ways to use > tags, one of which is: > > - { role: A, tags: [t1, t2] } This doesn't do what you think it does. It applies tags 't1' and 't2' to

Re: [ansible-project] task includes with facts

2014-06-13 Thread C. Morgan Hamill
Excerpts from Oliver Heinz's message of 2014-06-13 04:58:32 -0400: > But there is no smart way to decide which tasks to run based on facts - > just because the YAML syntax checker raises an error because a variable is > not defined (yet) and thus a play that is perfectly valid at runtime is > co

Re: [ansible-project] Ansible RPM version

2014-06-09 Thread C. Morgan Hamill
Excerpts from James Cammarata's message of 2014-06-07 21:14:41 -0400: > We are planning on doing this at some point in the (hopefully near) future, > for both yum and apt. Not entirely on-topic, but it's a "thing" of mine: Thank you all *so much* for having functioning distribution packages from

Re: [ansible-project] Setting dir vs file permissions with file "recurse=yes"

2014-06-05 Thread C. Morgan Hamill
This was submitted quite a while ago, perhaps it could be merged? -- Morgan Hamill -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...

Re: [ansible-project] with_items and array concatenation?

2014-06-05 Thread C. Morgan Hamill
Excerpts from Dmitry Makovey's message of 2014-06-04 18:17:04 -0400: > Winning combination turned out to be: > > ( groups['A']+groups['B'] ) | unique > > I do like how simple it looks vs > > ( groups['A']|union (groups['B']))| unique Just FYI, the 'unique filter in the latter form is redundant

Re: [ansible-project] include another role's variables without running it's tasks?

2014-05-28 Thread C. Morgan Hamill
For what it's worth, I simply follow this rule: if data needs to be accessed from outside a role, then it should go in inventory somewhere (e.g., group_vars/foo or group_vars/all/foo). My 2ยข. -- Morgan Hamill -- You received this message because you are subscribed to the Google Groups "Ansible

Re: [ansible-project] Substitution inside lookup plugin

2014-04-30 Thread C. Morgan Hamill
Excerpts from Brian Coca's message of 2014-04-30 10:49:17 -0400: > "{{ lookup('file', 'keys/ssh.' + item.username + '.pub') }}" I'd add that, in the general case, you'll want to do: {{ lookup('file', 'keys/ssh.' ~ item.username ~'.pub') }} Using the tilde concatenation operator casts values

Re: [ansible-project] Is there a way to used dot-nested vars with 'default' filter in jinja2 templates?

2014-04-24 Thread C. Morgan Hamill
Not positive if this will work, but try: Excerpts from Kesten Broughton's message of 2014-04-24 10:06:13 -0400: > template.yml > {{ parentvar.childvar.subvar1 }} > {{ parentvar.childvar.get('subvar2', 'default for subvar2') }} -- Morgan Hamill -- You received this message because you are subscri

Re: [ansible-project] dealing with Redis and it's rewritten configuration files

2014-04-02 Thread C. Morgan Hamill
Excerpts from Bryan Larsen's message of 2014-04-02 08:42:55 -0400: > The problem with this is that Redis often rewrites its configuration files; > for example when a new master is elected. I haven't actually used Ansible to set up Redis, but I have run into software that does this, and I would no

Re: [ansible-project] roles and compound vars

2014-04-01 Thread C. Morgan Hamill
Excerpts from Adam Bozanich's message of 2014-03-31 21:50:25 -0400: > I had wanted to be able to pass an entire dict by name into a role, but > apparently that isn't possible. I *believe* recent versions of Ansible will allow: - { role: my role, myrolevars: "{{ some_dict_defined_elsewhere }}

Re: [ansible-project] using hostvars not resolving variables "calculated" from facts

2014-03-25 Thread C. Morgan Hamill
Excerpts from Matt Coddington's message of 2014-03-25 14:15:18 -0400: > > > {% for host in groups['uat4-webapp']|sort %} > > > BalancerMember ajp://{{ hostvars[host].webapp_ip }}:8009 loadfactor=20 > > > {% endfor %} > > > > > > The "webapp_ip" variable is calculated like this in a group_vars file:

Re: [ansible-project] using hostvars not resolving variables "calculated" from facts

2014-03-25 Thread C. Morgan Hamill
Excerpts from Matt Coddington's message of 2014-03-24 22:58:50 -0400: > Using Ansible 1.5.3 > > I'm having some trouble with a situation where I have a variable that I'd > like to use in a template that uses "hostvars" but the variable in question > is calculated from facts. > > I have a template

Re: [ansible-project] lininfile fails on line with colon in it

2014-03-19 Thread C. Morgan Hamill
Excerpts from Philippe Eveque's message of 2014-03-19 12:14:31 -0400: > lineinfile: > > dest=/etc/hosts.deny > state=present > regexp="^ALL:\s+ALL" > line="ALL: ALL" Thought I'd add how I handle this: lineinfile: dest: /etc/host.deny state: present regexp:

Re: [ansible-project] ERROR: AsciiDoc 'a2x' command is not installed but is required to build

2014-02-05 Thread C. Morgan Hamill
Excerpts from Adam Heath's message of 2014-02-05 13:24:48 -0500: > root@urk:~# apt-file search bin/a2x > asciidoc: /usr/bin/a2x > > And "yum search asciidoc" comes up with results. > > Does rpm.spec have a way to list a series of build dependencies? I'm a > Debian guy, and that would be done th

Re: [ansible-project] AnsibleWorks is now just Ansible!

2014-01-29 Thread C. Morgan Hamill
Excerpts from Michael DeHaan's message of 2014-01-29 09:48:25 -0500: > Technically, Ursula LeGuinn used it first -- though I still haven't read > that particular book from her just yet. Ahh, right, I forgot that she got to it first. > I am quite a fan of Ender's game though, and that's what I nam

Re: [ansible-project] AnsibleWorks is now just Ansible!

2014-01-29 Thread C. Morgan Hamill
Excerpts from Michael DeHaan's message of 2014-01-28 21:08:17 -0500: > When we started the company, Ansible wasn't quite available, so we named > the company AnsibleWorks. We've finally arranged things so it was possible > to change that, and have done so,and we're pretty excited about being able

Re: [ansible-project] Using tags + include

2013-12-03 Thread C. Morgan Hamill
Excerpts from BrianAI's message of 2013-12-03 06:08:08 -0500: > Yes, that much I knew / figured after reading and experimenting. > > So other that using that as a variable to call in the cron.yaml file > (which I think you referred to as a messy hack), is there anyway to > achieve the desired resu

Re: [ansible-project] module development: freestyle parameters

2013-12-02 Thread C. Morgan Hamill
Excerpts from Michael DeHaan's message of 2013-12-02 16:15:56 -0500: > This is overkill btw. > > Just do type='dict' in the argument_spec, Ansible knows what to do and > will take a dict or key=value strings inside the option. Right, should have specified: the code I posted is what allows the str

Re: [ansible-project] module development: freestyle parameters

2013-12-02 Thread C. Morgan Hamill
Third option, which I've done in a module for my own use: have an "extra_yum_flags" option which can take a dictionary as an argument: - yum: state: installed name: mypkg extra_yum_flags: foo: bar bam: baz red_hat: is an operating system I

Re: [ansible-project] Error in playbook causes handlers not to run

2013-12-02 Thread C. Morgan Hamill
Excerpts from Michael DeHaan's message of 2013-12-01 08:56:27 -0500: > "Okay, what about making ansible run any queued up handlers just before > exiting, even if it exits due to an error condition in a playbook?" > > Yep, that's what I was thinking of this morning. > > I still think we *may* want

Re: [ansible-project] Re: conditional question

2013-12-02 Thread C. Morgan Hamill
Michaels' answer is better in most cases, but there is another way which I occasionally use for simple things. In a vars file, do: foo: "{{ 'bar' if ansible_architecture == 'i386' else 'zoo' }}" Only thing to watch out for is that the jinja2 expression must always evaluate to *something*, so

Re: [ansible-project] Idempotent creation of AWS RDS ?

2013-11-27 Thread C. Morgan Hamill
Excerpts from Matt Jaynes's message of 2013-11-27 13:58:10 -0500: > Been googling around for the idempotent memo you mentioned - anyone have a > link? (or maybe it was a joke and I'm a little clueless?) :) See, it's clear that this mailing list is not nearly idempotent enough! It should be obviou

Re: [ansible-project] Advice on variable organization.

2013-11-22 Thread C. Morgan Hamill
Excerpts from James Tanner's message of 2013-11-22 09:31:37 -0500: > This already exists =) > > https://github.com/ansible/ansible/pull/4758 This is the best kind of surprise! -- Morgan Hamill -- You received this message because you are subscribed to the Google Groups "Ansible Project" group.

Re: [ansible-project] Advice on variable organization.

2013-11-22 Thread C. Morgan Hamill
Thanks so much for all the input, folks. Excerpts from Serge van Ginderachter's message of 2013-11-21 14:24:15 -0500: > Also at my current gig, playbooks and roles are very specific, and not > something I would share as to specific. Once I'd write things I would want > to share, I defiitely would

[ansible-project] Advice on variable organization.

2013-11-21 Thread C. Morgan Hamill
Howdy folks, I was hoping to get some tips on how best to organize variables in Ansible. Right now, I don't have hard-and-fast rules, but I'm generally sticking to the following patterns: * 'group_vars/all' contains any variables which I will need to access over and over, such as domain-le

Re: [ansible-project] Checking if a list is empty...

2013-11-21 Thread C. Morgan Hamill
Serge's response is fine but I believe you can also just do: > - { include: tasks/repo_server.yml, when: listen_ips } Python lists have a truthiness of False when empty. -- Morgan Hamill -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To un