|
1 | 1 | --- |
2 | 2 |
|
3 | 3 | - name : generate main config file |
| 4 | + become : True |
4 | 5 | template : |
5 | 6 | src : "{{ item }}" |
6 | 7 | dest : /etc/apache2/apache2.conf |
|
15 | 16 |
|
16 | 17 |
|
17 | 18 | - name : generate envvars config file |
| 19 | + become : True |
18 | 20 | template : |
19 | 21 | src : "{{ item }}" |
20 | 22 | dest : /etc/apache2/envvars |
|
29 | 31 |
|
30 | 32 |
|
31 | 33 | - name : create configuration management if not exists - available |
| 34 | + become : True |
32 | 35 | file : |
33 | 36 | path : "{{ item }}" |
34 | 37 | state : directory |
|
41 | 44 |
|
42 | 45 |
|
43 | 46 | - name : generate security.conf config file |
| 47 | + become : True |
44 | 48 | template : |
45 | 49 | src : "{{ item }}" |
46 | 50 | dest : /etc/apache2/conf-available/security.conf |
|
55 | 59 |
|
56 | 60 |
|
57 | 61 | - name : check security configuration activated |
| 62 | + become : True |
58 | 63 | file : |
59 | 64 | src : /etc/apache2/conf-available/security.conf |
60 | 65 | dest : /etc/apache2/conf-enabled/security.conf |
61 | 66 | state : link |
62 | 67 |
|
63 | 68 |
|
64 | 69 | - name : disable some modules |
| 70 | + become : True |
65 | 71 | apache2_module : |
66 | 72 | name : "{{ item }}" |
67 | 73 | state : absent |
|
71 | 77 |
|
72 | 78 |
|
73 | 79 | - name : enable some modules |
| 80 | + become : True |
74 | 81 | apache2_module : |
75 | 82 | name : "{{ item }}" |
76 | 83 | state : present |
|
80 | 87 |
|
81 | 88 |
|
82 | 89 | - name : generate virtualhost files |
| 90 | + become : True |
83 | 91 | template : |
84 | 92 | src : "{{ role_path }}/templates/vhost.conf.j2" |
85 | 93 | dest : "/etc/apache2/sites-available/{{ item.server_file_name }}.conf" |
|
91 | 99 |
|
92 | 100 |
|
93 | 101 | - name : copy SSL key if exists |
| 102 | + become : True |
94 | 103 | copy : |
95 | 104 | src : "{{ inventory_dir }}/files/{{ item.1.key_file }}" |
96 | 105 | dest : "{{ apache_ssldir }}/{{ item.1.key_file | basename }}" |
|
105 | 114 |
|
106 | 115 |
|
107 | 116 | - name : copy SSL cert if exists |
| 117 | + become : True |
108 | 118 | copy : |
109 | 119 | src : "{{ inventory_dir }}/files/{{ item.1.cert_file }}" |
110 | 120 | dest : "{{ apache_ssldir }}/{{ item.1.cert_file | basename }}" |
|
120 | 130 |
|
121 | 131 |
|
122 | 132 | - name : copy SSL chain if exists |
| 133 | + become : True |
123 | 134 | copy : |
124 | 135 | src : "{{ inventory_dir }}/files/{{ item.1.chain_file }}" |
125 | 136 | dest : "{{ apache_ssldir }}/{{ item.1.chain_file | basename }}" |
|
134 | 145 |
|
135 | 146 |
|
136 | 147 | - name : disable apache sites |
| 148 | + become : True |
137 | 149 | shell : |
138 | 150 | "a2dissite {{ item }}" |
139 | 151 | register : apache_dissite |
|
143 | 155 |
|
144 | 156 |
|
145 | 157 | - name : enable apache sites |
| 158 | + become : True |
146 | 159 | shell : |
147 | 160 | "a2ensite {{ item }}" |
148 | 161 | register : apache_ensite |
|
152 | 165 |
|
153 | 166 |
|
154 | 167 | - name : generate logrotate |
| 168 | + become : True |
155 | 169 | template : |
156 | 170 | src : "{{ role_path }}/templates/logrotate.j2" |
157 | 171 | dest : "/etc/logrotate.d/apache2" |
158 | 172 | owner : root |
159 | 173 | group : root |
160 | 174 | mode : 0644 |
| 175 | + |
0 commit comments