Moved last role to airshipctl
All roles should be developed in airshipctl roles dir Change-Id: Ide949c95889746595d41c4db913619f7140daf35
This commit is contained in:
parent
66a1332ce9
commit
2933dfdc51
5
roles/docker-install/defaults/main.yaml
Normal file
5
roles/docker-install/defaults/main.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
proxy:
|
||||
enabled: false
|
||||
http:
|
||||
https:
|
||||
noproxy:
|
66
roles/docker-install/tasks/main.yaml
Normal file
66
roles/docker-install/tasks/main.yaml
Normal 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
|
||||
|
4
roles/docker-install/templates/http-proxy-conf.j2
Normal file
4
roles/docker-install/templates/http-proxy-conf.j2
Normal file
@ -0,0 +1,4 @@
|
||||
[Service]
|
||||
Environment="HTTP_PROXY={{ proxy.http }}"
|
||||
Environment="HTTPS_PROXY={{ proxy.https }}"
|
||||
Environment="NO_PROXY={{ proxy.noproxy }}"
|
13
roles/docker-install/tests/main.yml
Normal file
13
roles/docker-install/tests/main.yml
Normal 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
|
||||
|
@ -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"
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user