main.yml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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: copy generic bird.conf to base directory
  43. template:
  44. src: bird.conf.j2
  45. dest: /etc/bird/bird.conf
  46. notify:
  47. - configure bird
  48. - name: make sure conf.d directory exists
  49. file:
  50. path: /etc/bird/conf.d
  51. state: directory
  52. - name: general (disabled) bird.conf from MS setup
  53. template:
  54. src: bird_ms.conf.j2
  55. dest: /etc/bird/conf.d/ffms.conf_dis
  56. notify:
  57. - configure bird
  58. - name: configure batman.conf
  59. template:
  60. src: batman.conf.j2
  61. dest: /etc/bird/conf.d/batman.conf
  62. notify:
  63. - configure bird
  64. - name: copy generic bird6.conf to base directory
  65. template:
  66. src: bird6.conf.j2
  67. dest: /etc/bird/bird6.conf
  68. notify:
  69. - configure bird
  70. - name: make sure conf6.d directory exists
  71. file:
  72. path: /etc/bird/conf6.d
  73. state: directory
  74. - name: general (disabled) bird6.conf from MS setup
  75. template:
  76. src: bird_ms.conf.j2
  77. dest: /etc/bird/conf6.d/ffms6.conf_dis
  78. notify:
  79. - configure bird
  80. - name: configure batman6.conf
  81. template:
  82. src: batman6.conf.j2
  83. dest: /etc/bird/conf6.d/batman6.conf
  84. notify:
  85. - configure bird
  86. - name: bird.service kopieren
  87. copy:
  88. src: bird.service
  89. dest: /lib/systemd/system/bird.service
  90. notify:
  91. - configure bird
  92. - name: bird6.service kopieren
  93. copy:
  94. src: bird6.service
  95. dest: /lib/systemd/system/bird6.service
  96. notify:
  97. - configure bird6
  98. - name: activate and start bird
  99. service:
  100. name: bird
  101. state: started
  102. enabled: yes
  103. - name: activate and start bird6
  104. service:
  105. name: bird6
  106. state: started
  107. enabled: yes