-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.yml
67 lines (57 loc) · 1.59 KB
/
main.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
---
- meta: end_play
when: (ansible_distribution != "CentOS" and ansible_distribution_major_version != "7")
- name: Install epel-release
yum:
name: "{{ packages }}"
state: present
vars:
packages:
- epel-release
- name: Set timezone
timezone:
name: "{{ ntp_timezone }}"
- name: Force timesync with chrony
shell: "chronyc -a makestep"
- name: Install additional packages
yum:
name: "{{ packages }}"
state: present
vars:
packages:
- python2-cryptography
- setools-console
- libsemanage-python
- policycoreutils-python
- name: Set hostname
hostname:
name: "{{ ansible_hostname }}.{{ domain }}"
- name: Add my own IP address to /etc/hosts instead localhost
replace:
path: "/etc/hosts"
regexp: '^127\.0\.0\.1(\s+){{ ansible_hostname }}(\s+){{ ansible_hostname }}.*'
replace: "{{ ansible_host }} {{ ansible_hostname }}.{{ domain }} {{ ansible_hostname }}"
- name: Add pcs1 to /etc/hosts
lineinfile:
path: "/etc/hosts"
state: present
line: "192.168.11.201 pcs1.{{ domain }} {{ ansible_hostname }}"
when: (ansible_hostname != "pcs1")
- name: Add pcs2 to /etc/hosts
lineinfile:
path: "/etc/hosts"
state: present
line: "192.168.11.202 pcs2.{{ domain }} {{ ansible_hostname }}"
when: (ansible_hostname != "pcs2")
- name: Add pcs3 to /etc/hosts
lineinfile:
path: "/etc/hosts"
state: present
line: "192.168.11.203 pcs3.{{ domain }} {{ ansible_hostname }}"
when: (ansible_hostname != "pcs3")
- name: Enable and start FirewallD
systemd:
name: firewalld
state: started
enabled: true
...