-
Notifications
You must be signed in to change notification settings - Fork 0
/
syncfiles.yml
171 lines (149 loc) · 4.29 KB
/
syncfiles.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
---
- name: Getting master info instances
hosts: localhost
gather_facts: False
vars_files:
- gce_vars/auth
- gce_vars/machines
- gce_vars/zone
tasks:
- name: get info on master instance
gcp_compute_instance_info:
filters:
- name = master
zone: "{{ zone.za }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
register: master
#- debug: var=master.resources[0].networkInterfaces[0].networkIP
- name: Adding Master instance to group master
add_host:
name: "{{ master.resources[0].networkInterfaces[0].networkIP }}"
groups: master
- name: get info on stockcheck instance1
gcp_compute_instance_info:
filters:
- name = stockcheck01
zone: "{{ zone.za }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
register: stockcheck01
- debug: var=stockcheck01.resources[0].networkInterfaces[0].networkIP
- name: get info on stockcheck instance2
gcp_compute_instance_info:
filters:
- name = stockcheck02
zone: "{{ zone.za }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
register: stockcheck02
- debug: var=stockcheck02.resources[0].networkInterfaces[0].networkIP
- name: Adding stokcheck01 instance to group stockcheck
add_host:
name: "{{ stockcheck01.resources[0].networkInterfaces[0].networkIP }}"
groups: stockcheck
- name: Adding stockcheck02 instance to group stockcheck
add_host:
name: "{{ stockcheck02.resources[0].networkInterfaces[0].networkIP }}"
groups: stockcheck
- hosts: master
gather_facts: true
become: true
roles:
- systemtools
vars:
ansible_user: belloau
ansible_ssh_private_key_file: ~/.ssh/id_rsa.pub
tasks:
- name: Installing lysncd
dnf:
name: lsyncd
state: present
- name: Starting lsyncd services
systemd:
name: lsyncd
state: started
enabled: yes
- name: run the lsyncd configs
template:
src: templates/lsyncd.conf.j2
dest: /etc/lsyncd.conf
notify: restart lsyncd
handlers:
- name: restart lsyncd
systemd:
name: lsyncd
state: restarted
- hosts: stockcheck
gather_facts: true
become: true
vars:
ansible_user: belloau
ansible_ssh_private_key_file: ~/.ssh/id_rsa.pub
roles:
- systemtools
- mariadb
tasks:
- name: Install apache on hosts
dnf:
name:
- httpd
- rsync
state: present
- name: copying keys for manyondoma
authorized_key:
user: mndoma
key: "{{ lookup('file', '/data/keys/id_mndoma.pub') }}"
- name: copying keys for chukwudi
authorized_key:
user: chukwudi
key: "{{ lookup('file', '/data/keys/id_chukwudi.pub') }}"
state: present
- name: adding sudoers for webadmin
template:
src: templates/webadmin_sudoers.j2
dest: /etc/sudoers.d/webadmin_sudoers
- name: adding sudoers for webadmin
template:
src: templates/sysadmin_sudoers.j2
dest: /etc/sudoers.d/sysadmin_sudoers
- name: ensuring webroot directory
file:
path: /var/www/html/frontend/web
state: directory
mode: '0755'
- name: update apache configs
template:
src: templates/httpd.conf.j2
dest: /etc/httpd/conf/httpd.conf
notify: restart apache
- name: Install PHPFM repos
dnf:
name: "http://rpms.remirepo.net/enterprise/remi-release-8.rpm"
disable_gpg_check: True
state: present
- name: Enable the PHPFM repos
dnf:
name: "@php:remi-7.4"
state: present
- name: Installing PHP packages
dnf:
name:
- php
- php-fpm
- php-gd
- php-mysqlnd
state: present
- name: Starting the Php-fpm service
systemd:
name: php-fpm
state: started
enabled: yes
handlers:
- name: restart apache
systemd:
name: httpd
state: restarted