main.yml 3.5 KB

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