system-config/playbooks/roles/nodepool-builder/tasks/main.yaml
Clark Boylan a1cf5b3f6f Run daily backups of nodepool zk image data
This does local backups of the nodepool zk image image data to
/var/log/nodepool on the nodepool-builders. These hosts don't get
offsite backups but we run mutliple redundant servers. This data isn't
critical as we can start from scratch, but may be useful if we don't
want to go through all that trouble.

Change-Id: I7d150df9c0d9566ef2d32167cea535e29822cfa2
2021-09-16 14:12:08 -07:00

53 lines
1.4 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: docker exec nodepool-builder-compose_nodepool-builder_1 nodepool export-image-data /var/log/nodepool/nodepool-image-backup.json