Just for the sake of actually getting the code I had in mind out, incase 
anyone else might find this solution helpful.

I'm showing two 

Inventory
[ios]

Til_INET_EDC-2-WDC_7kb_Core.xxx.org 
<http://til_inet_edc-2-wdc_7kb_core.xxx.org/> host_command=nvram:Til-EDC-
INET_base
Til-Site-RTR-1 host_command=nvram:Til-Site-RTR-1_base
...


Playbook
---
- name: Restore ios base configs on Til Devices
  hosts: ios
  gather_facts: no
  vars_files:
    - vault/variables.yml

  tasks:
    - name: Restore base configs
      ios_command:
        commands:
          - command: 'configure replace {{ host_command }}'
            prompt: '[no]'
            answer: y
      register: result
      tags: ios

    - name: Copy running-config to startup-config
      ios_config:
        save_when: always

    - name: Print output
      debug:
        var: result


This option (in my option) keeps the playbook itself clean and everything 
that's dynamic in the inventory file. 
This also ensures that you don't have to worry about what the order. You 
simply know exactly what will be run for each host because it's stated in 
the inventory file for each host.

-- 
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/7d8a25b8-81f4-4fcd-b82f-e23b85ca303c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to