system-config/playbooks/roles/codesearch/tasks/main.yaml
Ian Wienand 1288de67aa codesearch: Add robots.txt
We don't want anything on the codesearch page indexed

Change-Id: I556b77013cf1b7ff2c03426fea92a6d445131f6d
2020-11-20 19:13:32 +11:00

92 lines
1.9 KiB
YAML

- name: Ensure docker-compose directory exists
file:
state: directory
path: /etc/hound-docker
- name: Write settings file
template:
src: docker-compose.yaml.j2
dest: /etc/hound-docker/docker-compose.yaml
- name: Install apache2
apt:
name:
- apache2
- apache2-utils
state: present
- name: Apache modules
apache2_module:
state: present
name: "{{ item }}"
loop:
- rewrite
- proxy
- proxy_http
- ssl
- headers
- proxy_wstunnel
- name: Copy apache config
template:
src: codesearch.vhost.j2
dest: /etc/apache2/sites-enabled/000-default.conf
owner: root
group: root
mode: 0644
notify: codesearch Reload apache2
- name: Create hound data storage area
file:
state: directory
path: /var/lib/hound/data
owner: root
group: root
mode: 0755
- name: Create hound www storage area
file:
state: directory
path: /var/lib/hound/www
owner: root
group: root
mode: 0755
- name: Copy hound robots.txt
copy:
src: robots.txt
dest: /var/lib/hound/www/robots.txt
- name: Run docker-compose pull
shell:
cmd: docker-compose pull
chdir: /etc/hound-docker/
- name: Run docker-compose up
shell:
cmd: docker-compose up -d
chdir: /etc/hound-docker/
- name: Run docker prune to cleanup unneeded images
shell:
cmd: docker image prune -f
# Daily update of codesearch. This only reloads hound
# if the project-config yaml has changed
- name: Install update cron job
cron:
name: Update codesearch
state: present
user: root
job: >
/usr/local/bin/docker-compose -f /etc/hound-docker/docker-compose.yaml exec -T hound
/usr/local/bin/resync-hound >> /var/log/resync-hound.log 2>&1
hour: 5
minute: 30
- name: Rotate sync logs
include_role:
name: logrotate
vars:
logrotate_file_name: /var/log/resync-hound.log