Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- # file ios-access.yml
- - name: Configuration
- hosts: all
- connection: local
- gather_facts: no
- roles:
- - switch
- - access_switch
- pre_tasks:
- - name: Make sure there are no remains from a previous run
- file:
- path: "{{ host_dir }}"
- state: absent
- # tags: [print_action]
- changed_when: False
- - name: Create folder to store configurations and diffs for/from the devices
- file:
- path: "{{ host_dir }}"
- state: directory
- # tags: [print_action]
- changed_when: False
- tasks:
- - name: A simple template with some configuration
- template:
- src: "{{ os }}/simple.j2"
- dest: "{{ host_dir }}/simple.conf"
- backup: yes
- check_mode: no
- changed_when: False
- tags: [print_action]
- - name: Load configuration into the device
- ios_config:
- src: "{{ host_dir }}/simple.conf"
- host: "{{ inventory_hostname }}"
- port: "{{ port }}"
- username: "{{ user }}"
- password: "{{ password }}"
- timeout: 30
- # ssh_keyfile: "/home/ansible/.ssh/id_rsa"
- backup: "yes"
- match: "line"
- # replace: "line"
- # provider: "publickey"
- # multiline_delimiter: "@"
- tags: [print_action]
- register: config_output
- - debug: msg="{{config_output}}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement