system-config/playbooks/roles/ptgbot/tasks/main.yaml
Ian Wienand 86b7f75b25 ptgbot: setup web interface
The dependent change exports the ptgbot website on port 8000 in the
container.  Proxy this through apache.

Depends-On: https://review.opendev.org/c/openstack/ptgbot/+/812417
Change-Id: Idf9e9f5ffad981427d24a3476c0c1f244721d917
2021-10-06 15:39:25 +11:00

81 lines
1.6 KiB
YAML

- name: Ensure ptgbot directories
file:
state: directory
path: '{{ item }}'
owner: root
group: root
mode: 0755
loop:
- /etc/ptgbot
- /etc/ptgbot-docker
- /var/log/ptgbot
- /var/lib/ptgbot
- /var/lib/ptgbot/www
- name: Put ptgbot config in place
template:
src: ptgbot.config.j2
dest: /etc/ptgbot/ptgbot.config
owner: root
group: root
mode: 0600
register: ptgbot_config_copied
- name: Put ptgbot logging config in place
copy:
src: logging.config
dest: /etc/ptgbot/logging.config
owner: root
group: root
mode: 0644
- name: Put docker-compose file in place
copy:
src: docker-compose.yaml
dest: /etc/ptgbot-docker/docker-compose.yaml
owner: root
group: root
mode: 0644
- name: Run docker-compose pull
shell:
cmd: docker-compose pull
chdir: /etc/ptgbot-docker/
- name: Run docker-compose up
shell:
cmd: "docker-compose up -d {{ ptgbot_config_copied is changed | ternary('--force-recreate', '') }}"
chdir: /etc/ptgbot-docker/
- name: Run docker prune to cleanup unneeded images
shell:
cmd: docker image prune -f
- 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: ptgbot.vhost.config.j2
dest: '/etc/apache2/sites-enabled/010-ptgbot.conf'
owner: root
group: root
mode: 0644
notify: ptgbot Reload apache2