main.yml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. ---
  2. - name: Test if node certs and config exist
  3. stat: path={{ item }}
  4. failed_when: not result.stat.exists
  5. register: result
  6. with_items:
  7. - "{{ cert_path }}"
  8. - "{{ cert_path }}/cert.crt"
  9. - "{{ cert_path }}/key.key"
  10. - "{{ cert_path }}/.kubeconfig"
  11. - "{{ cert_path }}/server.crt"
  12. - "{{ cert_path }}/server.key"
  13. - "{{ cert_parent_path }}/ca/cert.crt"
  14. #- "{{ cert_path }}/node.yaml"
  15. - name: Install OpenShift Node package
  16. yum: pkg=openshift-node state=installed
  17. # --create-certs=false is a temporary workaround until
  18. # https://github.com/openshift/origin/pull/1361 is merged upstream and it is
  19. # the default for nodes
  20. - name: Configure OpenShift Node settings
  21. lineinfile:
  22. dest: /etc/sysconfig/openshift-node
  23. regexp: '^OPTIONS='
  24. line: "OPTIONS=\"--hostname={{ openshift_hostname }} --loglevel={{ openshift_node_debug_level }} --create-certs=false\""
  25. notify:
  26. - restart openshift-node
  27. - name: Set default registry url
  28. lineinfile:
  29. dest: /etc/sysconfig/openshift-node
  30. regexp: '^IMAGES='
  31. line: "IMAGES={{ openshift_registry_url }}"
  32. when: openshift_registry_url is defined
  33. notify:
  34. - restart openshift-node
  35. - name: Set OpenShift node facts
  36. include: "{{ role_path | dirname }}/openshift_common/tasks/set_facts.yml"
  37. facts:
  38. - section: node
  39. option: debug_level
  40. value: "{{ openshift_node_debug_level }}"
  41. - section: node
  42. option: public_ip
  43. value: "{{ openshift_public_ip }}"
  44. - section: node
  45. option: externally_managed
  46. value: "{{ openshift_node_manage_service_externally }}"
  47. - name: Start and enable openshift-node
  48. service: name=openshift-node enabled=yes state=started
  49. when: not openshift_node_manage_service_externally
  50. - name: Disable openshift-node if openshift-node is managed externally
  51. service: name=openshift-node enabled=false
  52. when: openshift_node_manage_service_externally