mirror of
https://bitbucket.org/atlassian/dc-deployments-automation.git
synced 2025-12-13 16:33:08 -06:00
DCD-386: Start of DIY backup installation.
This commit is contained in:
3
roles/diy_backup/defaults/main.yml
Normal file
3
roles/diy_backup/defaults/main.yml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
atl_diy_backup_dir: "{{ atl_installation_base }}/bitbucket-diy-backup"
|
||||||
14
roles/diy_backup/molecule/default/Dockerfile.j2
Normal file
14
roles/diy_backup/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
|
||||||
36
roles/diy_backup/molecule/default/molecule.yml
Normal file
36
roles/diy_backup/molecule/default/molecule.yml
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
---
|
||||||
|
dependency:
|
||||||
|
name: galaxy
|
||||||
|
driver:
|
||||||
|
name: docker
|
||||||
|
lint:
|
||||||
|
name: yamllint
|
||||||
|
platforms:
|
||||||
|
- name: amazon_linux2
|
||||||
|
image: amazonlinux:2
|
||||||
|
groups:
|
||||||
|
- aws_node_local
|
||||||
|
ulimits:
|
||||||
|
- nofile:262144:262144
|
||||||
|
- name: ubuntu_lts
|
||||||
|
image: ubuntu:bionic
|
||||||
|
groups:
|
||||||
|
- aws_node_local
|
||||||
|
ulimits:
|
||||||
|
- nofile:262144:262144
|
||||||
|
provisioner:
|
||||||
|
name: ansible
|
||||||
|
options:
|
||||||
|
skip-tags: runtime_pkg
|
||||||
|
lint:
|
||||||
|
name: ansible-lint
|
||||||
|
options:
|
||||||
|
x: ["701"]
|
||||||
|
inventory:
|
||||||
|
links:
|
||||||
|
group_vars: ../../../../group_vars/
|
||||||
|
verifier:
|
||||||
|
name: testinfra
|
||||||
|
lint:
|
||||||
|
name: flake8
|
||||||
|
enabled: false
|
||||||
20
roles/diy_backup/molecule/default/playbook.yml
Normal file
20
roles/diy_backup/molecule/default/playbook.yml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
- name: Converge
|
||||||
|
hosts: all
|
||||||
|
vars:
|
||||||
|
atl_product_user: "bitbucket"
|
||||||
|
atl_product_family: "stash"
|
||||||
|
atl_product_edition: "bitbucket"
|
||||||
|
|
||||||
|
pre_tasks:
|
||||||
|
- name: Create base dir
|
||||||
|
file:
|
||||||
|
path: '/opt/atlassian/'
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: Install git
|
||||||
|
package:
|
||||||
|
name: git
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- role: diy_backup
|
||||||
12
roles/diy_backup/molecule/default/tests/test_default.py
Normal file
12
roles/diy_backup/molecule/default/tests/test_default.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
import testinfra.utils.ansible_runner
|
||||||
|
|
||||||
|
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
||||||
|
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
|
||||||
|
|
||||||
|
|
||||||
|
def test_git_clone(host):
|
||||||
|
f = host.file('/opt/atlassian/bitbucket-diy-backup')
|
||||||
|
assert f.exists
|
||||||
|
assert f.is_directory
|
||||||
7
roles/diy_backup/tasks/main.yml
Normal file
7
roles/diy_backup/tasks/main.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
- name: Fetch the DIY backups repository
|
||||||
|
git:
|
||||||
|
repo: "https://bitbucket.org/atlassianlabs/atlassian-bitbucket-diy-backup.git"
|
||||||
|
dest: "{{ atl_diy_backup_dir }}"
|
||||||
Reference in New Issue
Block a user