- Security Automation with Ansible 2
- Madhu Akula Akash Mahajan
- 134字
- 2021-07-02 22:00:01
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
推薦閱讀
- 我的J2EE成功之路
- 可編程控制器技術(shù)應(yīng)用(西門子S7系列)
- 80x86/Pentium微型計(jì)算機(jī)原理及應(yīng)用
- OpenStack Cloud Computing Cookbook(Second Edition)
- 人工智能與人工生命
- STM32嵌入式微控制器快速上手
- JavaScript典型應(yīng)用與最佳實(shí)踐
- 在實(shí)戰(zhàn)中成長:C++開發(fā)之路
- 基于RPA技術(shù)財(cái)務(wù)機(jī)器人的應(yīng)用與研究
- 電氣控制及Micro800 PLC程序設(shè)計(jì)
- 互聯(lián)網(wǎng)單元測試及實(shí)踐
- SolarWinds Server & Application Monitor:Deployment and Administration
- Intel Edison Projects
- PVCBOT零基礎(chǔ)機(jī)器人制作(第2版)
- 服務(wù)科學(xué)概論