main.yml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. ---
  2. - name: Install OpenShift Master package
  3. yum: pkg=openshift-master state=installed
  4. - name: Configure OpenShift settings
  5. lineinfile:
  6. dest: /etc/sysconfig/openshift-master
  7. regexp: '^OPTIONS='
  8. line: "OPTIONS=\"--public-master={{ openshift_hostname }} {% if
  9. openshift_node_ips %} --nodes={{ openshift_node_ips
  10. | join(',') }} {% endif %} --loglevel={{ openshift_master_debug_level }}\""
  11. notify:
  12. - restart openshift-master
  13. - name: Set default registry url
  14. lineinfile:
  15. dest: /etc/sysconfig/openshift-master
  16. regexp: '^IMAGES='
  17. line: "IMAGES={{ openshift_registry_url }}"
  18. when: openshift_registry_url is defined
  19. notify:
  20. - restart openshift-master
  21. - name: Set master OpenShift facts
  22. include: "{{ role_path | dirname }}/openshift_common/tasks/set_facts.yml"
  23. facts:
  24. - section: master
  25. option: debug_level
  26. value: "{{ openshift_master_debug_level }}"
  27. - section: master
  28. option: public_ip
  29. value: "{{ openshift_public_ip }}"
  30. - section: master
  31. option: externally_managed
  32. value: "{{ openshift_master_manage_service_externally }}"
  33. # TODO: remove this when origin PR #1298 has landed in OSE
  34. - name: Workaround for openshift-master taking longer than 90 seconds to issue sdNotify signal
  35. command: cp /usr/lib/systemd/system/openshift-master.service /etc/systemd/system/
  36. args:
  37. creates: /etc/systemd/system/openshift-master.service
  38. - ini_file:
  39. dest: /etc/systemd/system/openshift-master.service
  40. option: TimeoutStartSec
  41. section: Service
  42. value: 300
  43. state: present
  44. register: result
  45. - command: systemctl daemon-reload
  46. when: result | changed
  47. # End of workaround pending PR #1298
  48. - name: Start and enable openshift-master
  49. service: name=openshift-master enabled=yes state=started
  50. when: not openshift_master_manage_service_externally
  51. register: result
  52. #TODO: remove this when origin PR #1204 has landed in OSE
  53. - name: need to pause here, otherwise we attempt to copy certificates generated by the master before they are generated
  54. pause: seconds=30
  55. when: result | changed
  56. # End of workaround pending PR #1204
  57. - name: Disable openshift-master if openshift-master is managed externally
  58. service: name=openshift-master enabled=false
  59. when: openshift_master_manage_service_externally
  60. # TODO: create an os_vars role that has generic env related config and move
  61. # the root kubeconfig setting there, cannot use dependencies to force ordering
  62. # with openshift_node and openshift_master because the way conditional
  63. # dependencies work with current ansible would also exclude the
  64. # openshift_common dependency.
  65. - name: Create .kube directory
  66. file:
  67. path: /root/.kube
  68. state: directory
  69. mode: 0700
  70. - name: Configure root user kubeconfig
  71. command: cp /var/lib/openshift/openshift.local.certificates/admin/.kubeconfig /root/.kube/.kubeconfig
  72. args:
  73. creates: /root/.kube/.kubeconfig