main.yml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. ---
  2. # TODO: allow for overriding default ports where possible
  3. # TODO: trigger the external service when restart is needed
  4. - name: Set node OpenShift facts
  5. openshift_facts:
  6. role: 'node'
  7. local_facts:
  8. debug_level: "{{ openshift_node_debug_level | default(openshift.common.debug_level) }}"
  9. - name: Test if node certs and config exist
  10. stat: path={{ item }}
  11. failed_when: not result.stat.exists
  12. register: result
  13. with_items:
  14. - "{{ cert_path }}"
  15. - "{{ cert_path }}/cert.crt"
  16. - "{{ cert_path }}/key.key"
  17. - "{{ cert_path }}/.kubeconfig"
  18. - "{{ cert_path }}/server.crt"
  19. - "{{ cert_path }}/server.key"
  20. - "{{ cert_parent_path }}/ca/cert.crt"
  21. #- "{{ cert_path }}/node.yaml"
  22. - name: Install OpenShift Node package
  23. yum: pkg=openshift-node state=installed
  24. # --create-certs=false is a temporary workaround until
  25. # https://github.com/openshift/origin/pull/1361 is merged upstream and it is
  26. # the default for nodes
  27. - name: Configure OpenShift Node settings
  28. lineinfile:
  29. dest: /etc/sysconfig/openshift-node
  30. regexp: '^OPTIONS='
  31. line: "OPTIONS=\"--hostname={{ openshift.common.hostname }} --loglevel={{ openshift.node.debug_level }} --create-certs=false\""
  32. notify:
  33. - restart openshift-node
  34. - name: Set default registry url
  35. lineinfile:
  36. dest: /etc/sysconfig/openshift-node
  37. regexp: '^IMAGES='
  38. line: "IMAGES={{ openshift_registry_url }}"
  39. when: openshift_registry_url is defined
  40. notify:
  41. - restart openshift-node
  42. - name: Start and enable openshift-node
  43. service: name=openshift-node enabled=yes state=started
  44. when: not openshift.common.use_openshift_sdn|bool
  45. - name: Disable openshift-node if openshift-node is managed externally
  46. service: name=openshift-node enabled=false
  47. when: openshift.common.use_openshift_sdn|bool