Re: [ansible-project] version_compare not working

2015-03-19 Thread Rick Kasten
That was it -- 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...@googlegroups.com. To post to this group, send email to ansible-project

Re: [ansible-project] register: variable as {{item}}?

2015-03-15 Thread Rick Kasten
I plan to run 'alternatives --install {{ item }} yadayada' for each in the list which will be only those items for which the above shell: command failed. I don't want to run it against all three all the time. So are you saying that using a register: with multiple items will result in a list of

Re: [ansible-project] register: variable as {{item}}?

2015-03-14 Thread Rick Kasten
Nothing's stopping me. I don't know what you're referring to. -- 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...@googlegroups.com. To

[ansible-project] register: variable as {{item}}?

2015-03-14 Thread Rick Kasten
- shell: alternatives --display {{ item }} | grep "best" | grep "jre1.7.0_75" sudo: yes register: "{{ item }}" ignore_errors: with_items: - java - javaws - jcontrol I've tried several iterations of this, all fail. Is there any way this can work? I don't want to have to create

[ansible-project] Re: Access a variable defined in a playbook - within a role

2015-03-14 Thread Rick Kasten
This may not directly answer your question, but this how I am handling that same issue. We have definitions of packages and rpms defined in group_vars and host_vars: # inventory/dse/group_vars/dse/package_versions.yml package_versions: app: app: 4.6.1 jre: jre-1.7.0_75-fcs.x86_64 Then

[ansible-project] version_compare not working

2015-03-14 Thread Rick Kasten
This is doing the complete opposite of matching, right? TASK: [play | debug var=installed_app_version] *** <10.101.1.105> ok: [twp01] => { "installed_app_version": "5.4.0" } TASK: [play | debug var=package_versions.app.app] *** <10.101.1.105> ok: [twp01] => { "package_versions.app.app": "

Re: [ansible-project] Re: Having variables in task names

2015-03-12 Thread Rick Kasten
These answers don't make sense to me. Here's what I've got: # inventory/dse/group_vars/dse/ package_versions.yml package_versions: app: oraclejre_version: jdk1.7.0_75 # roles/oraclejre/tasks/main.yml - name: OracleJRE | Make OracleJRE {{ version }} home directory file: path=/usr/local/jav

Re: [ansible-project] Re: Having variables in task names

2015-03-12 Thread Rick Kasten
These answers don't make sense to me. Here's what I've got: # inventory/dse/group_vars/dse/package_versions.yml package_versions: app: oraclejre_version: jdk1.7.0_75 # roles/oraclejre/tasks/main.yml - name: OracleJRE | Make OracleJRE {{ version }} home directory file: path=/usr/local/java

[ansible-project] Re: Running playbook in interactive mode breaks upon run

2015-03-12 Thread Rick Kasten
I am getting a similar error when running my playbook with '--step' with Ansible 1.8.4: $ ansible-playbook -i inventory/dse/dse text.yml PLAY [all] GATHERING FACTS

[ansible-project] How to make unarchive be quiet

2015-03-10 Thread Rick Kasten
We use unarchive to install some pretty massive tarballs, and the "check_results" section of the JSON is massive, many times filling up my entire screen buffer. I don't care what "check_results" finds, because I already know that package is not installed. So how can I tell unarchive to be quiet

Re: [ansible-project] Proper method of padding text

2014-12-20 Thread Rick Kasten
Thank you. I did read the documentation on truncate, but obviously not closely enough. -- 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+un

[ansible-project] Re: Proper method of padding text

2014-12-20 Thread Rick Kasten
Furthermore, I can show that it is the 'truncate' part itself that is adding the '...': {% for item in collection %} {{ item.name }}{{ "" |truncate(16-(item.name|length)) }}:{{ name.value }} {% endfor %} Produces the following output: item1 ...:v01 item02 ...

Re: [ansible-project] Creation of dict on the fly

2014-12-20 Thread Rick Kasten
I like your yaml template idea, but I did end up pushing the logic off into my backend.cfg.j2 template: {% for server in groups['web_servers'] %} server{{ server }} {{ hostvars[server].ansible_fqdn }}:{{ hostvars[server].http_port }} params {% endfor %} This is based off

[ansible-project] Proper method of padding text

2014-12-20 Thread Rick Kasten
I am trying to print a line of text to a file such that field1 is separated from field2 by 16 characters. I have a template like this working: {% for item in collection %} {{ item.name }}{{ "" |truncate(16-(item.name|length)) }}{{ name.value }} {% endfor %} So the " " field is

[ansible-project] Creation of dict on the fly

2014-12-19 Thread Rick Kasten
I have to create a haproxy config file with data from an unknown number of backend servers. The number is unknown, because based on the environment I need to run the playbook in, the number of backend servers could be 1 to several. My backend servers in haproxy.cfg need to defined something like

Re: [ansible-project] Filtering local facts

2014-12-03 Thread Rick Kasten
I totally understand and agree, but I am a human doing browsing. I figured it out using *jq *(you need *sed *to cut out the "tomcat02 | success >> " portion before the first '{'): # ansible tomcat_servers -i inventory -m setup -a 'filter=ansible_local' | sed 's/.*>> //' | jq -r '.[][]["java"]

[ansible-project] Filtering local facts

2014-12-03 Thread Rick Kasten
I am writing facts on my targets that I want to collect using ansible. In this example, I have a facts.d/prefs.fact and a facts.d/java.fact. I can see this works: # ansible tomcat_servers -i inventory -m setup -a 'filter=ansible_local' tomcat02 | success >> { "ansible_facts": { "an

[ansible-project] Re: How to design an Ansible directory structure

2014-11-24 Thread Rick Kasten
I checked through the documentation for ansible.cfg , and the only setting I found was roles_path. I know everything else can be set via command switches, but that's another issue. There will be very little difference in the playbooks themselves

[ansible-project] How to design an Ansible directory structure

2014-11-21 Thread Rick Kasten
I'm just starting out with Ansible, and I'm trying to design my Ansible catalog in an efficient way for the future. My understanding is that this is how a directory structure should look: ansible/ group_vars/ host_vars/ library/ roles/ host_or_inventory_file playbook.yml It seems to me that ove