File tree 2 files changed +54
-0
lines changed
openshift_node_upgrade/tasks
2 files changed +54
-0
lines changed Original file line number Diff line number Diff line change 34
34
dns_ip : " {{ openshift_dns_ip | default(none) | get_dns_ip(hostvars[inventory_hostname])}}"
35
35
env_vars : " {{ openshift_node_env_vars | default(None) }}"
36
36
37
+ # https://docs.openshift.com/container-platform/3.4/admin_guide/overcommit.html#disabling-swap-memory
38
+ - name : Check for swap usage
39
+ command : grep "^[^#].*swap" /etc/fstab
40
+ # grep: match any lines which don't begin with '#' and contain 'swap'
41
+ # command: swapon --summary
42
+ # Alternate option, however if swap entries are in fstab, swap will be
43
+ # enabled at boot. Grepping fstab should catch a condition when swap was
44
+ # disabled, but the fstab entries were not removed.
45
+ changed_when : false
46
+ failed_when : false
47
+ register : swap_result
48
+
49
+ # Disable Swap Block
50
+ - block :
51
+
52
+ - name : Disable swap
53
+ command : swapoff --all
54
+
55
+ - name : Remove swap entries from /etc/fstab
56
+ lineinfile :
57
+ dest : /etc/fstab
58
+ regexp : ' swap'
59
+ state : absent
60
+
61
+ when : swap_result.stdout_lines | length > 0
62
+ # End Disable Swap Block
63
+
37
64
# We have to add tuned-profiles in the same transaction otherwise we run into depsolving
38
65
# problems because the rpms don't pin the version properly. This was fixed in 3.1 packaging.
39
66
- name : Install Node package
Original file line number Diff line number Diff line change 84
84
value : " {{ oreg_url }}"
85
85
when : oreg_url is defined
86
86
87
+ # https://docs.openshift.com/container-platform/3.4/admin_guide/overcommit.html#disabling-swap-memory
88
+ - name : Check for swap usage
89
+ command : grep "^[^#].*swap" /etc/fstab
90
+ # grep: match any lines which don't begin with '#' and contain 'swap'
91
+ # command: swapon --summary
92
+ # Alternate option, however if swap entries are in fstab, swap will be
93
+ # enabled at boot. Grepping fstab should catch a condition when swap was
94
+ # disabled, but the fstab entries were not removed.
95
+ changed_when : false
96
+ failed_when : false
97
+ register : swap_result
98
+
99
+ # Disable Swap Block
100
+ - block :
101
+
102
+ - name : Disable swap
103
+ command : swapoff --all
104
+
105
+ - name : Remove swap entries from /etc/fstab
106
+ lineinfile :
107
+ dest : /etc/fstab
108
+ regexp : ' swap'
109
+ state : absent
110
+
111
+ when : swap_result.stdout_lines | length > 0
112
+ # End Disable Swap Block
113
+
87
114
- name : Restart rpm node service
88
115
service :
89
116
name : " {{ openshift.common.service_type }}-node"
You can’t perform that action at this time.
0 commit comments