rpm.yml 1.8 KB

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