官术网_书友最值得收藏!

Setting up Apache2 web server

We have already seen this in our LEMP stack setup, and it's very similar. But here, we have to use the required modules for working with WordPress. The following code snippet shows how we can use templating to perform configuration updates in the server:

- name: installing apache2 server
apt:
name: "apache2"
update_cache: yes
state: present

- name: updating customized templates for apache2 configuration
template:
src: "{{ item.src }}"
dest: "{{ item.dst }}"
mode: 0644

with_tems:
- { src: apache2.conf.j2, dst: /etc/apache2/conf.d/apache2.conf }
- { src: 000-default.conf.j2, dst: /etc/apache2/sites-available/000-default.conf }
- { src: default-ssl.conf.j2, dst: /etc/apache2/sites-available/default-ssl.conf }

- name: adding custom link for sites-enabled from sites-available
file:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
state: link

with_items:
- { src: '/etc/apache2/sites-available/000-default.conf', dest: '/etc/apache2/sites-enabled/000-default.conf' }
- { src: '/etc/apache2/sites-available/default-ssl.conf', dest: '/etc/apache2/sites-enabled/default-ssl.conf' }

notify:
- start apache2
- startup apache2
主站蜘蛛池模板: 中江县| 万载县| 禹城市| 通河县| 汕尾市| 无锡市| 宁陵县| 阿尔山市| 百色市| 米林县| 蒲城县| 临城县| 邮箱| 吉安县| 沅江市| 林芝县| 泰安市| 肇源县| 栖霞市| 遂昌县| 沽源县| 平罗县| 平乐县| 蚌埠市| 宣化县| 天峨县| 临沭县| 怀化市| 兴化市| 恭城| 大姚县| 霍林郭勒市| 甘德县| 秭归县| 绥化市| 错那县| 蒙城县| 威信县| 平遥县| 南靖县| 江川县|