main.yml 1.9 KB

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