main.yml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. ---
  2. # TODO: allow for overriding default ports where possible
  3. - name: Install OpenShift Node package
  4. yum: pkg=openshift-node state=present
  5. register: node_install_result
  6. - name: Install openshift-sdn-ovs
  7. yum: pkg=openshift-sdn-ovs state=present
  8. register: sdn_install_result
  9. when: openshift.common.use_openshift_sdn
  10. - name: Reload systemd units
  11. command: systemctl daemon-reload
  12. when: (node_install_result | changed or (openshift.common.use_openshift_sdn
  13. and sdn_install_result | changed))
  14. - name: Set node OpenShift facts
  15. openshift_facts:
  16. role: "{{ item.role }}"
  17. local_facts: "{{ item.local_facts }}"
  18. with_items:
  19. - role: common
  20. local_facts:
  21. hostname: "{{ openshift_hostname | default(none) }}"
  22. public_hostname: "{{ openshift_public_hostname | default(none) }}"
  23. deployment_type: "{{ openshift_deployment_type }}"
  24. - role: node
  25. local_facts:
  26. resources_cpu: "{{ openshift_node_resources_cpu | default(none) }}"
  27. resources_memory: "{{ openshift_node_resources_memory | default(none) }}"
  28. pod_cidr: "{{ openshift_node_pod_cidr | default(none) }}"
  29. labels: "{{ openshift_node_labels | default(none) }}"
  30. annotations: "{{ openshift_node_annotations | default(none) }}"
  31. registry_url: "{{ oreg_url | default(none) }}"
  32. debug_level: "{{ openshift_node_debug_level | default(openshift.common.debug_level) }}"
  33. portal_net: "{{ openshift_master_portal_net | 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