Moved last role to airshipctl

All roles should be developed in airshipctl roles dir

Change-Id: Ide949c95889746595d41c4db913619f7140daf35
This commit is contained in:
Stanislav Egorov 2020-03-25 13:16:36 -07:00
parent 66a1332ce9
commit 2933dfdc51
6 changed files with 89 additions and 8 deletions

View File

@ -0,0 +1,5 @@
proxy:
enabled: false
http:
https:
noproxy:

View File

@ -0,0 +1,66 @@
---
- name: Ensuring docker and support packages are present
become: true
when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux'
yum:
name:
- docker.io
- runc
update_cache: yes
state: present
- name: Ensuring docker and support packages are present
become: true
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
apt:
name:
- docker.io
- runc
update_cache: yes
state: present
- name: Ensure docker group exists
group:
name: docker
state: present
- name: Add user "{{ ansible_user }}" to docker group
become: true
user:
name: "{{ ansible_user }}"
groups:
- docker
append: yes
- name: Reset ssh connection to add docker group to user
meta: reset_connection
ignore_errors: true
- block:
- name: Create docker directory
file:
path: /etc/systemd/system/docker.service.d/
state: directory
mode: '0755'
- name: Configure proxy for docker if enabled
template:
src: http-proxy-conf.j2
dest: /etc/systemd/system/docker.service.d/http-proxy.conf
when: proxy.enabled|bool == true
become: true
- name: Start docker
become: true
systemd:
name: docker
state: restarted
daemon_reload: yes
enabled: true
- name: Change group ownership on docker sock
become: true
file:
path: /var/run/docker.sock
group: docker

View File

@ -0,0 +1,4 @@
[Service]
Environment="HTTP_PROXY={{ proxy.http }}"
Environment="HTTPS_PROXY={{ proxy.https }}"
Environment="NO_PROXY={{ proxy.noproxy }}"

View File

@ -0,0 +1,13 @@
- name: install docker
include_role:
name: docker-install
- name: check if docker is installed
shell: "docker version"
register: docker_version
- name: verify docker is installed
assert:
that:
- docker_version.rc == 0

View File

@ -27,7 +27,6 @@ export TMP_DIR=${TMP_DIR:-"$(dirname $(mktemp -u))"}
ANSIBLE_CFG=${ANSIBLE_CFG:-"${HOME}/.ansible.cfg"}
ANSIBLE_HOSTS=${ANSIBLE_HOSTS:-"${TMP_DIR}/ansible_hosts"}
PLAYBOOK_CONFIG=${PLAYBOOK_CONFIG:-"${TMP_DIR}/config.yaml"}
OSH_INFRA_DIR=${OSH_INFRA_DIR:-"${TMP_DIR}/openstack-helm-infra"}
mkdir -p "$TMP_DIR"
envsubst <"${AIRSHIPCTL_WS}/tools/gate/config_template.yaml" > "$PLAYBOOK_CONFIG"
@ -39,6 +38,4 @@ sudo apt-get -y update
sudo apt-get -y --no-install-recommends install docker.io ansible make
echo "primary ansible_host=localhost ansible_connection=local" > "$ANSIBLE_HOSTS"
printf "[defaults]\nroles_path = %s/roles:%s/roles\n" "$AIRSHIPCTL_WS" "$OSH_INFRA_DIR" > "$ANSIBLE_CFG"
rm -rf "$OSH_INFRA_DIR"
git clone https://review.opendev.org/openstack/openstack-helm-infra.git "$OSH_INFRA_DIR"
printf "[defaults]\nroles_path = %s/roles\n" "$AIRSHIPCTL_WS" > "$ANSIBLE_CFG"

View File

@ -25,8 +25,6 @@
- job:
name: airship-airshipctl-lint-unit
roles:
- zuul: airship/zuul-airship-roles
pre-run: playbooks/airship-airshipctl-deploy-docker.yaml
run: playbooks/airship-airshipctl-lint-unit.yaml
nodeset: airship-airshipctl-single-node
@ -42,8 +40,6 @@
- job:
name: airship-airshipctl-build-image
roles:
- zuul: airship/zuul-airship-roles
nodeset: airship-airshipctl-single-node
run: playbooks/airship-airshipctl-build-images.yaml
irrelevant-files: