Move robots.txt in specific folder

This commit is contained in:
Dryusdan 2024-02-16 17:10:49 +01:00
parent 1233619ce1
commit dba96471d8
2 changed files with 3 additions and 3 deletions

View File

@ -86,7 +86,7 @@
- name: "Create robots.txt's folder"
file:
path: "/var/www/{{ item.server_name[0] }}"
path: "/var/www/nginx/robots.txt/{{ item.server_name[0] }}"
state: directory
recurse: yes
owner: www-data
@ -101,7 +101,7 @@
- name: "Add robots.txt"
template:
src: "robots.txt/robots.txt.j2"
dest: "/var/www/{{ item.server_name[0] }}/robots.txt"
dest: "/var/www/nginx/robots.txt/{{ item.server_name[0] }}/robots.txt"
when:
- item.robotstxt is defined and item.robotstxt == true
- item.state == "present" or item.state is not defined

View File

@ -1,7 +1,7 @@
{% if item.robotstxt is defined and item.robotstxt == true %}
location = /robots.txt {
root /var/www/{{ item.server_name[0] }};
root /var/www/nginx/robots.txt/{{ item.server_name[0] }};
allow all;
log_not_found off;
access_log /dev/null;