main.yml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. - "{{ openshift_node_cert_dir }}"
  15. - "{{ openshift_node_cert_dir }}/ca.crt"
  16. - "{{ openshift_node_cert_dir }}/client.crt"
  17. - "{{ openshift_node_cert_dir }}/client.key"
  18. - "{{ openshift_node_cert_dir }}/.kubeconfig"
  19. - "{{ openshift_node_cert_dir }}/node-config.yaml"
  20. - "{{ openshift_node_cert_dir }}/server.crt"
  21. - "{{ openshift_node_cert_dir }}/server.key"
  22. - name: Install OpenShift Node package
  23. yum: pkg=openshift-node state=installed
  24. register: install_result
  25. - name: Reload systemd units
  26. command: systemctl daemon-reload
  27. when: install_result | changed
  28. # --create-certs=false is a temporary workaround until
  29. # https://github.com/openshift/origin/pull/1361 is merged upstream and it is
  30. # the default for nodes
  31. - name: Configure OpenShift Node settings
  32. lineinfile:
  33. dest: /etc/sysconfig/openshift-node
  34. regexp: '^OPTIONS='
  35. line: "OPTIONS=\"--loglevel={{ openshift.node.debug_level }} --config={{ openshift_node_cert_dir }}/node-config.yaml\""
  36. notify:
  37. - restart openshift-node
  38. - name: Start and enable openshift-node
  39. service: name=openshift-node enabled=yes state=started
  40. when: not openshift.common.use_openshift_sdn|bool
  41. - name: Disable openshift-node if openshift-node is managed externally
  42. service: name=openshift-node enabled=false
  43. when: openshift.common.use_openshift_sdn|bool