CI: Ansiblify setup of builders

CI is set up using Ansible playbooks now.
This also drops redundant shell scripts.

Co-authored-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>

Change-Id: I5264746fd04276448f4668c3bb3a218a40e8660b
This commit is contained in:
Radosław Piliszek 2020-03-15 15:36:47 +01:00 committed by Marcin Juszkiewicz
parent c089eab392
commit 2cdcf1821d
4 changed files with 52 additions and 53 deletions

View File

@ -2,6 +2,8 @@
- hosts: all
roles:
- bindep
vars_files:
- ../vars/zuul.yml
tasks:
- name: Create dir for kolla logs
file:
@ -33,3 +35,53 @@
chdir: "{{ zuul.project.src_dir }}"
virtualenv: "{{ virtualenv_path }}"
virtualenv_python: python3
- name: Configure Docker repo for Debian/Ubuntu
block:
- name: Add key for Docker APT repository
apt_key:
url: "{{ nodepool_docker_proxy }}/{{ ansible_distribution | lower }}/gpg"
state: present
- name: Add Docker APT repository
apt_repository:
repo: "deb {{ nodepool_docker_proxy }}/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable"
state: present
when: ansible_os_family == "Debian"
become: true
- name: Configure Docker repo for CentOS
block:
- name: Add Docker YUM repository
yum_repository:
name: docker
description: Docker
baseurl: "{{ nodepool_docker_proxy }}/centos/7/$basearch/stable"
enabled: yes
gpgcheck: yes
gpgkey: "{{ nodepool_docker_proxy }}/centos/gpg"
# module_hotfixes: True # enabled below (dnf, not yum, feature)
- name: Enable module_hotfixes in Docker YUM repository
lineinfile:
path: /etc/yum.repos.d/docker.repo
line: 'module_hotfixes=True'
when: ansible_os_family == "RedHat"
become: true
- name: Install Docker
package:
name: docker-ce
become: true
- name: Ensure Docker service is started
service:
name: docker
state: started
become: true
- name: Ensure Docker socket is world-writable
file:
path: /run/docker.sock
mode: 0666
become: true

View File

@ -3,18 +3,6 @@
vars_files:
- ../vars/zuul.yml
tasks:
- name: Run node setup script
script: "{{ zuul.executor.work_root }}/{{ zuul.project.src_dir }}/tools/setup_{{ ansible_os_family }}.sh"
become: true
environment:
DOCKER_REPOS_MIRROR_URL: "{{ nodepool_docker_proxy }}"
- name: changing permission of Docker socket to 666
file:
path: /run/docker.sock
mode: 666
become: true
- name: Ensure /etc/kolla exists
file:
path: /etc/kolla

View File

@ -1,21 +0,0 @@
#!/bin/bash
set -o xtrace
set -o errexit
# (SamYaple)TODO: Remove the path overriding
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# Setup Docker repo and add signing key
distro_id=$(lsb_release -is)
distro_id=${distro_id,,}
distro_codename=$(lsb_release -cs)
sudo add-apt-repository "deb $DOCKER_REPOS_MIRROR_URL/${distro_id} ${distro_codename} stable"
curl -fsSL $DOCKER_REPOS_MIRROR_URL/${distro_id}/gpg | sudo apt-key add -
sudo apt-get update
sudo apt-get -y install --no-install-recommends docker-ce
sudo docker info
echo "Completed $0."

View File

@ -1,20 +0,0 @@
#!/bin/bash
set -o xtrace
set -o errexit
sudo tee /etc/yum.repos.d/docker-ce-stable.repo << EOF
[docker-ce-stable]
baseurl=$DOCKER_REPOS_MIRROR_URL/centos/7/\$basearch/stable
enabled=1
gpgcheck=1
gpgkey=$DOCKER_REPOS_MIRROR_URL/centos/gpg
module_hotfixes=True
EOF
sudo dnf -y install docker-ce
sudo systemctl start docker
sudo docker info
echo "Completed $0."