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:
parent
c089eab392
commit
2cdcf1821d
@ -2,6 +2,8 @@
|
|||||||
- hosts: all
|
- hosts: all
|
||||||
roles:
|
roles:
|
||||||
- bindep
|
- bindep
|
||||||
|
vars_files:
|
||||||
|
- ../vars/zuul.yml
|
||||||
tasks:
|
tasks:
|
||||||
- name: Create dir for kolla logs
|
- name: Create dir for kolla logs
|
||||||
file:
|
file:
|
||||||
@ -33,3 +35,53 @@
|
|||||||
chdir: "{{ zuul.project.src_dir }}"
|
chdir: "{{ zuul.project.src_dir }}"
|
||||||
virtualenv: "{{ virtualenv_path }}"
|
virtualenv: "{{ virtualenv_path }}"
|
||||||
virtualenv_python: python3
|
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
|
||||||
|
@ -3,18 +3,6 @@
|
|||||||
vars_files:
|
vars_files:
|
||||||
- ../vars/zuul.yml
|
- ../vars/zuul.yml
|
||||||
tasks:
|
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
|
- name: Ensure /etc/kolla exists
|
||||||
file:
|
file:
|
||||||
path: /etc/kolla
|
path: /etc/kolla
|
||||||
|
@ -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."
|
|
@ -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."
|
|
Loading…
Reference in New Issue
Block a user