diff options
| author | Mitch Riedstra <mitch@riedstra.us> | 2020-05-22 23:58:32 -0400 |
|---|---|---|
| committer | Mitch Riedstra <mitch@riedstra.us> | 2020-05-22 23:58:32 -0400 |
| commit | 3ca81c0d25ff302ac86ce1c178ea710eb7ba7074 (patch) | |
| tree | c038a90838962f6aff8eae35087348bb0e2f850d | |
| parent | e01f450ec79c8fe736d5a0ea7edb2812fcc1fc96 (diff) | |
| download | nginx-3ca81c0d25ff302ac86ce1c178ea710eb7ba7074.tar.gz nginx-3ca81c0d25ff302ac86ce1c178ea710eb7ba7074.tar.xz | |
Add in robots configuration
| -rw-r--r-- | defaults/main.yml | 16 | ||||
| -rw-r--r-- | tasks/main.yml | 32 |
2 files changed, 47 insertions, 1 deletions
diff --git a/defaults/main.yml b/defaults/main.yml index 19ac5c8..f7bc1b7 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -29,6 +29,22 @@ nginx_default_listen: | listen [::]:80; +nginx_robots: + - name: allow + robots_txt: | + User-agent: CuteStat + Disallow: / + + User-agent: * + Allow: / + - name: disallow + robots_txt: | + User-agent: CuteStat + Disallow: / + + User-agent: * + Disallow: / + # If "True" it will template out {{ansible_hostname}}/nginx/nginx.conf instead # of nginx/nginx.conf nginx_custom_template: False diff --git a/tasks/main.yml b/tasks/main.yml index 7629c87..9c8c4b1 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -23,6 +23,36 @@ owner: "{{nginx_conf_owner}}" group: "{{nginx_conf_group}}" mode: "0755" +- name: Create Robots directory + file: + path: /var/lib/nginx-robots + state: directory + owner: "{{nginx_conf_owner}}" + group: "{{nginx_conf_group}}" + mode: "0755" +- 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}}' +- 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}}' +- 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}}' - name: Install Main 'nginx.conf' template: src: nginx/nginx.conf @@ -54,7 +84,7 @@ - acme-challenge - acl notify: - - Restart Nginx + - Restart Nginx - name: Install Htpasswd copy: src: '{{nginx_htpasswd}}' |
