--- - block: - name: Install nginx and required modules community.general.apk: name: - nginx - nginx-openrc - nginx-mod-http-xslt-filter state: present # permission are not right # - name: Ensure nginx web and log directories exist # ansible.builtin.file: # path: "{{ item }}" # state: directory # owner: nginx # group: nginx # mode: '0755' # loop: # - /srv/http # - /var/log/nginx # - /var/lib/nginx # - /var/www/acme - name: Deploy main nginx.conf ansible.builtin.template: src: nginx.conf.j2 dest: /etc/nginx/nginx.conf owner: root group: root mode: '0444' validate: nginx-validate %s /etc/nginx/nginx.conf notify: Reload nginx - name: Enable and start nginx service ansible.builtin.service: name: nginx enabled: true state: started - name: Install atomic nginx validation wrapper ansible.builtin.template: src: nginx-validate.j2 dest: /usr/local/bin/nginx-validate owner: root group: root mode: '0755' tags: - nginx