Adding Netbox
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
---
|
||||
# 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
|
||||
Reference in New Issue
Block a user