mirror of
https://bitbucket.org/atlassian/dc-deployments-automation.git
synced 2025-12-14 00:43:06 -06:00
DCD-686: Initial manifest download logic.
This commit is contained in:
@@ -126,3 +126,5 @@ atl_rds_instance_class: "{{ lookup('env', 'ATL_RDS_INSTANCE_CLASS') }}"
|
|||||||
atl_rds_multi_az: "{{ lookup('env', 'ATL_RDS_MULTI_AZ') }}"
|
atl_rds_multi_az: "{{ lookup('env', 'ATL_RDS_MULTI_AZ') }}"
|
||||||
atl_rds_subnet_group_name: "{{ lookup('env', 'ATL_RDS_SUBNET_GROUP_NAME') }}"
|
atl_rds_subnet_group_name: "{{ lookup('env', 'ATL_RDS_SUBNET_GROUP_NAME') }}"
|
||||||
atl_rds_security_group: "{{ lookup('env', 'ATL_RDS_SECURITY_GROUP') }}"
|
atl_rds_security_group: "{{ lookup('env', 'ATL_RDS_SECURITY_GROUP') }}"
|
||||||
|
|
||||||
|
atl_backup_manifest_url: "{{ lookup('env', 'ATL_BACKUP_MANIFEST_URL) }}"
|
||||||
|
|||||||
14
roles/restore_metadata/molecule/default/Dockerfile.j2
Normal file
14
roles/restore_metadata/molecule/default/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
|
||||||
20
roles/restore_metadata/molecule/default/molecule.yml
Normal file
20
roles/restore_metadata/molecule/default/molecule.yml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
dependency:
|
||||||
|
name: galaxy
|
||||||
|
driver:
|
||||||
|
name: docker
|
||||||
|
lint:
|
||||||
|
name: yamllint
|
||||||
|
platforms:
|
||||||
|
- name: amazon_linux2
|
||||||
|
image: amazonlinux:2
|
||||||
|
- name: ubuntu_lts
|
||||||
|
image: ubuntu:bionic
|
||||||
|
provisioner:
|
||||||
|
name: ansible
|
||||||
|
lint:
|
||||||
|
name: ansible-lint
|
||||||
|
verifier:
|
||||||
|
name: testinfra
|
||||||
|
lint:
|
||||||
|
name: flake8
|
||||||
12
roles/restore_metadata/molecule/default/playbook.yml
Normal file
12
roles/restore_metadata/molecule/default/playbook.yml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
- name: Converge
|
||||||
|
hosts: all
|
||||||
|
vars:
|
||||||
|
atl_product_user: "testuser"
|
||||||
|
atl_product_home: "/opt/atlassian/product"
|
||||||
|
atl_product_installation_base: "/opt/atlassian/product/install"
|
||||||
|
atl_installer_temp: "/opt/atlassian/temp"
|
||||||
|
atl_product_home_shared: "/media/atl/jira/shared"
|
||||||
|
atl_product_shared_plugins: "/media/atl/jira/shared/plugins/"
|
||||||
|
roles:
|
||||||
|
- role: restore_metadata
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
import os
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
import testinfra.utils.ansible_runner
|
||||||
|
|
||||||
|
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
||||||
|
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
|
||||||
|
|
||||||
|
|
||||||
|
def test_user_created(host):
|
||||||
|
user = host.user('testuser')
|
||||||
|
assert user.exists
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('exe', [
|
||||||
|
'/usr/bin/git'
|
||||||
|
])
|
||||||
|
def test_package_exes(host, exe):
|
||||||
|
assert host.file(exe).exists
|
||||||
26
roles/restore_metadata/tasks/main.yml
Normal file
26
roles/restore_metadata/tasks/main.yml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- block:
|
||||||
|
|
||||||
|
- name: Parse the manifest URL
|
||||||
|
set_fact:
|
||||||
|
atl_backup_manifest_scheme: "{{ atl_backup_manifest_url | urlsplit('scheme') }}"
|
||||||
|
atl_backup_manifest_bucket: "{{ atl_backup_manifest_url | urlsplit('hostname') }}"
|
||||||
|
atl_backup_manifest_path: "{{ atl_backup_manifest_url | urlsplit('path') }}"
|
||||||
|
atl_backup_manifest_filename: "{{ atl_backup_manifest_path | basename}}"
|
||||||
|
atl_backup_manifest_dest: "{{ atl_installer_temp }}/{{ atl_backup_manifest_filename }}"
|
||||||
|
|
||||||
|
- name: Fetch the manifest from S3
|
||||||
|
aws_s3:
|
||||||
|
bucket: "{{ atl_backup_manifest | urlsplit('hostname' }}"
|
||||||
|
object: "{{ atl_backup_manifest | urlsplit('path' }}"
|
||||||
|
dest: "{{ atl_installer_temp }}/{{ atl_backup_manifest | urlsplit('path' | }}"
|
||||||
|
when: atl_backup_manifest_scheme == 's3'
|
||||||
|
|
||||||
|
- name: Fetch the manifest from remote host
|
||||||
|
get_url:
|
||||||
|
url: "{{ atl_backup_manifest_url }}"
|
||||||
|
dest: "{{ atl_backup_manifest_dest }}"
|
||||||
|
when: atl_backup_manifest_scheme != 's3'
|
||||||
|
|
||||||
|
when: atl_backup_manifest_url is defined and atl_backup_manifest_url != ''
|
||||||
Reference in New Issue
Block a user