main.yml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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') and deployment_type in ['enterprise', 'online', 'atomic-enterprise', 'openshift-enterprise']
  6. - not openshift_docker_use_crio | default(false)
  7. - name: setup firewall
  8. include: firewall.yml
  9. static: yes
  10. #### Disable SWAP #####
  11. # https://docs.openshift.com/container-platform/3.4/admin_guide/overcommit.html#disabling-swap-memory
  12. - name: Check for swap usage
  13. command: grep "^[^#].*swap" /etc/fstab
  14. # grep: match any lines which don't begin with '#' and contain 'swap'
  15. changed_when: false
  16. failed_when: false
  17. register: swap_result
  18. - when:
  19. - swap_result.stdout_lines | length > 0
  20. - openshift_disable_swap | default(true) | bool
  21. block:
  22. - name: Disable swap
  23. command: swapoff --all
  24. - name: Remove swap entries from /etc/fstab
  25. replace:
  26. dest: /etc/fstab
  27. regexp: '(^[^#].*swap.*)'
  28. replace: '# \1'
  29. backup: yes
  30. - name: Add notice about disabling swap
  31. lineinfile:
  32. dest: /etc/fstab
  33. line: '# OpenShift-Ansible Installer disabled swap per overcommit guidelines'
  34. state: present
  35. #### End Disable Swap Block ####
  36. - name: include node installer
  37. include: install.yml
  38. - name: Restart cri-o
  39. systemd:
  40. name: cri-o
  41. enabled: yes
  42. state: restarted
  43. when: openshift_docker_use_crio | default(false)
  44. # The atomic-openshift-node service will set this parameter on
  45. # startup, but if the network service is restarted this setting is
  46. # lost. Reference: https://bugzilla.redhat.com/show_bug.cgi?id=1372388
  47. #
  48. # Use lineinfile w/ a handler for this task until
  49. # https://github.com/ansible/ansible/pull/24277 is included in an
  50. # ansible release and we can use the sysctl module.
  51. - name: Persist net.ipv4.ip_forward sysctl entry
  52. lineinfile: dest=/etc/sysctl.conf regexp='^net.ipv4.ip_forward' line='net.ipv4.ip_forward=1'
  53. notify:
  54. - reload sysctl.conf
  55. - name: include bootstrap node config
  56. include: bootstrap.yml
  57. when: openshift_node_bootstrap
  58. - name: include standard node config
  59. include: config.yml
  60. when: not openshift_node_bootstrap
  61. - name: Configure AWS Cloud Provider Settings
  62. lineinfile:
  63. dest: /etc/sysconfig/{{ openshift.common.service_type }}-node
  64. regexp: "{{ item.regex }}"
  65. line: "{{ item.line }}"
  66. create: true
  67. with_items:
  68. - regex: '^AWS_ACCESS_KEY_ID='
  69. line: "AWS_ACCESS_KEY_ID={{ openshift_cloudprovider_aws_access_key | default('') }}"
  70. - regex: '^AWS_SECRET_ACCESS_KEY='
  71. line: "AWS_SECRET_ACCESS_KEY={{ openshift_cloudprovider_aws_secret_key | default('') }}"
  72. no_log: True
  73. when: openshift_cloudprovider_kind is defined and openshift_cloudprovider_kind == 'aws' and openshift_cloudprovider_aws_access_key is defined and openshift_cloudprovider_aws_secret_key is defined
  74. notify:
  75. - restart node
  76. #### Storage class plugins here ####
  77. - name: NFS storage plugin configuration
  78. include: storage_plugins/nfs.yml
  79. tags:
  80. - nfs
  81. - name: GlusterFS storage plugin configuration
  82. include: storage_plugins/glusterfs.yml
  83. when: "'glusterfs' in openshift.node.storage_plugin_deps"
  84. - name: Ceph storage plugin configuration
  85. include: storage_plugins/ceph.yml
  86. when: "'ceph' in openshift.node.storage_plugin_deps"
  87. - name: iSCSI storage plugin configuration
  88. include: storage_plugins/iscsi.yml
  89. when: "'iscsi' in openshift.node.storage_plugin_deps"
  90. ##### END Storage #####
  91. - include: config/workaround-bz1331590-ovs-oom-fix.yml
  92. when: openshift.common.use_openshift_sdn | default(true) | bool