main.yml 3.0 KB

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