main.yml 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. ---
  2. - name: Nomad installed
  3. community.general.pkgng:
  4. name: "nomad,py38-six"
  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 user configured
  22. shell: sysrc nomad_user="root"
  23. tags:
  24. - dc1
  25. - dc2
  26. notify: Nomad restarted
  27. - name: Nomad dc1 configured
  28. shell: sysrc nomad_args="-config /usr/local/etc/nomad -network-interface epair0b -dc dc1"
  29. tags:
  30. - dc1
  31. notify: Nomad restarted
  32. - name: Nomad dc2 configured
  33. shell: sysrc nomad_args="-config /usr/local/etc/nomad -network-interface epair0b -dc dc2"
  34. tags:
  35. - dc2
  36. notify: Nomad restarted
  37. - name: Nomad server.hcl removed
  38. file:
  39. state: absent
  40. dest: /usr/local/etc/nomad/server.hcl
  41. tags:
  42. - dc1
  43. - dc2
  44. notify: Nomad restarted
  45. - name: Nomad client.hcl installed
  46. copy:
  47. src: client.hcl
  48. dest: /usr/local/etc/nomad/client.hcl
  49. owner: root
  50. mode: 0644
  51. tags:
  52. - dc1
  53. - dc2
  54. notify: Nomad restarted
  55. - name: http-echo copied
  56. copy:
  57. src: http-echo
  58. dest: /usr/local/bin/http-echo
  59. owner: root
  60. mode: a+x
  61. tags:
  62. - dc1
  63. - dc2
  64. - name: Nomad dns setup
  65. template:
  66. src: dnsmasq.conf.j2
  67. dest: /usr/local/etc/dnsmasq.conf
  68. owner: root
  69. mode: 0644
  70. tags:
  71. - dc1
  72. - dc2
  73. notify: Dnsmasq restarted
  74. - name: Nomad started
  75. service: name=nomad state=started
  76. tags:
  77. - dc1
  78. - dc2