On 22.08.2018 17:18, Caleb Guerrero wrote:
Actually after re-reading your post Brian. I can have 1 play with multiple
tasks set to run_once or use a when conditional; I could also just use
multiple plays to accomplish this. I was hopeful there was a way to use a
for loop to loop over specific hosts running the task individually per
host; however I am thinking that would make this too complex.I plan to use
a role for this and break up my tasks in the tasks/main.yml file.

If I understand correctly, you would like to run the fist command on fist host, the second command on the second host and so on?

If so you could do something like this

    - name: Restore base configs
      ios_command:
        commands:
          - command: 'configure replace {{ item.command }}'
            prompt: '[no]'
            answer: y
      when: intentory_hostanme == item.host
      with_items:
        - command: nvram:Til-EDC-INET_base
          host: Til_INET_EDC-2-WDC_7kb_Core.xxx.org
        - command: nvram:Til-Site-RTR-1_base
          host: Til-Site-RTR-1
          ...
          ...
          ...
      register: result
      tags: ios

--
Kai Stian Olstad

--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/77b78ab9895ad92c29ff43e824aab847%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to