systemd_units.yml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. # This file is included both in the openshift_master role and in the upgrade
  2. # playbooks. For that reason the ha_svc variables are use set_fact instead of
  3. # the vars directory on the role.
  4. - name: Init HA Service Info
  5. set_fact:
  6. containerized_svc_dir: "/usr/lib/systemd/system"
  7. ha_svc_template_path: "native-cluster"
  8. - name: Set HA Service Info for containerized installs
  9. set_fact:
  10. containerized_svc_dir: "/etc/systemd/system"
  11. ha_svc_template_path: "docker-cluster"
  12. when: openshift.common.is_containerized | bool
  13. # workaround for missing systemd unit files
  14. - name: Create the systemd unit files
  15. template:
  16. src: "docker/master.docker.service.j2"
  17. dest: "{{ containerized_svc_dir }}/{{ openshift.common.service_type }}-master.service"
  18. when: openshift.common.is_containerized | bool and (openshift.master.ha is not defined or not openshift.master.ha | bool)
  19. register: create_master_unit_file
  20. - command: systemctl daemon-reload
  21. when: create_master_unit_file | changed
  22. - name: Create the ha systemd unit files
  23. template:
  24. src: "{{ ha_svc_template_path }}/atomic-openshift-master-{{ item }}.service.j2"
  25. dest: "{{ containerized_svc_dir }}/{{ openshift.common.service_type }}-master-{{ item }}.service"
  26. when: openshift.master.ha is defined and openshift.master.ha | bool and openshift_master_cluster_method == "native"
  27. with_items:
  28. - api
  29. - controllers
  30. register: create_ha_unit_files
  31. - command: systemctl daemon-reload
  32. when: create_ha_unit_files | changed
  33. # end workaround for missing systemd unit files
  34. - name: Create the master api service env file
  35. template:
  36. src: "{{ ha_svc_template_path }}/atomic-openshift-master-api.j2"
  37. dest: /etc/sysconfig/{{ openshift.common.service_type }}-master-api
  38. when: openshift.master.ha is defined and openshift.master.ha | bool and openshift_master_cluster_method == "native"
  39. notify:
  40. - restart master api
  41. - name: Create the master controllers service env file
  42. template:
  43. src: "{{ ha_svc_template_path }}/atomic-openshift-master-controllers.j2"
  44. dest: /etc/sysconfig/{{ openshift.common.service_type }}-master-controllers
  45. when: openshift.master.ha is defined and openshift.master.ha | bool and openshift_master_cluster_method == "native"
  46. notify:
  47. - restart master controllers
  48. - name: Install Master docker service file
  49. template:
  50. dest: "/etc/systemd/system/{{ openshift.common.service_type }}-master.service"
  51. src: docker/master.docker.service.j2
  52. register: install_result
  53. when: openshift.common.is_containerized | bool and openshift.master.ha is defined and not openshift.master.ha | bool
  54. - name: Create the master service env file
  55. template:
  56. src: "atomic-openshift-master.j2"
  57. dest: /etc/sysconfig/{{ openshift.common.service_type }}-master
  58. notify:
  59. - restart master