--- - name: Include install tasks include_tasks: install.yml - name: Include enable tasks include_tasks: enable.yml - name: Include Alpine specific tasks include_tasks: alpine.yml when: ansible_facts['distribution'].lower() == "alpine" - name: Lock down and setup configuration directories file: path: '{{item}}' state: directory owner: "{{nginx_conf_owner}}" group: "{{nginx_conf_group}}" mode: "{{nginx_conf_dir_mode}}" loop: - "{{nginx_conf_dir}}" - "{{nginx_conf_dir}}/conf.d" tags: - nginx-conf - conf - name: Create Robots directory file: path: /var/lib/nginx-robots state: directory owner: "{{nginx_conf_owner}}" group: "{{nginx_conf_group}}" mode: "0755" tags: - robots - nginx-conf - conf - name: Create Robots sub directory file: path: '/var/lib/nginx-robots/{{item.name}}' state: directory owner: "{{nginx_conf_owner}}" group: "{{nginx_conf_group}}" mode: "0755" loop: '{{nginx_robots}}' tags: - robots - nginx-conf - conf - name: 'Install {{item.name}} robots' copy: dest: '/var/lib/nginx-robots/{{item.name}}/robots.txt' content: '{{item.robots_txt}}' owner: '{{nginx_conf_owner}}' loop: '{{nginx_robots}}' tags: - robots - nginx-conf - conf - name: Install Robots includes copy: dest: "{{nginx_conf_dir}}/robots_{{item.name}}" content: | location /robots.txt { root /var/lib/nginx-robots/{{item.name}}; } owner: '{{nginx_conf_owner}}' loop: '{{nginx_robots}}' tags: - robots - nginx-conf - conf - name: Install 'nginx.conf' copy: content: '{{nginx_conf}}' dest: "{{nginx_conf_dir}}/nginx.conf" owner: "{{nginx_conf_owner}}" group: "{{nginx_conf_group}}" mode: "{{nginx_conf_file_mode}}" notify: - Restart Nginx tags: - nginx-conf - conf - name: Install Nginx Snippets copy: content: '{{item.value}}' dest: "{{nginx_conf_dir}}/{{item.key}}" owner: "{{nginx_conf_owner}}" group: "{{nginx_conf_group}}" mode: "{{nginx_conf_file_mode}}" loop: '{{nginx_includes | dict2items}}' when: 'nginx_includes is defined' notify: Restart Nginx tags: - nginx-conf - conf - name: Install Nginx conf.d entires copy: content: '{{item.value}}' dest: "{{nginx_conf_dir}}/conf.d/{{item.key}}" owner: "{{nginx_conf_owner}}" group: "{{nginx_conf_group}}" mode: "{{nginx_conf_file_mode}}" loop: '{{nginx_confd | dict2items}}' when: 'nginx_confd is defined' notify: Restart Nginx tags: - nginx-conf - conf - name: Install Htpasswd copy: src: '{{nginx_htpasswd}}' dest: /etc/htpasswd owner: "{{nginx_conf_owner}}" group: "{{nginx_conf_group}}" when: nginx_htpasswd is defined tags: - nginx-conf - conf - htpasswd