system-config/playbooks/roles/zuul-web/tasks/main.yaml

133 lines
2.6 KiB
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
- proxy_wstunnel
- ssl
- cache
- cache_disk
- headers
- name: Remove old apache config
file:
state: absent
path: '{{ item }}'
loop:
- 40-zuul.opendev.org.conf
- 40-zuul.opendev.org-http.conf
- 50-zuul.openstack.org.conf
- 50-zuul.openstack.org-http.conf
- name: Copy apache config
template:
src: zuul.vhost.j2
dest: /etc/apache2/sites-enabled/000-default.conf
owner: root
group: root
mode: 0644
notify: zuul Reload apache2
- name: Copy whitelabel config
template:
src: openstack.vhost.j2
dest: "/etc/apache2/sites-enabled/010-openstack.conf"
owner: root
group: root
mode: 0644
notify: zuul Reload apache2
- name: Copy htcacheclean config
copy:
src: apache-htcacheclean.default
dest: /etc/default/apache-htcacheclean
owner: root
group: root
mode: '0644'
- name: Install logging config
copy:
src: logging.conf
dest: /etc/zuul/web-logging.conf
- name: Install fingergw logging config
copy:
src: fingergw-logging.conf
dest: /etc/zuul/fingergw-logging.conf
- name: Rotate web logs
include_role:
name: logrotate
vars:
logrotate_file_name: /var/log/zuul/web.log
- name: Rotate web debug logs
include_role:
name: logrotate
vars:
logrotate_file_name: /var/log/zuul/web-debug.log
- name: Rotate fingergw logs
include_role:
name: logrotate
vars:
logrotate_file_name: /var/log/zuul/fingergw.log
- name: Rotate fingergw debug logs
include_role:
name: logrotate
vars:
logrotate_file_name: /var/log/zuul/fingergw-debug.log
- name: Make docker-compose directory
file:
state: directory
path: /etc/zuul-web
- name: Install docker-compose file
copy:
src: docker-compose.yaml
dest: /etc/zuul-web/docker-compose.yaml
- name: Run docker-compose pull
shell:
cmd: docker-compose pull
chdir: /etc/zuul-web
- name: Start containers
include_tasks: start.yaml
when: zuul_web_start | bool
# We can prune here as it should leave the "latest" tagged images
# as well as the currently running images.
- name: Run docker prune to cleanup unneeded images
shell:
cmd: docker image prune -f
- name: Disable old service
service:
name: 'zuul-{{ item }}'
enabled: no
failed_when: false
loop:
- web
- fingergw
- name: Remove old init scripts
file:
state: absent
path: '/etc/init.d/zuul-{{ item }}'
loop:
- web
- fingergw