rpm.yml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. ---
  2. # Set some facts to reference from hostvars
  3. - import_tasks: set_facts.yml
  4. - name: setup firewall
  5. import_tasks: firewall.yml
  6. - name: Install etcd
  7. package: name=etcd state=present
  8. register: result
  9. until: result is succeeded
  10. - import_tasks: drop_etcdctl.yml
  11. # Start secondary etcd instance for third party integrations
  12. # TODO: Determine an alternative to using thirdparty variable
  13. - block:
  14. - name: Create configuration directory
  15. file:
  16. path: "{{ etcd_conf_dir }}"
  17. state: directory
  18. mode: 0700
  19. # TODO: retest with symlink to confirm it does or does not function
  20. - name: Copy service file for etcd instance
  21. copy:
  22. src: /usr/lib/systemd/system/etcd.service
  23. dest: "/etc/systemd/system/{{ etcd_service }}.service"
  24. remote_src: True
  25. - name: Create third party etcd service.d directory exists
  26. file:
  27. path: "{{ etcd_systemd_dir }}"
  28. state: directory
  29. - name: Configure third part etcd service unit file
  30. template:
  31. dest: "{{ etcd_systemd_dir }}/custom.conf"
  32. src: custom.conf.j2
  33. when: etcd_is_thirdparty | bool
  34. - name: Ensure etcd datadir ownership for thirdparty datadir
  35. file:
  36. path: "{{ etcd_data_dir }}"
  37. state: directory
  38. mode: 0700
  39. owner: etcd
  40. group: etcd
  41. recurse: True
  42. when: etcd_is_thirdparty | bool
  43. - name: Write etcd global config file
  44. template:
  45. src: etcd.conf.j2
  46. dest: "{{ etcd_conf_file }}"
  47. backup: true
  48. notify:
  49. - restart etcd
  50. - name: Ensure etcd owns the files in it's config dir
  51. command: "chown etcd:etcd {{ etcd_conf_dir }}/ -R"
  52. - name: Enable etcd
  53. systemd:
  54. name: "{{ etcd_service }}"
  55. state: started
  56. enabled: yes
  57. daemon_reload: yes
  58. register: start_result
  59. - name: Set fact etcd_service_status_changed
  60. set_fact:
  61. etcd_service_status_changed: "{{ start_result is changed }}"