main.yml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. # TODO: add the validate parameter when there is a validation command to run
  37. - name: Create the Node config
  38. template:
  39. dest: "{{ openshift_node_config_file }}"
  40. src: node.yaml.v1.j2
  41. notify:
  42. - restart openshift-node
  43. - name: Configure OpenShift Node settings
  44. lineinfile:
  45. dest: /etc/sysconfig/openshift-node
  46. regexp: "{{ item.regex }}"
  47. line: "{{ item.line }}"
  48. with_items:
  49. - regex: '^OPTIONS='
  50. line: "OPTIONS=--loglevel={{ openshift.node.debug_level }}"
  51. - regex: '^CONFIG_FILE='
  52. line: "CONFIG_FILE={{ openshift_node_config_file }}"
  53. notify:
  54. - restart openshift-node
  55. - stat: path=/etc/sysconfig/docker
  56. register: docker_check
  57. # TODO: Enable secure registry when code available in origin
  58. - name: Secure OpenShift Registry
  59. lineinfile:
  60. dest: /etc/sysconfig/docker
  61. regexp: '^OPTIONS=.*'
  62. line: "OPTIONS='--insecure-registry={{ openshift.node.portal_net }} \
  63. {% if ansible_selinux and ansible_selinux.status == '''enabled''' %}--selinux-enabled{% endif %}'"
  64. when: docker_check.stat.isreg
  65. - name: Allow NFS access for VMs
  66. seboolean: name=virt_use_nfs state=yes persistent=yes
  67. when: ansible_selinux and ansible_selinux.status == "enabled"
  68. - name: Start and enable openshift-node
  69. service: name=openshift-node enabled=yes state=started