|
1 |
| -- name: install httpd package (CentOS) |
2 |
| - tags: apache,centos,httpd |
3 |
| - dnf: |
| 1 | +- name: install apache and php packages |
| 2 | + tags: apache,httpd,php |
| 3 | + package: |
4 | 4 | name:
|
5 |
| - - httpd |
6 |
| - - php |
| 5 | + - "{{ apache_package_name }}" |
| 6 | + - "{{ php_package_name }}" |
7 | 7 | state: latest
|
8 |
| - when: ansible_distribution == "CentOS" |
9 | 8 |
|
10 |
| -- name: start and enable httpd (CentOS) |
11 |
| - tags: apache,centos,httpd |
| 9 | +- name: start and enable apache service |
| 10 | + tags: apache,httpd |
12 | 11 | service:
|
13 |
| - name: httpd |
| 12 | + name: "{{ apache_service }}" |
14 | 13 | state: started
|
15 | 14 | enabled: yes
|
16 |
| - when: ansible_distribution == "CentOS" |
17 |
| - |
18 |
| -- name: install apache2 package (Ubuntu) |
19 |
| - tags: apache,apache2,ubuntu |
20 |
| - apt: |
21 |
| - name: |
22 |
| - - apache2 |
23 |
| - - libapache2-mod-php |
24 |
| - state: latest |
25 |
| - when: ansible_distribution == "Ubuntu" |
26 | 15 |
|
27 | 16 | - name: change e-mail address for admin
|
28 | 17 | tags: apache,centos,httpd
|
29 | 18 | lineinfile:
|
30 | 19 | path: /etc/httpd/conf/httpd.conf
|
31 | 20 | regexp: '^ServerAdmin'
|
32 |
| - line: ServerAdmin somebody@somewhere.net |
| 21 | + line: ServerAdmin somebody@somewhere.com |
33 | 22 | when: ansible_distribution == "CentOS"
|
34 |
| - register: httpd |
| 23 | + notify: restart_apache |
35 | 24 |
|
36 |
| -- name: restart httpd (CentOS) |
37 |
| - tags: apache,centos,httpd |
38 |
| - service: |
39 |
| - name: httpd |
40 |
| - state: restarted |
41 |
| - when: httpd.changed |
42 |
| - |
43 | 25 | - name: copy html file for site
|
44 | 26 | tags: apache,apache,apache2,httpd
|
45 | 27 | copy:
|
|
0 commit comments