Clark Boylan c0fd3e0894 Pull and prune docker images together
We noticed that our zuul scheduler was running out of disk and one of
the causes of this is we are pulling all of the wonderful new zuul
images and not pruning them. This happens because we were only pruning
when (re)starting services and we don't do that automatically with Zuul.
Address this by always pruning after pulling even if we don't restart
services. This should be safe because prune will leave the latest tagged
images as well as the running images.

This should keep our disk consumption down.

Change-Id: Ibdd22ac42d86781f1e87c3d11e05fd8f99677167
2020-05-07 12:51:09 -07:00

73 lines
1.5 KiB
YAML

- name: Copy logging config
copy:
src: logging.conf
dest: /etc/nodepool/launcher-logging.conf
- name: Install apache2
apt:
name:
- apache2
- apache2-utils
state: present
- name: Apache modules
apache2_module:
state: present
name: "{{ item }}"
loop:
- rewrite
- proxy
- proxy_http
- name: Copy apache config
template:
src: launcher.vhost.j2
dest: /etc/apache2/sites-enabled/000-default.conf
owner: root
group: root
mode: 0644
notify: nodepool-launcher Reload apache2
# Do this until 719589/ passes
- name: Install docker-compose
pip:
name: docker-compose
state: present
executable: pip3
- name: Ensure docker compose dir
file:
state: directory
path: /etc/nodepool-docker
- name: Copy docker compose file
template:
src: docker-compose.yaml.j2
dest: /etc/nodepool-docker/docker-compose.yaml
- name: Run docker-compose pull
shell:
cmd: docker-compose pull
chdir: /etc/nodepool-docker/
- name: Start nodepool launcher
include_tasks: start.yaml
when: nodepool_launcher_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: nodepool-launcher
enabled: no
failed_when: false
- name: Remove old init scripts
file:
state: absent
path: /etc/init.d/nodepool-launcher