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