Thanks for the feedback everyone! Arden, that looks like a solid solution also. Considering this code is in a dev environment, I will play around with the various methods specified.
On Wednesday, August 22, 2018 at 12:47:54 PM UTC-6, Arden Shackelford wrote: > > 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/3f9f93e6-3862-4305-ab3d-b0375fffce63%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
