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...