mirror of
https://bitbucket.org/atlassian/dc-deployments-automation.git
synced 2025-12-17 18:33:06 -06:00
DCD-486: Add optional Docker installation.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
|
||||
atl_docker_install: false
|
||||
atl_product_user_uid: '2001'
|
||||
|
||||
@@ -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
|
||||
|
||||
14
roles/linux_common/molecule/docker/Dockerfile.j2
Normal file
14
roles/linux_common/molecule/docker/Dockerfile.j2
Normal 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
|
||||
27
roles/linux_common/molecule/docker/molecule.yml
Normal file
27
roles/linux_common/molecule/docker/molecule.yml
Normal 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
|
||||
8
roles/linux_common/molecule/docker/playbook.yml
Normal file
8
roles/linux_common/molecule/docker/playbook.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
vars:
|
||||
atl_product_user: "jira"
|
||||
atl_docker_install: true
|
||||
roles:
|
||||
- role: linux_common
|
||||
11
roles/linux_common/molecule/docker/tests/test_default.py
Normal file
11
roles/linux_common/molecule/docker/tests/test_default.py
Normal 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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -6,3 +6,9 @@
|
||||
- python3-psycopg2
|
||||
- libxml2-utils
|
||||
- git
|
||||
|
||||
- name: Install Docker if necessary
|
||||
apt:
|
||||
name:
|
||||
- docker.io
|
||||
when: atl_docker_install
|
||||
|
||||
Reference in New Issue
Block a user