Skip to content

Commit 78a1e63

Browse files
committed
Merge pull request #4 from infOpen/devel
Add become setting for tasks
2 parents 7990c9d + c05e13d commit 78a1e63

3 files changed

Lines changed: 20 additions & 0 deletions

File tree

tasks/configure_debian.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22

33
- name : generate main config file
4+
become : True
45
template :
56
src : "{{ item }}"
67
dest : /etc/apache2/apache2.conf
@@ -15,6 +16,7 @@
1516

1617

1718
- name : generate envvars config file
19+
become : True
1820
template :
1921
src : "{{ item }}"
2022
dest : /etc/apache2/envvars
@@ -29,6 +31,7 @@
2931

3032

3133
- name : create configuration management if not exists - available
34+
become : True
3235
file :
3336
path : "{{ item }}"
3437
state : directory
@@ -41,6 +44,7 @@
4144

4245

4346
- name : generate security.conf config file
47+
become : True
4448
template :
4549
src : "{{ item }}"
4650
dest : /etc/apache2/conf-available/security.conf
@@ -55,13 +59,15 @@
5559

5660

5761
- name : check security configuration activated
62+
become : True
5863
file :
5964
src : /etc/apache2/conf-available/security.conf
6065
dest : /etc/apache2/conf-enabled/security.conf
6166
state : link
6267

6368

6469
- name : disable some modules
70+
become : True
6571
apache2_module :
6672
name : "{{ item }}"
6773
state : absent
@@ -71,6 +77,7 @@
7177

7278

7379
- name : enable some modules
80+
become : True
7481
apache2_module :
7582
name : "{{ item }}"
7683
state : present
@@ -80,6 +87,7 @@
8087

8188

8289
- name : generate virtualhost files
90+
become : True
8391
template :
8492
src : "{{ role_path }}/templates/vhost.conf.j2"
8593
dest : "/etc/apache2/sites-available/{{ item.server_file_name }}.conf"
@@ -91,6 +99,7 @@
9199

92100

93101
- name : copy SSL key if exists
102+
become : True
94103
copy :
95104
src : "{{ inventory_dir }}/files/{{ item.1.key_file }}"
96105
dest : "{{ apache_ssldir }}/{{ item.1.key_file | basename }}"
@@ -105,6 +114,7 @@
105114

106115

107116
- name : copy SSL cert if exists
117+
become : True
108118
copy :
109119
src : "{{ inventory_dir }}/files/{{ item.1.cert_file }}"
110120
dest : "{{ apache_ssldir }}/{{ item.1.cert_file | basename }}"
@@ -120,6 +130,7 @@
120130

121131

122132
- name : copy SSL chain if exists
133+
become : True
123134
copy :
124135
src : "{{ inventory_dir }}/files/{{ item.1.chain_file }}"
125136
dest : "{{ apache_ssldir }}/{{ item.1.chain_file | basename }}"
@@ -134,6 +145,7 @@
134145

135146

136147
- name : disable apache sites
148+
become : True
137149
shell :
138150
"a2dissite {{ item }}"
139151
register : apache_dissite
@@ -143,6 +155,7 @@
143155

144156

145157
- name : enable apache sites
158+
become : True
146159
shell :
147160
"a2ensite {{ item }}"
148161
register : apache_ensite
@@ -152,9 +165,11 @@
152165

153166

154167
- name : generate logrotate
168+
become : True
155169
template :
156170
src : "{{ role_path }}/templates/logrotate.j2"
157171
dest : "/etc/logrotate.d/apache2"
158172
owner : root
159173
group : root
160174
mode : 0644
175+

tasks/install_debian.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22

33
- name : install apache packages
4+
become : True
45
apt :
56
name : "{{ item }}"
67
state : "{{ apache_package_state }}"
@@ -9,3 +10,4 @@
910
with_items : "{{ apache_packages }}"
1011
notify :
1112
- restart apache
13+

tasks/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
when: ansible_os_family == "Debian"
1313

1414
- name : create data directory
15+
become : True
1516
file :
1617
path : "{{ apache_datadir }}"
1718
group : www-data
@@ -21,6 +22,7 @@
2122

2223

2324
- name : create SSL directory
25+
become : True
2426
file :
2527
path : "{{ apache_ssldir }}"
2628
group : www-data
@@ -33,3 +35,4 @@
3335
- config
3436
- apache
3537
when: ansible_os_family == "Debian"
38+

0 commit comments

Comments
 (0)