- 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
推薦閱讀
- 繪制進程圖:可視化D++語言(第1冊)
- 基于LabWindows/CVI的虛擬儀器設計與應用
- 計算機應用基礎·基礎模塊
- Security Automation with Ansible 2
- 自主研拋機器人技術
- 大數據安全與隱私保護
- 大數據技術與應用
- Kubernetes for Serverless Applications
- Mastering ServiceNow Scripting
- 從零開始學PHP
- Microsoft System Center Data Protection Manager Cookbook
- Raspberry Pi 3 Projects for Java Programmers
- Spark Streaming實時流式大數據處理實戰
- 實戰大數據(Hadoop+Spark+Flink):從平臺構建到交互式數據分析(離線/實時)
- 數據結構與算法(C++語言版)