-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathsaptune.yaml
More file actions
101 lines (87 loc) · 3.13 KB
/
saptune.yaml
File metadata and controls
101 lines (87 loc) · 3.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
---
- name: Gather service facts
ansible.builtin.service_facts:
- name: Ensure that saptune 3.0 or greater is installed
community.general.zypper:
name: 'saptune>=3.0'
state: present
register: result
until: result is succeeded
retries: 3
delay: 60
- name: Install saptune dependency
community.general.zypper:
name: 'patterns-cockpit'
state: present
when:
- "'saptune' in ansible_facts.packages"
- ansible_facts.packages['saptune'][0].version is version('3.2.3', '>=')
- name: Ensure conflicting services are stopped and disabled
ansible.builtin.systemd:
name: "{{ item }}"
state: stopped
enabled: false
loop:
- sapconf.service
- tuned.service
when:
- item in ansible_facts.services
- ansible_facts.services[item].status != 'not-found'
- name: Ensure saptune is running and enabled
ansible.builtin.systemd:
name: saptune
state: started
enabled: true
- name: Ensure saptune_check executes correctly
ansible.builtin.command: saptune_check
register: sapchk
changed_when: false
failed_when: sapchk.rc != 0
- name: Discover active solution
ansible.builtin.command: saptune solution enabled
register: saptune_status
changed_when: false
- name: Set fact for active solution
ansible.builtin.set_fact:
solution_configured: "{{ (saptune_status.stdout | regex_search('(\\S+)', '\\1'))[0] | default('NONE') }}" # Capture the first block on none whitespace
- name: Show configured solution
ansible.builtin.debug:
var: solution_configured
# If this is a cluster node on Azure, we need to override to disable tcp timestamps, reuse and recycle.
# This can be done by copying the sapnote file 2382421 from /usr/share/saptune/notes to /etc/saptune/override
# The value can then override in the in the new file
- name: Disable TCP timestamps, recycle & reuse
ansible.builtin.blockinfile:
path: /etc/saptune/override/2382421
create: true
backup: true
owner: root
group: root
mode: '0640'
marker: "<!-- {mark} ANSIBLE MANAGED BLOCK -->"
block: |
[sysctl]
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_tw_reuse = 0
net.ipv4.tcp_tw_recycle = 0
when:
- cluster_node
- cloud_platform_is_azure
- name: Check if saptune solution needs to be applied
ansible.builtin.command: "saptune solution verify {{ saptune_solution }}"
register: verify
changed_when: false # We're only checking, not changing!
failed_when: false # We expect this to fail if it has not previously been applied
- name: Ensure no solution is currently applied
ansible.builtin.command: "saptune solution revert {{ solution_configured }}"
when:
- solution_configured != 'NONE'
- verify.rc != 0
changed_when: true # This task, when run, is expected to make a change
- name: Ensure saptune solution is applied
ansible.builtin.command: "saptune solution apply {{ saptune_solution }}"
when: verify.rc != 0
changed_when: true # This task, when run, is expected to make a change
- name: Ensure solution was successful
ansible.builtin.command: "saptune solution verify {{ saptune_solution }}"
changed_when: false # We're only checking, not changing!