systemd_units.yml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. ha_svc_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. ha_svc_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 for controllers/api
  14. - name: Create the systemd unit files
  15. template:
  16. src: "{{ ha_svc_template_path }}/atomic-openshift-master-{{ item }}.service.j2"
  17. dest: "{{ ha_svc_svc_dir }}/{{ openshift.common.service_type }}-master-{{ item }}.service"
  18. when: openshift.master.ha is defined and openshift.master.ha | bool and openshift_master_cluster_method == "native"
  19. with_items:
  20. - api
  21. - controllers
  22. register: create_unit_files
  23. - command: systemctl daemon-reload
  24. when: create_unit_files | changed
  25. # end workaround for missing systemd unit files
  26. - name: Create the master api service env file
  27. template:
  28. src: "{{ ha_svc_template_path }}/atomic-openshift-master-api.j2"
  29. dest: /etc/sysconfig/{{ openshift.common.service_type }}-master-api
  30. when: openshift.master.ha is defined and openshift.master.ha | bool and openshift_master_cluster_method == "native"
  31. notify:
  32. - restart master api
  33. - name: Create the master controllers service env file
  34. template:
  35. src: "{{ ha_svc_template_path }}/atomic-openshift-master-controllers.j2"
  36. dest: /etc/sysconfig/{{ openshift.common.service_type }}-master-controllers
  37. when: openshift.master.ha is defined and openshift.master.ha | bool and openshift_master_cluster_method == "native"
  38. notify:
  39. - restart master controllers
  40. - name: Install Master docker service file
  41. template:
  42. dest: "/etc/systemd/system/{{ openshift.common.service_type }}-master.service"
  43. src: docker/master.docker.service.j2
  44. register: install_result
  45. when: openshift.common.is_containerized | bool and openshift.master.ha is defined and not openshift.master.ha | bool
  46. - name: Create the master service env file
  47. template:
  48. src: "atomic-openshift-master.j2"
  49. dest: /etc/sysconfig/{{ openshift.common.service_type }}-master
  50. notify:
  51. - restart master