051aee9f16
The static server in the ptgbot container is very simple; it will be much better to have apache caching the files which essentially never change. Change-Id: I8056d8c529c60f4b95aaca549528b6aa8465fa78
92 lines
1.8 KiB
YAML
92 lines
1.8 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:
|
|
- cache
|
|
- cache_disk
|
|
- cache_socache
|
|
- rewrite
|
|
- proxy
|
|
- proxy_http
|
|
- ssl
|
|
- headers
|
|
- proxy_wstunnel
|
|
|
|
- name: Ensure apache cache dir
|
|
file:
|
|
state: directory
|
|
path: '/var/cache/apache2/proxy'
|
|
owner: root
|
|
group: root
|
|
mode: 0755
|
|
|
|
- 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
|