Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. ---
  2. # file ios-access.yml
  3. - name: Configuration
  4. hosts: all
  5. connection: local
  6. gather_facts: no
  7. roles:
  8. - switch
  9. - access_switch
  10.  
  11. pre_tasks:
  12. - name: Make sure there are no remains from a previous run
  13. file:
  14. path: "{{ host_dir }}"
  15. state: absent
  16. # tags: [print_action]
  17. changed_when: False
  18.  
  19. - name: Create folder to store configurations and diffs for/from the devices
  20. file:
  21. path: "{{ host_dir }}"
  22. state: directory
  23. # tags: [print_action]
  24. changed_when: False
  25.  
  26. tasks:
  27. - name: A simple template with some configuration
  28. template:
  29. src: "{{ os }}/simple.j2"
  30. dest: "{{ host_dir }}/simple.conf"
  31. backup: yes
  32. check_mode: no
  33. changed_when: False
  34. tags: [print_action]
  35. - name: Load configuration into the device
  36. ios_config:
  37. src: "{{ host_dir }}/simple.conf"
  38. host: "{{ inventory_hostname }}"
  39. port: "{{ port }}"
  40. username: "{{ user }}"
  41. password: "{{ password }}"
  42. timeout: 30
  43. # ssh_keyfile: "/home/ansible/.ssh/id_rsa"
  44. backup: "yes"
  45. match: "line"
  46. # replace: "line"
  47. # provider: "publickey"
  48. # multiline_delimiter: "@"
  49. tags: [print_action]
  50. register: config_output
  51. - debug: msg="{{config_output}}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement