main.yml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. ---
  2. - name: Nomad installed
  3. community.general.pkgng:
  4. name: "nomad"
  5. state: latest
  6. tags:
  7. - dc1
  8. - dc2
  9. - name: Nomad enabled
  10. shell: sysrc nomad_enable="YES"
  11. tags:
  12. - dc1
  13. - dc2
  14. notify: Nomad restarted
  15. - name: Nomad debug set
  16. shell: sysrc nomad_debug="YES"
  17. tags:
  18. - dc1
  19. - dc2
  20. notify: Nomad restarted
  21. - name: Nomad dc1 configured
  22. shell: sysrc nomad_args="-config /usr/local/etc/nomad -network-interface epair0b -dc dc1"
  23. tags:
  24. - dc1
  25. notify: Nomad restarted
  26. - name: Nomad dc2 configured
  27. shell: sysrc nomad_args="-config /usr/local/etc/nomad -network-interface epair0b -dc dc2"
  28. tags:
  29. - dc2
  30. notify: Nomad restarted
  31. - name: Nomad server.hcl installed
  32. copy:
  33. src: server.hcl
  34. dest: /usr/local/etc/nomad/server.hcl
  35. owner: root
  36. mode: 0644
  37. tags:
  38. - dc1
  39. - dc2
  40. notify: Nomad restarted
  41. - name: Nomad client1.hcl removed
  42. file:
  43. state: absent
  44. dest: /usr/local/etc/nomad/client1.hcl
  45. tags:
  46. - dc1
  47. - dc2
  48. notify: Nomad restarted
  49. - name: Nomad client2.hcl removed
  50. file:
  51. state: absent
  52. dest: /usr/local/etc/nomad/client2.hcl
  53. tags:
  54. - dc1
  55. - dc2
  56. notify: Nomad restarted
  57. - name: Nomad dns setup
  58. template:
  59. src: dnsmasq.conf.j2
  60. dest: /usr/local/etc/dnsmasq.conf
  61. owner: root
  62. mode: 0644
  63. tags:
  64. - dc1
  65. - dc2
  66. notify: Dnsmasq restarted
  67. - name: Nomad started
  68. service: name=nomad state=started
  69. tags:
  70. - dc1
  71. - dc2