binary_install.yml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. ---
  2. - name: Consul User
  3. user:
  4. name: consul
  5. comment: "Consul User"
  6. shell: /bin/bash
  7. state: present
  8. - name: Ensure Consul Download Dir exists
  9. file:
  10. path: "{{cloud_consul_download_dir}}"
  11. mode: 0755
  12. state: directory
  13. tags:
  14. - install
  15. - name: Consul Download
  16. get_url:
  17. url: "https://releases.hashicorp.com/consul/{{cloud_consul_version}}/consul_{{cloud_consul_version}}_linux_amd64.zip"
  18. dest: "{{cloud_consul_download_dir}}/{{cloud_consul_version}}_linux_amd64.zip"
  19. tags:
  20. - install
  21. - name: Consul UI Download
  22. get_url:
  23. url: "https://releases.hashicorp.com/consul/{{cloud_consul_version}}/consul_{{cloud_consul_version}}_web_ui.zip"
  24. dest: "{{cloud_consul_download_dir}}/{{cloud_consul_version}}_web_ui.zip"
  25. tags:
  26. - install
  27. when: cloud_consul_version is version_compare('1.2', '<')
  28. - name: Ensure Consul Install Dir exists
  29. file:
  30. path: "{{cloud_consul_install_dir}}"
  31. mode: 0755
  32. state: directory
  33. tags:
  34. - install
  35. - name: Ensure Consul App Dirs exist
  36. file: >
  37. path="{{cloud_consul_install_dir}}/{{item}}"
  38. owner=consul
  39. group=consul
  40. mode=0755
  41. state=directory
  42. with_items:
  43. - etc
  44. - data
  45. - bin
  46. - log
  47. - ui
  48. tags:
  49. - install
  50. - name: Unzip Consul
  51. unarchive:
  52. src: "{{cloud_consul_download_dir}}/{{cloud_consul_version}}_linux_amd64.zip"
  53. dest: "{{cloud_consul_install_dir}}/bin"
  54. remote_src: True
  55. tags:
  56. - install
  57. - name: Unzip Consul UI
  58. unarchive:
  59. src: "{{cloud_consul_download_dir}}/{{cloud_consul_version}}_web_ui.zip"
  60. dest: "{{cloud_consul_install_dir}}/ui"
  61. remote_src: True
  62. tags:
  63. - install
  64. when: cloud_consul_version is version_compare('1.2', '<')
  65. - name: ensures consul command has the right permissions
  66. file:
  67. path: "{{cloud_consul_install_dir}}/bin/consul"
  68. owner: root
  69. group: root
  70. mode: 0755
  71. state: file