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

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
主站蜘蛛池模板: 阜阳市| 若尔盖县| 荔波县| 西乡县| 阳信县| 通州市| 兴文县| 云林县| 修武县| 遂宁市| 游戏| 河源市| 富川| 永春县| 金堂县| 时尚| 新竹市| 溧阳市| 资兴市| 营山县| 水富县| 金平| 华宁县| 久治县| 石家庄市| 祥云县| 芒康县| 上饶县| 鱼台县| 马尔康县| 昭觉县| 新宁县| 二连浩特市| 太湖县| 祁东县| 和林格尔县| 襄汾县| 临夏市| 广水市| 通榆县| 辽中县|