main.yml 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. ---
  2. # TODO: allow for overriding default ports where possible
  3. - fail:
  4. msg: This role requres that osn_cluster_dns_domain is set
  5. when: osn_cluster_dns_domain is not defined or not osn_cluster_dns_domain
  6. - fail:
  7. msg: This role requres that osn_cluster_dns_ip is set
  8. when: osn_cluster_dns_ip is not defined or not osn_cluster_dns_ip
  9. - name: Install OpenShift Node package
  10. yum: pkg=openshift-node state=present
  11. register: node_install_result
  12. - name: Install openshift-sdn-ovs
  13. yum: pkg=openshift-sdn-ovs state=present
  14. register: sdn_install_result
  15. when: openshift.common.use_openshift_sdn
  16. - name: Set node OpenShift facts
  17. openshift_facts:
  18. role: "{{ item.role }}"
  19. local_facts: "{{ item.local_facts }}"
  20. with_items:
  21. - role: common
  22. local_facts:
  23. hostname: "{{ openshift_hostname | default(none) }}"
  24. public_hostname: "{{ openshift_public_hostname | default(none) }}"
  25. deployment_type: "{{ openshift_deployment_type }}"
  26. - role: node
  27. local_facts:
  28. labels: "{{ openshift_node_labels | default(none) }}"
  29. annotations: "{{ openshift_node_annotations | default(none) }}"
  30. registry_url: "{{ oreg_url | default(none) }}"
  31. debug_level: "{{ openshift_node_debug_level | default(openshift.common.debug_level) }}"
  32. portal_net: "{{ openshift_master_portal_net | default(None) }}"
  33. kubelet_args: "{{ openshift_node_kubelet_args | default(None) }}"
  34. # TODO: add the validate parameter when there is a validation command to run
  35. - name: Create the Node config
  36. template:
  37. dest: "{{ openshift_node_config_file }}"
  38. src: node.yaml.v1.j2
  39. notify:
  40. - restart openshift-node
  41. - name: Configure OpenShift Node settings
  42. lineinfile:
  43. dest: /etc/sysconfig/openshift-node
  44. regexp: "{{ item.regex }}"
  45. line: "{{ item.line }}"
  46. with_items:
  47. - regex: '^OPTIONS='
  48. line: "OPTIONS=--loglevel={{ openshift.node.debug_level }}"
  49. - regex: '^CONFIG_FILE='
  50. line: "CONFIG_FILE={{ openshift_node_config_file }}"
  51. notify:
  52. - restart openshift-node
  53. - stat: path=/etc/sysconfig/docker
  54. register: docker_check
  55. # TODO: Enable secure registry when code available in origin
  56. - name: Secure OpenShift Registry
  57. lineinfile:
  58. dest: /etc/sysconfig/docker
  59. regexp: '^OPTIONS=.*'
  60. line: "OPTIONS='--insecure-registry={{ openshift.node.portal_net }} --selinux-enabled'"
  61. when: docker_check.stat.isreg
  62. - name: Allow NFS access for VMs
  63. seboolean: name=virt_use_nfs state=yes persistent=yes
  64. - name: Start and enable openshift-node
  65. service: name=openshift-node enabled=yes state=started
  66. register: start_result
  67. - name: pause to prevent service restart from interfering with bootstrapping
  68. pause: seconds=30
  69. when: start_result | changed