152 lines
3.8 KiB
YAML
152 lines
3.8 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: Atomic for focal
|
|
when: ansible_distribution_version is version('20.04', '>=')
|
|
include_role:
|
|
name: install-apt-repo
|
|
vars:
|
|
repo_name: projectatomic
|
|
repo_key: "{{ libcontainers_apt_key }}"
|
|
repo_content: "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_{{ ansible_lsb.release }}/ /"
|
|
|
|
- name: Install bindep
|
|
pip:
|
|
name: bindep
|
|
state: present
|
|
executable: pip3
|
|
become: yes
|
|
|
|
- name: Install extra packages
|
|
package:
|
|
name: '{{ item }}'
|
|
state: present
|
|
loop:
|
|
- bubblewrap
|
|
- skopeo
|
|
- socat
|
|
|
|
- name: Install distro-specific executor extra packages
|
|
package:
|
|
name: '{{ item }}'
|
|
state: present
|
|
loop: '{{ zuul_executor_extra_packages }}'
|
|
|
|
- name: Clone zuul repo
|
|
git:
|
|
repo: https://opendev.org/zuul/zuul
|
|
dest: /opt/zuul
|
|
force: yes
|
|
register: zuul_repo
|
|
|
|
- name: Install zuul bindep packages
|
|
shell:
|
|
cmd: apt-get install -y $(bindep -b compile)
|
|
chdir: /opt/zuul
|
|
when: zuul_repo is changed
|
|
|
|
- name: Install zuul
|
|
shell:
|
|
cmd: pip3 install .
|
|
chdir: /opt/zuul
|
|
when: zuul_repo is changed
|
|
|
|
- name: Run zuul-manage-ansible
|
|
shell:
|
|
cmd: zuul-manage-ansible
|
|
environment:
|
|
ANSIBLE_EXTRA_PACKAGES: gear
|
|
when: zuul_repo is changed
|
|
|
|
- name: Install kubectl
|
|
include_role:
|
|
name: install-kubectl
|
|
|
|
# This checks the current installed ara version with pip list and the
|
|
# latest version of ara on pypi with pip search and if they are different
|
|
# then we know we need to upgrade to reconcile the local version with
|
|
# the upstream version.
|
|
#
|
|
# We do this using this check here rather than a pip package resource so
|
|
# that ara's deps don't inadverdently update zuuls deps (specifically
|
|
# ansible).
|
|
- name: Install ARA safely
|
|
shell: |
|
|
if test $(pip3 list --format columns | sed -ne 's/^ara\s\+\([.0-9]\+\)\s\+$/\1/p') != $(pip3 search 'ara$' | sed -ne 's/^ara (\(.*\)).*$/\1/p') ; then
|
|
pip3 install --upgrade --upgrade-strategy=only-if-needed "ara<1.0.0"
|
|
fi
|
|
|
|
- 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: Install defaults file
|
|
template:
|
|
src: zuul-executor.defaults.j2
|
|
dest: /etc/default/zuul-executor
|
|
|
|
- name: Install init script
|
|
copy:
|
|
src: zuul-executor.init
|
|
dest: /etc/init.d/zuul-executor
|
|
mode: 0555
|
|
register: install_init_script
|
|
|
|
- name: Register script with systemd
|
|
shell:
|
|
cmd: /bin/systemctl daemon-reload
|
|
when: install_init_script is changed
|