danhoutz

Ansible Role for Juniper Config Generation

Aug 25th, 2014
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. ---
  2. # =========================================================
  3. # Setup variables and directories
  4. # =========================================================
  5.  
  6. - name: Creating build directories for each host
  7. hosts: all
  8. connection: local
  9. gather_facts: no
  10. tasks:
  11. - set_fact:
  12. build_dir: "{{ build_dir }}/{{ inventory_hostname }}/tmp"
  13. junos_conf: "{{ build_dir }}/{{ inventory_hostname }}/conf"
  14. - name: remove host build temp directory
  15. file: path={{ build_dir }} state=absent
  16. - name: create host build temp directory
  17. file: path={{ build_dir }} state=directory mode=0775
  18.  
  19.  
  20. # =========================================================
  21. # Role based config template building
  22. # =========================================================
  23.  
  24. - name: Build Juniper BASE config
  25. hosts: all
  26. connection: local
  27. gather_facts: no
  28. roles:
  29. - jnpr-base
  30.  
  31. # =========================================================
  32. # Role based config template building
  33. # =========================================================
  34.  
  35. - name: Build Juniper CUSTOM config
  36. hosts: all
  37. connection: local
  38. gather_facts: no
  39. roles:
  40. - jnpr-custom
  41.  
  42. # =========================================================
  43. # Finish by assembling config snippets into single file
  44. # =========================================================
  45.  
  46. - name: Creating final junos.conf
  47. hosts: all
  48. connection: local
  49. gather_facts: no
  50. tasks:
  51. - name: assembling configfurations
  52. assemble: src={{ build_dir }} dest={{ junos_conf }} mode=0664
Advertisement
Add Comment
Please, Sign In to add comment