8da9b9086f
Add an override to the systemd configuration for the docker service unit so that it won't start until after openafs-client is started and /afs is mounted (the latter because we don't know if the initscript will possibly return early). Without this, it's a race to see whether the container will have a working /afs mount, so can lead to jobs failing to write into AFS with cryptic permissions errors. Change-Id: Ie00b1c1bc9c330e2af28c59b3b07a7c244c912dc
109 lines
2.5 KiB
YAML
109 lines
2.5 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: Run docker-compose pull
|
|
shell:
|
|
cmd: docker-compose pull
|
|
chdir: /etc/zuul-executor
|
|
|
|
- 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
|
|
|
|
- name: Disable old service
|
|
service:
|
|
name: zuul-executor
|
|
enabled: no
|
|
failed_when: false
|
|
|
|
- name: Remove old init script files
|
|
file:
|
|
state: absent
|
|
path: '{{ item }}'
|
|
loop:
|
|
- /etc/default/zuul-executor
|
|
- /etc/init.d/zuul-executor
|