main.yml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. ---
  2. - fail:
  3. msg: "SELinux is disabled, This deployment type requires that SELinux is enabled."
  4. when:
  5. - (not ansible_selinux or ansible_selinux.status != 'enabled')
  6. - deployment_type == 'openshift-enterprise'
  7. - not openshift_use_crio
  8. - include_tasks: dnsmasq_install.yml
  9. - include_tasks: dnsmasq.yml
  10. - name: setup firewall
  11. import_tasks: firewall.yml
  12. #### Disable SWAP #####
  13. # https://docs.openshift.com/container-platform/3.4/admin_guide/overcommit.html#disabling-swap-memory
  14. - name: Check for swap usage
  15. command: grep "^[^#].*swap" /etc/fstab
  16. # grep: match any lines which don't begin with '#' and contain 'swap'
  17. changed_when: false
  18. failed_when: false
  19. register: swap_result
  20. - when:
  21. - swap_result.stdout_lines | length > 0
  22. - openshift_disable_swap | default(true) | bool
  23. block:
  24. - name: Disable swap
  25. command: swapoff --all
  26. - name: Remove swap entries from /etc/fstab
  27. replace:
  28. dest: /etc/fstab
  29. regexp: '(^[^#].*swap.*)'
  30. replace: '# \1'
  31. backup: yes
  32. - name: Add notice about disabling swap
  33. lineinfile:
  34. dest: /etc/fstab
  35. line: '# OpenShift-Ansible Installer disabled swap per overcommit guidelines'
  36. state: present
  37. #### End Disable Swap Block ####
  38. - name: include node installer
  39. include_tasks: install.yml
  40. - name: Restart cri-o
  41. systemd:
  42. name: cri-o
  43. enabled: yes
  44. state: restarted
  45. when: openshift_use_crio
  46. register: task_result
  47. failed_when: task_result|failed and 'could not find the requested service' not in task_result.msg|lower
  48. - name: restart NetworkManager to ensure resolv.conf is present
  49. systemd:
  50. name: NetworkManager
  51. enabled: yes
  52. state: restarted
  53. when: openshift_node_bootstrap | bool
  54. # The atomic-openshift-node service will set this parameter on
  55. # startup, but if the network service is restarted this setting is
  56. # lost. Reference: https://bugzilla.redhat.com/show_bug.cgi?id=1372388
  57. - sysctl:
  58. name: net.ipv4.ip_forward
  59. value: 1
  60. sysctl_file: "/etc/sysctl.d/99-openshift.conf"
  61. reload: yes
  62. - include_tasks: registry_auth.yml
  63. - name: include standard node config
  64. include_tasks: config.yml
  65. #### Storage class plugins here ####
  66. - name: NFS storage plugin configuration
  67. include_tasks: storage_plugins/nfs.yml
  68. tags:
  69. - nfs
  70. - name: GlusterFS storage plugin configuration
  71. include_tasks: storage_plugins/glusterfs.yml
  72. when: "'glusterfs' in osn_storage_plugin_deps"
  73. - name: Ceph storage plugin configuration
  74. include_tasks: storage_plugins/ceph.yml
  75. when: "'ceph' in osn_storage_plugin_deps"
  76. - name: iSCSI storage plugin configuration
  77. include_tasks: storage_plugins/iscsi.yml
  78. when: "'iscsi' in osn_storage_plugin_deps"
  79. ##### END Storage #####
  80. - include_tasks: config/workaround-bz1331590-ovs-oom-fix.yml
  81. when: openshift_node_use_openshift_sdn | default(true) | bool
  82. - name: include bootstrap node config
  83. include_tasks: bootstrap.yml
  84. when: openshift_node_bootstrap