- name: Install webserver packages
community.general.pacman:
name: nginx
state: present
- name: Create nginx conf.d directory
file:
path: /etc/nginx/conf.d
state: directory
- name: Configure nginx
template:
src: nginx.conf.j2
dest: /etc/nginx/nginx.conf
notify: Restart webserver
- name: Create nginx SSL configuration file
src: ssl.conf.j2
dest: /etc/nginx/ssl.conf
- name: Create nginx server blocks
src: server_block.j2
dest: "/etc/nginx/conf.d/{{ item }}.conf"
with_items: "{{ server_blocks }}"
- name: Enable nginx service
service:
state: started
enabled: yes