Re: [ansible-project] Ansible loop issue

2024-08-18 Thread HBach
Thanks, Todd. According the docs, the name: param is for the virtual machine and hostname: under customization: is for setting the hostname. I was able to register the stdout of the task, capturing it to a variable. The substitutions are being made. "instance": { "module_h

Re: [ansible-project] Ansible loop issue

2024-08-16 Thread Todd Lewis
I'm inclined to believe someone is confused by the two |hostname:| parameters, and would need to see some job log evidence supporting the claim that "the sub[stitution] is being made for |name:| but not for |hostname:|." In any case, something from the job log would/should be informative. I'v

[ansible-project] Ansible loop issue

2024-08-16 Thread HBach
Hi, Community, I am passing in a list, 'vmware_hosts', to the loop in the following task in order to substitute values for the name: and hostname: parameters. I have found only the sub is being made for name: but not for hostname:. - name: Set powerstate of a virtual machine to poweron co

[ansible-project] ansible Loop help

2024-05-02 Thread Thirumalai Raja A
HI TEAM, below is my task to check the job completed status for the set of ips, and for an ip approximately taking 15 mins to get the status. if i am having 5 number of ips its taking too long to complete my task. so i am looking for parallel options to check for this particular task. is is passi

Re: [ansible-project] ansible loop with when condition a register variable for more then one match string instance

2023-07-20 Thread Deepak B K
Todd, Thank you for trying out the option. But I am trying a different approach instead of matching groups . I have listed all the vm groups to a variable, using a loop and when condition to skip the vm_group which it should not check to remove the drs community.vmware.vmware_drs_group_manager

Re: [ansible-project] ansible loop with when condition a register variable for more then one match string instance

2023-07-20 Thread 'Rowe, Walter P. (Fed)' via Ansible Project
This is not "python in ansible". This is jinja2 templating which is a fully supported feature of ansible. Walter -- Walter Rowe, Division Chief Infrastructure Services, OISM Mobile: 202.355.4123 On Jul 20, 2023, at 7:53 AM, Deepak B K wrote: I appreciate the immediate help . But my client don

Re: [ansible-project] ansible loop with when condition a register variable for more then one match string instance

2023-07-20 Thread Deepak B K
I appreciate the immediate help . But my client don't want use python in the ansible just wanted to know can we use ansible loop and condition to determine the match group_names? Thanks Deepak Kumar On Thursday, July 20, 2023 at 5:48:51 AM UTC+5:30 Todd Lewis wrote: > Deepak, > > Her

Re: [ansible-project] ansible loop with when condition a register variable for more then one match string instance

2023-07-19 Thread Todd Lewis
Deepak, Here's a playbook that demonstrates one way to do it. I tried lots of incorrect Jinja2 expressions that failed to achieve the final output before going back to iterative loops. It feels like the subelements lookup should be part of the solution, and that is shown below. However, it's

[ansible-project] ansible loop with when condition a register variable for more then one match string instance

2023-07-19 Thread Deepak B K
Hi Team, I am trying to loop with a condition to match vm_name for all the VM groups I see that the loop stops at the first instance match . I need help how can I run the loop for all the vm group name in the variable output to match vm_name and extract the match group names in the list

[ansible-project] Ansible Loop

2022-07-13 Thread Gerry Hall
I am installing several Tomcats on the same server which requires several different tasks. To do this I am using *with_items: "{{ TomCats }}"* for each task where TomCats is something like the below and contained in a vars_files. I have an Ansible role that I use for this which my playbook ca

[ansible-project] ansible loop through command for multiple hosts

2021-09-03 Thread Hanumantha Reddy Basireddy
Hi, --- - hosts: all gather_facts: no tasks: - name: check for server ssh wait_for: port: 22 host: "{{ item }}" state: started search_regex: SSH delay: 5 timeout: 300 register: ssh_out ignore_errors: true with_items:

Re: [ansible-project] Ansible loop query

2018-05-09 Thread Kai Stian Olstad
On 10.05.2018 06:57, Aman Kaushik wrote: *Expected* : I want to run loop on both lines and expects below result. I don’t want to create new task for each line since my variable is common. The second line is overwriting the first line, you can only have one line per lineintask task. So you ne

[ansible-project] Ansible loop query

2018-05-09 Thread Aman Kaushik
Hello Team, Below is my playbook & variable for Ansible. Could you please check and help with my query. *Playbook* - name: GIN_MNG Routing lineinfile: line: set routing-instances GIN_MNG routing-options static route {{ item.dst }} next-hop {{ item.nhp }} {{item.action | d

Re: [ansible-project] Ansible - loop through multiple files when with_items defined

2018-01-29 Thread Uwe Sauter
What's wrong with "with_nested"? # - name: Update ifcfg-* files ini_file: path: "{{ net_path }}{{ item[1] }}" no_extra_spaces: true section: null state: present option: "{{ item[0].option }}" value: "{{ item[0].value }}" with_nested: - [{ option: "NM_CONTROLLED"

[ansible-project] Ansible - loop through multiple files when with_items defined

2018-01-29 Thread John Harmon
This is similar to another question I posed a few days ago, but different enough I thought it deserved its own topic. I have a variable of ifcfg-list.stdout_lines that contains a list of ifcfg-* file names (exlcuding loopback). I need to iterate the following code over this list (apply it to

[ansible-project] Ansible loop, set different variables

2017-12-21 Thread John Harmon
I need to check if certain paths exists. More than one path may exist on a server: /home/user1/Scripts /home/user2/Scripts /home/user3/Scripts If it exists, I want to define a variable. For user1, variable user1 will be defined, user2 for user2 and so on. I know I can easily check the paths i

Re: [ansible-project] Ansible loop variable

2017-04-26 Thread Kiran Kumar
HI Kai Stian Olstad , That helped me and thanks a ton but that scenario works better if we know the number of docker networks. Here is the exact use case where I need to generate multiple docker network files based on the number of container count and push a single template multiple times to

Re: [ansible-project] Ansible loop variable

2017-04-26 Thread Kai Stian Olstad
On 26.04.2017 01:19, Kiran Kumar wrote: Am having a challenge finding a solution to below issue. I need to generate multiple network files based on single template and the value of template should change based on the item like IP/NM/GW . Example vars: docker1ip: 1.2.3.4 docker1nm: 255.255

[ansible-project] Ansible loop variable

2017-04-25 Thread Kiran Kumar
Hello friends, Am having a challenge finding a solution to below issue. I need to generate multiple network files based on single template and the value of template should change based on the item like IP/NM/GW . Example vars: docker1ip: 1.2.3.4 docker1nm: 255.255.255.1 docker1gw: 1.2.

[ansible-project] ansible loop break hack

2015-04-17 Thread Daniel Siechniewicz
I've got a hack for what seems like a lack of "break" in ansible loops. How ugly is that (and is there a better way)? - play.xml --- - hosts: all tasks: - file: path=/tmp/THISFAILED state=touch mode="0600" - custom: name="{{ item.name }}" msg="{{ item.msg }}" fai