main.yml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. ---
  2. # Role for configure bird and bird6 for our gateway servers.
  3. - name: add key for bird repo
  4. apt_key:
  5. keyserver: keyserver.ubuntu.com
  6. id: AC0E47584A7A714D
  7. when: ansible_distribution == "Debian"
  8. - name: add bird repo
  9. apt_repository:
  10. repo: "deb http://bird.network.cz/debian/ {{ ansible_distribution_release }} main"
  11. state: present
  12. when: ansible_distribution == "Debian" and ansible_distribution_major_version == "8"
  13. - name: install bird and other required packets
  14. apt:
  15. pkg: "{{item}}"
  16. update_cache: yes
  17. cache_valid_time: 1800
  18. state: present
  19. with_items:
  20. - bird
  21. - bird6
  22. - ipcalc
  23. when: ansible_distribution == "Debian" and ansible_distribution_major_version == "8"
  24. - name: install bird and other required packets
  25. apt:
  26. pkg: "{{item}}"
  27. update_cache: yes
  28. cache_valid_time: 1800
  29. state: present
  30. with_items:
  31. - bird
  32. - ipcalc
  33. when: (ansible_distribution == "Ubuntu") or
  34. (ansible_distribution == "Debian" and ansible_distribution_major_version == "9")
  35. - name: calculate more specific routes for DHCP pools
  36. shell: ipcalc {{ domaenenliste[item].dhcp_start }} - {{ domaenenliste[item].dhcp_ende}} | grep -v "deaggregate" | sed -e 's/\(^.*$\)/route \1 via "bat{{item}}";/g'
  37. check_mode: no
  38. changed_when: false
  39. register: more_specific_routes
  40. with_items: "{{domaenenliste | default([])}}"
  41. when: domaenenliste is defined
  42. - name: configure bird.conf
  43. template:
  44. src: bird.conf.j2
  45. dest: /etc/bird/bird.conf
  46. notify:
  47. - configure bird
  48. - name: general (disabled) bird.conf from MS setup
  49. template:
  50. src: bird_ms.conf.j2
  51. dest: /etc/bird/conf.d/ffms.conf_dis
  52. notify:
  53. - configure bird
  54. - name: configure batman.conf
  55. template:
  56. src: batman.conf.j2
  57. dest: /etc/bird/conf.d/batman.conf
  58. notify:
  59. - configure bird
  60. - name: configure ospf.conf (temporary nat-routing over old supernodes)
  61. template:
  62. src: ospf.conf.j2
  63. dest: /etc/bird/conf.d/ospf.conf
  64. notify:
  65. - configure bird
  66. - name: configure bird6.conf
  67. template:
  68. src: bird6.conf.j2
  69. dest: /etc/bird/bird6.conf
  70. notify:
  71. - configure bird6
  72. - name: general (disabled) bird6.conf from MS setup
  73. template:
  74. src: bird_ms.conf.j2
  75. dest: /etc/bird/conf6.d/ffms6.conf_dis
  76. notify:
  77. - configure bird
  78. - name: configure batman6.conf
  79. template:
  80. src: batman6.conf.j2
  81. dest: /etc/bird/conf6.d/batman6.conf
  82. notify:
  83. - configure bird
  84. - name: configure ospf6.conf (temporary routing over old supernodes)
  85. template:
  86. src: ospf6.conf.j2
  87. dest: /etc/bird/conf6.d/ospf6.conf
  88. notify:
  89. - configure bird
  90. - name: bird.service kopieren
  91. copy:
  92. src: bird.service
  93. dest: /lib/systemd/system/bird.service
  94. notify:
  95. - configure bird
  96. - name: bird6.service kopieren
  97. copy:
  98. src: bird6.service
  99. dest: /lib/systemd/system/bird6.service
  100. notify:
  101. - configure bird6
  102. - name: activate and start bird
  103. service:
  104. name: bird
  105. state: started
  106. enabled: yes
  107. - name: activate and start bird6
  108. service:
  109. name: bird6
  110. state: started
  111. enabled: yes