DCD-486: Add optional Docker installation.

This commit is contained in:
Steve Smith
2019-07-17 13:48:57 +10:00
parent 0d2a12a27c
commit 0a6769a8bd
9 changed files with 76 additions and 0 deletions

View File

@@ -8,6 +8,8 @@
atl_product_user: "jira"
atl_product_edition: "jira-{{ lookup('env', 'ATL_PRODUCT_EDITION') | lower }}"
alt_docker_install: true
roles:
- role: linux_common
- role: aws_common

View File

@@ -1,3 +1,4 @@
---
atl_docker_install: false
atl_product_user_uid: '2001'

View File

@@ -14,3 +14,4 @@ def test_user_prereq(host):
def test_support_packages(host):
assert host.file('/usr/bin/jq').exists
assert host.file('/usr/bin/curl').exists
assert not host.file('/usr/bin/docker').exists

View File

@@ -0,0 +1,14 @@
# Molecule managed
{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi

View File

@@ -0,0 +1,27 @@
---
dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
platforms:
- name: amazon_linux2
image: amazonlinux:2
groups:
- aws_node_local
- name: ubuntu_lts
image: ubuntu:bionic
groups:
- aws_node_local
provisioner:
name: ansible
lint:
name: ansible-lint
inventory:
links:
group_vars: ../../../../group_vars/
verifier:
name: testinfra
lint:
name: flake8

View File

@@ -0,0 +1,8 @@
---
- name: Converge
hosts: all
vars:
atl_product_user: "jira"
atl_docker_install: true
roles:
- role: linux_common

View File

@@ -0,0 +1,11 @@
import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_support_packages(host):
assert host.file('/usr/bin/docker').exists

View File

@@ -6,3 +6,9 @@
- shadow-utils
- libxml2
- git-{{ git_version }}
- name: Install Docker if necessary
command: amazon-linux-extras install -y docker
args:
creates: /usr/bin/docker
when: atl_docker_install

View File

@@ -6,3 +6,9 @@
- python3-psycopg2
- libxml2-utils
- git
- name: Install Docker if necessary
apt:
name:
- docker.io
when: atl_docker_install