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

58 lines
1.2 KiB
YAML

- name: Copy logging config
copy:
src: logging.conf
dest: /etc/nodepool/builder-logging.conf
- name: Ensure dib directories
file:
state: directory
path: '{{ item }}'
mode: 0755
owner: nodepool
group: nodepool
loop:
- '/opt/dib_tmp'
- '/opt/dib_cache'
- '/opt/nodepool_dib'
- '/var/log/nodepool/builds'
- name: Setup webserver
include_tasks: webserver.yaml
- name: Ensure /etc/nodepool-builder-compose directory
file:
state: directory
path: /etc/nodepool-builder-compose
mode: 0755
- name: Put docker-compose file in place
template:
src: docker-compose.yaml.j2
dest: /etc/nodepool-builder-compose/docker-compose.yaml
mode: 0644
- name: Run docker-compose pull
shell:
cmd: docker-compose pull
chdir: /etc/nodepool-builder-compose/
- name: Run docker-compose up
shell:
cmd: docker-compose up -d
chdir: /etc/nodepool-builder-compose/
- name: Run docker prune to cleanup unneeded images
shell:
cmd: docker image prune -f
- name: Disable old service
service:
name: nodepool-builder
enabled: no
failed_when: false
- name: Remove old init scripts
file:
state: absent
path: /etc/init.d/nodepool-builder