init.sls 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. #
  2. # Bird routing daemon
  3. #
  4. {%- set roles = salt['pillar.get']('nodes:' ~ grains['id'] ~ ':roles', []) %}
  5. include:
  6. - network.interfaces
  7. bird-repo:
  8. pkgrepo.managed:
  9. - comments: "# Official bird repo"
  10. - human_name: Official bird repository
  11. - name: "deb http://bird.network.cz/debian/ {{ grains['oscodename'] }} main"
  12. - dist: {{ grains['oscodename'] }}
  13. - file: /etc/apt/sources.list.d/bird.list
  14. - key_url: salt://bird/bird_apt.key
  15. bird-pkg:
  16. pkg.installed:
  17. - name: bird
  18. - require:
  19. - pkgrepo: bird-repo
  20. - sls: network.interfaces
  21. # Make sure both services are enabled
  22. bird:
  23. service.running:
  24. - enable: True
  25. - running: True
  26. bird6:
  27. service.running:
  28. - enable: True
  29. - running: True
  30. # Reload commands for bird{,6} to be tied to files which should trigger reconfiguration
  31. bird-configure:
  32. cmd.wait:
  33. - name: /usr/sbin/birdc configure
  34. - watch: []
  35. bird6-configure:
  36. cmd.wait:
  37. - name: /usr/sbin/birdc6 configure
  38. - watch: []
  39. /etc/bird:
  40. file.directory:
  41. - mode: 750
  42. - user: bird
  43. - group: bird
  44. - require:
  45. - pkg: bird
  46. /etc/bird/bird.d:
  47. file.directory:
  48. - makedirs: true
  49. - mode: 755
  50. - user: root
  51. - group: bird
  52. - require:
  53. - file: /etc/bird
  54. /etc/bird/bird.conf:
  55. file.managed:
  56. - source: salt://bird/bird.conf
  57. - template: jinja
  58. - require:
  59. - file: /etc/bird/bird.d
  60. - require_in:
  61. - service: bird
  62. - watch_in:
  63. - cmd: bird-configure
  64. - mode: 644
  65. - user: root
  66. - group: bird
  67. /etc/bird/bird6.d:
  68. file.directory:
  69. - makedirs: true
  70. - mode: 755
  71. - user: root
  72. - group: bird
  73. - require:
  74. - file: /etc/bird
  75. /etc/bird/bird6.conf:
  76. file.managed:
  77. - source: salt://bird/bird6.conf
  78. - template: jinja
  79. - require:
  80. - file: /etc/bird/bird6.d
  81. - watch_in:
  82. - cmd: bird6-configure
  83. - mode: 644
  84. - user: root
  85. - group: bird
  86. - require_in:
  87. - service: bird6
  88. #
  89. # External VRF / Routing table?
  90. #
  91. /etc/bird/bird.d/VRF_external.conf:
  92. file.managed:
  93. - source: salt://bird/VRF_external.conf
  94. - template: jinja
  95. proto: v4
  96. - watch_in:
  97. - cmd: bird-configure
  98. - require:
  99. - file: /etc/bird/bird.d
  100. - require_in:
  101. - service: bird
  102. /etc/bird/bird6.d/VRF_external.conf:
  103. file.managed:
  104. - source: salt://bird/VRF_external.conf
  105. - template: jinja
  106. proto: v6
  107. - watch_in:
  108. - cmd: bird6-configure
  109. - require:
  110. - file: /etc/bird/bird6.d
  111. - require_in:
  112. - service: bird6
  113. /etc/bird/bird.d/external.conf:
  114. file.absent
  115. /etc/bird/bird6.d/external.conf:
  116. file.absent
  117. #
  118. # IGP / OSPF
  119. #
  120. /etc/bird/bird.d/IGP.conf:
  121. file.managed:
  122. - source: salt://bird/IGP.conf
  123. - template: jinja
  124. proto: v4
  125. - watch_in:
  126. - cmd: bird-configure
  127. - require:
  128. - file: /etc/bird/bird.d
  129. - require_in:
  130. - service: bird
  131. /etc/bird/bird6.d/IGP.conf:
  132. file.managed:
  133. - source: salt://bird/IGP.conf
  134. - template: jinja
  135. proto: v6
  136. - watch_in:
  137. - cmd: bird6-configure
  138. - require:
  139. - file: /etc/bird/bird6.d
  140. - require_in:
  141. - service: bird6
  142. # Compatibility glue
  143. /etc/bird/bird6.d/IGP6.conf:
  144. file.absent:
  145. - watch_in:
  146. - cmd: bird-configure
  147. #
  148. # iBGP
  149. #
  150. /etc/bird/ff-policy.conf:
  151. file.managed:
  152. - source: salt://bird/ff-policy.conf
  153. - template: jinja
  154. proto: v4
  155. - watch_in:
  156. - cmd: bird-configure
  157. - require:
  158. - file: /etc/bird/bird.d
  159. - require_in:
  160. - service: bird
  161. /etc/bird/ff-policy6.conf:
  162. file.managed:
  163. - source: salt://bird/ff-policy.conf
  164. - template: jinja
  165. proto: v6
  166. - watch_in:
  167. - cmd: bird6-configure
  168. - require:
  169. - file: /etc/bird/bird6.d
  170. - require_in:
  171. - service: bird6
  172. /etc/bird/bird.d/ibgp.conf:
  173. file.managed:
  174. - source: salt://bird/ibgp.conf
  175. - template: jinja
  176. proto: v4
  177. - watch_in:
  178. - cmd: bird-configure
  179. - require:
  180. - file: /etc/bird/bird.d
  181. - require_in:
  182. - service: bird
  183. /etc/bird/bird6.d/ibgp.conf:
  184. file.managed:
  185. - source: salt://bird/ibgp.conf
  186. - template: jinja
  187. proto: v6
  188. - watch_in:
  189. - cmd: bird6-configure
  190. - require:
  191. - file: /etc/bird/bird6.d
  192. - require_in:
  193. - service: bird6
  194. #
  195. # FFRL-exit
  196. #
  197. {% if 'ffrl-exit' in roles %}
  198. /etc/bird/bird.d/ffrl.conf:
  199. file.managed:
  200. - source: salt://bird/ffrl.conf
  201. - template: jinja
  202. proto: v4
  203. - watch_in:
  204. - cmd: bird-configure
  205. - require:
  206. - file: /etc/bird/bird.d
  207. - require_in:
  208. - service: bird
  209. /etc/bird/bird6.d/ffrl.conf:
  210. file.managed:
  211. - source: salt://bird/ffrl.conf
  212. - template: jinja
  213. proto: v6
  214. - watch_in:
  215. - cmd: bird6-configure
  216. - require:
  217. - file: /etc/bird/bird6.d
  218. - require_in:
  219. - service: bird6
  220. /etc/bird/bird.d/bogon_unreach.conf:
  221. file.managed:
  222. - source: salt://bird/bogon_unreach.conf
  223. - template: jinja
  224. proto: v4
  225. - watch_in:
  226. - cmd: bird-configure
  227. - require:
  228. - file: /etc/bird/bird.d
  229. - require_in:
  230. - service: bird
  231. /etc/bird/bird6.d/bogon_unreach.conf:
  232. file.managed:
  233. - source: salt://bird/bogon_unreach.conf
  234. - template: jinja
  235. proto: v6
  236. - watch_in:
  237. - cmd: bird6-configure
  238. - require:
  239. - file: /etc/bird/bird6.d
  240. - require_in:
  241. - service: bird6
  242. {% else %}
  243. /etc/bird/bird.d/ffrl.conf:
  244. file.absent
  245. /etc/bird/bird6.d/ffrl.conf:
  246. file.absent
  247. /etc/bird/bird.d/bogon_unreach.conf:
  248. file.absent
  249. /etc/bird/bird6.d/bogon_unreach.conf:
  250. file.absent
  251. {% endif %}
  252. #
  253. # B.A.T.M.A.N. Gateway
  254. #
  255. {% if 'batman_gw' in roles %}
  256. /etc/bird/bird6.d/radv.conf:
  257. file.managed:
  258. - source: salt://bird/radv.conf
  259. - template: jinja
  260. - watch_in:
  261. - cmd: bird6-configure
  262. - require:
  263. - file: /etc/bird/bird6.d
  264. - require_in:
  265. - service: bird6
  266. {% else %}
  267. /etc/bird/bird6.d/ravd.conf:
  268. file.absent
  269. {% endif %}