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

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
主站蜘蛛池模板: 会宁县| 和平区| 壶关县| 左云县| 岑巩县| 牡丹江市| 克拉玛依市| 广东省| 固安县| 新建县| 吉水县| 西充县| 泾源县| 沈阳市| 灌云县| 抚州市| 栖霞市| 安陆市| 江安县| 龙门县| 黔西县| 德令哈市| 阳新县| 固镇县| 南昌市| 台州市| 湖州市| 沽源县| 道孚县| 邓州市| 乐安县| 宁蒗| 色达县| 通许县| 长垣县| 阿勒泰市| 柞水县| 巴林左旗| 舒兰市| 沧源| 开江县|