system-config/playbooks/roles/zuul-executor/tasks/main.yaml
James E. Blair b6cbb52447 Add pull tasks for nodepool/zuul
So we can stop/pull/start, move the pull tasks to their own files
and add a playbook that invokes them.

Change-Id: I4f351c1d28e5e4606e0a778e545a3a805525ac71
2021-02-19 15:42:40 -08:00

93 lines
2.2 KiB
YAML

- name: Include OS-specific variables
include_vars: "{{ lookup('first_found', params) }}"
vars:
params:
files: "{{ distro_lookup_path }}"
paths:
- 'vars'
- name: Install PPAs
include_role:
name: install-apt-repo
vars:
repo_name: "{{ item.name }}"
repo_key: "{{ item.key }}"
repo_content: "{{ item.content }}"
loop: '{{ zuul_executor_ppas }}'
- name: Write key for talking to nodepool nodes
copy:
content: '{{ nodepool_test_node_ssh_private_key_contents }}'
dest: /var/lib/zuul/ssh/nodepool_id_rsa
mode: 0400
owner: '{{ zuul_user }}'
group: '{{ zuul_group }}'
- name: Create Zuul Executor directories
file:
state: directory
path: '{{ item }}'
owner: '{{ zuul_user }}'
group: '{{ zuul_group }}'
loop:
- /var/lib/zuul/builds
- /var/lib/zuul/git
- name: Set up cron job to pack git refs
cron:
name: pack-git-refs
state: present
job: 'find /var/lib/zuul/git/ -maxdepth 3 -type d -name ".git" -exec git --git-dir="{}" pack-refs --all \;'
minute: '7'
hour: '4'
- name: Install logging config
copy:
src: logging.conf
dest: /etc/zuul/executor-logging.conf
- name: Rotate executor logs
include_role:
name: logrotate
vars:
logrotate_file_name: /var/log/zuul/executor.log
- name: Rotate executor debug logs
include_role:
name: logrotate
vars:
logrotate_file_name: /var/log/zuul/executor-debug.log
- name: Make docker systemd override directory
file:
state: directory
path: /etc/systemd/system/docker.service.d
- name: Install docker systemd override for openafs ordering
copy:
src: after-afs.conf
dest: /etc/systemd/system/docker.service.d/after-afs.conf
- name: Make docker-compose directory
file:
state: directory
path: /etc/zuul-executor
- name: Install docker-compose file
copy:
src: docker-compose.yaml
dest: /etc/zuul-executor/docker-compose.yaml
- name: Update container images
include_tasks: pull.yaml
- name: Start containers
include_tasks: start.yaml
when: zuul_executor_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