main.yml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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_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_use_crio | default(false)
  44. - name: restart NetworkManager to ensure resolv.conf is present
  45. systemd:
  46. name: NetworkManager
  47. enabled: yes
  48. state: restarted
  49. when: openshift_node_bootstrap | bool
  50. # The atomic-openshift-node service will set this parameter on
  51. # startup, but if the network service is restarted this setting is
  52. # lost. Reference: https://bugzilla.redhat.com/show_bug.cgi?id=1372388
  53. - sysctl:
  54. name: net.ipv4.ip_forward
  55. value: 1
  56. sysctl_file: "/etc/sysctl.d/99-openshift.conf"
  57. reload: yes
  58. - name: include bootstrap node config
  59. include: bootstrap.yml
  60. when: openshift_node_bootstrap
  61. - name: include standard node config
  62. include: config.yml
  63. when: not openshift_node_bootstrap
  64. - include: registry_auth.yml
  65. - name: Configure AWS Cloud Provider Settings
  66. lineinfile:
  67. dest: /etc/sysconfig/{{ openshift.common.service_type }}-node
  68. regexp: "{{ item.regex }}"
  69. line: "{{ item.line }}"
  70. create: true
  71. with_items:
  72. - regex: '^AWS_ACCESS_KEY_ID='
  73. line: "AWS_ACCESS_KEY_ID={{ openshift_cloudprovider_aws_access_key | default('') }}"
  74. - regex: '^AWS_SECRET_ACCESS_KEY='
  75. line: "AWS_SECRET_ACCESS_KEY={{ openshift_cloudprovider_aws_secret_key | default('') }}"
  76. no_log: True
  77. 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
  78. notify:
  79. - restart node
  80. #### Storage class plugins here ####
  81. - name: NFS storage plugin configuration
  82. include: storage_plugins/nfs.yml
  83. tags:
  84. - nfs
  85. - name: GlusterFS storage plugin configuration
  86. include: storage_plugins/glusterfs.yml
  87. when: "'glusterfs' in openshift.node.storage_plugin_deps"
  88. - name: Ceph storage plugin configuration
  89. include: storage_plugins/ceph.yml
  90. when: "'ceph' in openshift.node.storage_plugin_deps"
  91. - name: iSCSI storage plugin configuration
  92. include: storage_plugins/iscsi.yml
  93. when: "'iscsi' in openshift.node.storage_plugin_deps"
  94. ##### END Storage #####
  95. - include: config/workaround-bz1331590-ovs-oom-fix.yml
  96. when: openshift_node_use_openshift_sdn | default(true) | bool