/
host-preparation.yml
97 lines (86 loc) · 3 KB
/
host-preparation.yml
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
---
# Copyright Red Hat, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# firewalld and networkmanager come installed by default on CentOS servers and
# can interfere with networking. Ensure they are not in use.
- name: Stop and remove firewalld and networkmanager
hosts: openstack_nodes
tasks:
- name: Enable PowerTools repo on CentOS8
shell: "sudo dnf config-manager --enable powertools || sudo dnf config-manager --enable PowerTools"
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "8"
changed_when: False
- name: Ensure network-scripts installed in CentOS8 as we removing NetworkManager
package:
name: "network-scripts"
state: "present"
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "8"
- name: Stop services
service:
name: "{{ item }}"
state: "stopped"
with_items:
- firewalld
- NetworkManager
ignore_errors: "yes"
register: stopped_services
- name: Remove services
package:
name: "{{ item }}"
state: "absent"
with_items:
- firewalld
- NetworkManager
ignore_errors: "yes"
- name: Restart networking
service:
name: "network"
state: "restarted"
when: stopped_services is succeeded
# Ensure tuned is installed and that we're using an optimal profile
# ... We're not interested in power savings
- name: Set up tuned to ensure optimal performance
hosts: openstack_nodes
tasks:
- name: Ensure tuned is installed
package:
name: "tuned"
state: "present"
- name: Ensure tuned is enabled and started
service:
name: "tuned"
enabled: "yes"
state: "started"
- name: Retrieve current tuned profile
command: tuned-adm active
register: tuned
changed_when: False
- name: Print current tuned profile
debug:
msg: "{{ tuned.stdout }}"
- name: Change tuned profile to throughput-performance
command: tuned-adm profile throughput-performance
when: "'throughput-performance' not in tuned.stdout"
- name: Set up common dependencies across all roles
hosts: openstack_nodes
tasks:
- block:
- include_role:
name: "logs"
tasks_from: "bootstrap"
rescue:
- name: Failure detected when setting up common dependencies
fail:
msg: "Failure detected when setting up common dependencies"