Files
toallab-automation/roles/ansible-network.cisco_ios/includes/configure/terminal.yaml
Patrick Toal 6e2205a046 Adding Netbox
2019-05-06 00:34:45 -04:00

42 lines
1.2 KiB
YAML

---
# this block is responsible for loading the configuration on to the target
# device line by line from config model.
- name: load configuration onto target device
block:
- name: load configuration lines into target device
block:
- name: extract banners from configs if present
extract_banners:
config: "{{ ios_config_text }}"
register: result
- name: load configuration lines into target device except banner
cli_config:
config: "{{ result['config'] }}"
register: ios_config_output
- name: enter configuration mode
cli:
command: "configure terminal"
- name: load banner lines into target device
cli_command:
command: "{{ item }}"
sendonly: true
with_items: "{{ result['banners'] }}"
register: banner_config_output
- name: exit configuration mode
cli:
command: end
rescue:
- name: exit configuration mode
cli:
command: end
- name: set host failed
fail:
msg: "error loading configuration lines"
when: not ansible_check_mode