Advertisement
Guest User

Untitled

a guest
Jan 18th, 2017
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. ---
  2. - name: Simple configuration
  3. hosts: all
  4. connection: local
  5. gather_facts: no
  6. vars:
  7. conf_dir: "{{ playbook_dir }}/.compiled/"
  8. host_dir: "{{ conf_dir }}/{{ inventory_hostname }}"
  9.  
  10. pre_tasks:
  11. - name: Make sure there are no remains from a previous run
  12. file:
  13. path: "{{ host_dir }}"
  14. state: absent
  15. changed_when: False
  16. always_run: yes
  17. - name: Create folder to store configurations and diffs for/from the devices
  18. file:
  19. path: "{{ host_dir }}"
  20. state: directory
  21. changed_when: False
  22. always_run: yes
  23.  
  24. tasks:
  25. - name: A simple template with some configuration
  26. template:
  27. src: "{{ os }}/simple.j2"
  28. dest: "{{ host_dir }}/simple.conf"
  29. changed_when: False
  30. always_run: yes
  31. - name: Load configuration into the device
  32. napalm_install_config:
  33. hostname: "{{ host }}"
  34. username: "{{ user }}"
  35. dev_os: "{{ os }}"
  36. password: "{{ password }}"
  37. optional_args:
  38. port: "{{ port }}"
  39. config_file: "{{ host_dir }}/simple.conf"
  40. replace_config: false
  41. get_diffs: True
  42. diff_file: "{{ host_dir }}/diff"
  43. tags: [print_action]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement