Clark Boylan f1bc64a58e Fix nodepool image export cron
This is a followup to the prior fix that addressed the path issue. Now
we have the problem of docker-compose attempting to allocate a tty (the
default) which isn't possible by default under cron. We don't need a tty
so we pass -T to disable tty allocation in the first place.

I should've caught this the last time around but my testing didn't catch
it because I was running from a shell.

Change-Id: I57797c8d140335d9edcdcd324239fdefb09882d4
2025-03-19 07:53:45 -07:00

53 lines
1.5 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_user }}"
group: "{{ nodepool_group }}"
loop:
- '/opt/dib_tmp'
- '/opt/dib_cache'
- '/opt/dib_containers'
- '/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: Update container images
include_tasks: pull.yaml
- name: Start nodepool builder
include_tasks: start.yaml
- name: Run docker prune to cleanup unneeded images
shell:
cmd: docker image prune -f
- name: Backup nodepool zk image data daily
cron:
name: Backup nodepool zk image data
minute: '{{ 59 | random(seed=inventory_hostname) }}'
hour: '{{ 23 | random(seed=inventory_hostname) }}'
# Note we backup to /var/log/nodepool because that is what we have bind
# mounted in the container and we are operating relative to that context
job: /usr/local/bin/docker-compose -f /etc/nodepool-builder-compose/docker-compose.yaml exec -T nodepool-builder nodepool export-image-data /var/log/nodepool/nodepool-image-backup.json