Re: [ansible-project] Ansible do-until loop in check mode

2017-06-27 Thread Ryan Groten
Figured out a different solution. I added this conditional to my task: when: not ansible_check_mode Thanks for the help! On Tuesday, 27 June 2017 13:22:56 UTC-6, Ryan Groten wrote: > > One slight wrinkle, my example wasn't exactly what I'm trying to do. > Here's my real until loop:

Re: [ansible-project] Ansible do-until loop in check mode

2017-06-27 Thread Ryan Groten
lue is two attributes deep (ie: cluster_health.*json.status* versus response.rc) On Tuesday, 27 June 2017 12:17:03 UTC-6, Kai Stian Olstad wrote: > > On 27. juni 2017 20:12, Kai Stian Olstad wrote: > > On 27. juni 2017 19:40, Ryan Groten wrote: > >> Thanks for the re

Re: [ansible-project] Ansible do-until loop in check mode

2017-06-27 Thread Ryan Groten
That works just fine, thanks Kai! On Tuesday, 27 June 2017 12:17:03 UTC-6, Kai Stian Olstad wrote: > > On 27. juni 2017 20:12, Kai Stian Olstad wrote: > > On 27. juni 2017 19:40, Ryan Groten wrote: > >> Thanks for the response Kai, in this case I want the task no

Re: [ansible-project] Ansible do-until loop in check mode

2017-06-27 Thread Ryan Groten
Thanks for the response Kai, in this case I want the task not to run at all in check mode, only execute the loop when the play is run in execute mode. On Tuesday, 27 June 2017 11:26:06 UTC-6, Kai Stian Olstad wrote: > > On 27. juni 2017 19:19, Ryan Groten wrote: > > Using a stand

[ansible-project] Ansible do-until loop in check mode

2017-06-27 Thread Ryan Groten
Using a standard do-until loop like this: > - shell: /bin/true > register: result > until: result.rc == 0 > retries: 5 > delay: 10 Anytime I run the playbook in check mode this task will fail (because the result variable is not set). It seems like the until part

[ansible-project] lineinfile able to change all occurrences of pattern?

2016-09-06 Thread Ryan Groten
If a regexp matches multiple lines in a file, lineinfile will only change the first occurrence. Is there a way to make change them all? I saw someone used another task to count the number of occurrences of a pattern and then loop using with_sequence in the lineinfile task but I'm wondering

[ansible-project] oVirt/RHEV storage management module

2016-08-03 Thread Ryan Groten
Posted this on the oVirt mailing list but figured there may be some interested parties here as well. I wrote a module for storage management and created a pull request to have it added as an Extra module in Ansible. It can be used to create/delete/attach/destroy disks in oVirt/RHEV.

[ansible-project] Re: Ansible plugin for FreeIPA

2016-08-03 Thread Ryan Groten
Awesome, been looking for something like this. You should make a pull request to ansible-modules-extras! On Wednesday, 3 August 2016 04:00:40 UTC-6, Thomas Krahn wrote: > > Hi All, >> > > i've started an Ansible Module to manage IPA entries like users, groups, > sudo rules, ... . Feel free to

[ansible-project] Re: ssh retry functionality (for flaky network responses)

2016-08-03 Thread Ryan Groten
I've had moderate success by changing the ControlPersist in ssh_args parameter in ansible.cfg: ssh_args = -o ControlMaster=auto -o ControlPersist=300s That said, on big playbooks with a couple hundred hosts/tasks I generally still have at least one or two generic connection failures. Like you

[ansible-project] Re: How to install RHEL on mutiple nodes using ansible

2016-07-29 Thread Ryan Groten
We use Ansible to automatically deploy new RHEL servers from an existing template (with cloud-init enabled). Specifically the ovirt module to launch VMs from templates in ovirt, but the same could easily be done with other major hypervisors. On Tuesday, 26 July 2016 18:33:34 UTC-6, PUJA

Re: [ansible-project] Test that a variable is a valid IP address

2016-07-29 Thread Ryan Groten
Yep that was it, thanks a lot! On Thursday, 28 July 2016 15:45:29 UTC-6, Kai Stian Olstad wrote: > > On 28. juli 2016 23:19, Ryan Groten wrote: > > I'm trying to create a task that verifies a variable is a valid IP > address. > > The task should pass if it is va

[ansible-project] Re: Change exit code of ansible-playbook if there are any changes

2016-07-28 Thread Ryan Groten
How about detecting the changed task(s) from within the playbook itself and create another task that calls a Jenkins API (assuming that's possible)? Eg: - name: Check for divergence command: register: is_diverged - name: Call Jenkins to un-diverge command: when: is_diverged | changed

[ansible-project] Test that a variable is a valid IP address

2016-07-28 Thread Ryan Groten
I'm trying to create a task that verifies a variable is a valid IP address. The task should pass if it is valid, and fail if it's not. I feel like I'm close, but not quite there with this: - name: Verify IP address assert: { that: "{{ requested_ip | ipaddr }}" } always_run: yes This

[ansible-project] with_dict keys with "." was working in Ansible 1.9.4 but not with 2.1.0

2016-04-22 Thread Ryan Groten
When setting sysctl parameters I use the following variable: kernel_params: kernel.sem: 250 32000 100 128 kernel.shmmni: 4096 net.core.rmem_max: 4194304 net.core.rmem_default: 262144 net.core.wmem_max: 1048576 net.core.wmem_default: 262144 ... Then in my role I do the following: -

Re: [ansible-project] Syntax for running commands with braces in them

2016-04-14 Thread Ryan Groten
nt es from rebalancing missing shards uri: url: "http://localhost:9200/_cluster/settings; method: PUT body: "{{ es_disable_allocation|to_json }}" On Tuesday, 12 April 2016 14:12:46 UTC-6, Ryan Groten wrote: > > I must be close, but it's not working with

Re: [ansible-project] Syntax for running commands with braces in them

2016-04-12 Thread Ryan Groten
settings; > method: PUT > body: > transient: > cluster.routing.allocation.enable: "none" > body_format: json > > On Tue, Apr 12, 2016 at 10:29 AM, Ryan Groten <rgr...@gmail.com > > wrote: > &

Re: [ansible-project] Syntax for running commands with braces in them

2016-04-12 Thread Ryan Groten
uri: > url: "http://localhost:9200/_cluster/settings; > method: PUT > body: > transient: > cluster.routing.allocation.enable: "none" > body_format: json > > On Tue, Apr 12, 2016 at 10:29 AM, Ryan Groten <rgr...@gmail.com

[ansible-project] Syntax for running commands with braces in them

2016-04-12 Thread Ryan Groten
I am trying to execute a task that runs the following command (which includes a number of quote, brackets, colons, etc): command: curl -XPUT "http://localhost:9200/_cluster/settings; -d'{ "transient" : { "cluster.routing.allocation.enable" : "none" } }' I tried escaping all the quotes and {},