Skip to content

Instantly share code, notes, and snippets.

@afaqk9394
Created November 3, 2019 19:26
Show Gist options
  • Select an option

  • Save afaqk9394/904980741ace087dacc1d1b368e1c30c to your computer and use it in GitHub Desktop.

Select an option

Save afaqk9394/904980741ace087dacc1d1b368e1c30c to your computer and use it in GitHub Desktop.
---
- name: Network Available
hosts: all
connection: local #telling ansible to run the modules locally
gather_facts: false #telling ansible to not to collect variable information from the network devices
any_errors_fatal: true #playbook execution stops if any errors are encountered
tasks:
- name: Waiting 40 seconds for devices to boot up
command: sleep 40
delegate_to: localhost #setting the above command to be run on the host instead of the client
- name: Ensure all devices are up and responding. #checking all the devices in the inventory file to see if they are online
wait_for:
host: "{{ ansible_host }}"
port: "{{ port | default('22') }}"
delay: 5 #wait for 5 seconds before execution.
- name: Gather Info on Network
hosts: all
connection: local
gather_facts: false #Telling ansible to not collect variable information from the network devices
tasks:
- name: Get IOS Info
ios_facts:
host: "{{ ansible_host }}"
port: "{{ port | default('22') }}"
- name: Deploy Common Network Configuration
hosts: all
connection: local
gather_facts: false
roles:
- common #runs the common network configuration role playbook
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment