mirror of
https://bitbucket.org/atlassian/dc-deployments-automation.git
synced 2025-12-14 00:43:06 -06:00
Merged in DCD-880-create-playbook-to-run-slingshot (pull request #65)
DCD-880 create playbook to run slingshot Approved-by: Varun Arbatti
This commit is contained in:
14
aws_slingshot_backup.yml
Normal file
14
aws_slingshot_backup.yml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# Runs atlassian-slingshot to backup your product instance. Should be run when there is only 1 app node (i.e server or single node cluster)
|
||||||
|
# Params
|
||||||
|
# Required
|
||||||
|
# atl_product_edition - one of "confluence", "jira", or "bitbucket".
|
||||||
|
# atl_product_family - should be the same as the "atl_product_edition"
|
||||||
|
# atl_slingshot_backup_dir - working directory for the backup, should be large enough to fit database and shared home dumps
|
||||||
|
# atl_s3_backup_bucket - s3 bucket to upload your backup to
|
||||||
|
# atl_s3_backup_region - AWS region where the s3 bucket is deployed
|
||||||
|
#
|
||||||
|
# There are other variables which can be overriden. See the tasks for details. The will be defaulted by the role defaults or the inventory group_vars
|
||||||
|
|
||||||
|
- hosts: aws_node_local
|
||||||
|
roles:
|
||||||
|
- role: create_backups
|
||||||
@@ -20,6 +20,7 @@ set +a
|
|||||||
pipenv run \
|
pipenv run \
|
||||||
ansible-playbook -v \
|
ansible-playbook -v \
|
||||||
$ATL_DEPLOYMENT_REPOSITORY_CUSTOM_PARAMS \
|
$ATL_DEPLOYMENT_REPOSITORY_CUSTOM_PARAMS \
|
||||||
|
-e "${PLAYBOOK_INVOCATION_EXTRA_PARAMS}" \
|
||||||
-i $INV \
|
-i $INV \
|
||||||
$PLAYBOOK \
|
$PLAYBOOK \
|
||||||
2>&1 | tee --append $LOG_FILE
|
2>&1 | tee --append $LOG_FILE
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ pipelines:
|
|||||||
- step:
|
- step:
|
||||||
name: Pre Parallelization stage
|
name: Pre Parallelization stage
|
||||||
script:
|
script:
|
||||||
- echo "Running tests in 33 batches"
|
- echo "Running tests in 34 batches"
|
||||||
- step:
|
- step:
|
||||||
name: Check if number of batches match actual number of scenarios
|
name: Check if number of batches match actual number of scenarios
|
||||||
script:
|
script:
|
||||||
@@ -38,7 +38,7 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- apt-get update && ./bin/install-ansible --dev
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
- ./bin/run-tests-in-batches --batch 1
|
- ./bin/run-tests-in-batches --batch 1
|
||||||
|
|
||||||
- step:
|
- step:
|
||||||
name: Molecule Test Batch - 2
|
name: Molecule Test Batch - 2
|
||||||
services:
|
services:
|
||||||
@@ -46,7 +46,7 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- apt-get update && ./bin/install-ansible --dev
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
- ./bin/run-tests-in-batches --batch 2
|
- ./bin/run-tests-in-batches --batch 2
|
||||||
|
|
||||||
- step:
|
- step:
|
||||||
name: Molecule Test Batch - 3
|
name: Molecule Test Batch - 3
|
||||||
services:
|
services:
|
||||||
@@ -54,7 +54,7 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- apt-get update && ./bin/install-ansible --dev
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
- ./bin/run-tests-in-batches --batch 3
|
- ./bin/run-tests-in-batches --batch 3
|
||||||
|
|
||||||
- step:
|
- step:
|
||||||
name: Molecule Test Batch - 4
|
name: Molecule Test Batch - 4
|
||||||
services:
|
services:
|
||||||
@@ -62,7 +62,7 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- apt-get update && ./bin/install-ansible --dev
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
- ./bin/run-tests-in-batches --batch 4
|
- ./bin/run-tests-in-batches --batch 4
|
||||||
|
|
||||||
- step:
|
- step:
|
||||||
name: Molecule Test Batch - 5
|
name: Molecule Test Batch - 5
|
||||||
services:
|
services:
|
||||||
@@ -70,7 +70,7 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- apt-get update && ./bin/install-ansible --dev
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
- ./bin/run-tests-in-batches --batch 5
|
- ./bin/run-tests-in-batches --batch 5
|
||||||
|
|
||||||
- step:
|
- step:
|
||||||
name: Molecule Test Batch - 6
|
name: Molecule Test Batch - 6
|
||||||
services:
|
services:
|
||||||
@@ -78,7 +78,7 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- apt-get update && ./bin/install-ansible --dev
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
- ./bin/run-tests-in-batches --batch 6
|
- ./bin/run-tests-in-batches --batch 6
|
||||||
|
|
||||||
- step:
|
- step:
|
||||||
name: Molecule Test Batch - 7
|
name: Molecule Test Batch - 7
|
||||||
services:
|
services:
|
||||||
@@ -86,7 +86,7 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- apt-get update && ./bin/install-ansible --dev
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
- ./bin/run-tests-in-batches --batch 7
|
- ./bin/run-tests-in-batches --batch 7
|
||||||
|
|
||||||
- step:
|
- step:
|
||||||
name: Molecule Test Batch - 8
|
name: Molecule Test Batch - 8
|
||||||
services:
|
services:
|
||||||
@@ -94,7 +94,7 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- apt-get update && ./bin/install-ansible --dev
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
- ./bin/run-tests-in-batches --batch 8
|
- ./bin/run-tests-in-batches --batch 8
|
||||||
|
|
||||||
- step:
|
- step:
|
||||||
name: Molecule Test Batch - 9
|
name: Molecule Test Batch - 9
|
||||||
services:
|
services:
|
||||||
@@ -102,7 +102,7 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- apt-get update && ./bin/install-ansible --dev
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
- ./bin/run-tests-in-batches --batch 9
|
- ./bin/run-tests-in-batches --batch 9
|
||||||
|
|
||||||
- step:
|
- step:
|
||||||
name: Molecule Test Batch - 10
|
name: Molecule Test Batch - 10
|
||||||
services:
|
services:
|
||||||
@@ -110,7 +110,7 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- apt-get update && ./bin/install-ansible --dev
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
- ./bin/run-tests-in-batches --batch 10
|
- ./bin/run-tests-in-batches --batch 10
|
||||||
|
|
||||||
- step:
|
- step:
|
||||||
name: Molecule Test Batch - 11
|
name: Molecule Test Batch - 11
|
||||||
services:
|
services:
|
||||||
@@ -118,7 +118,7 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- apt-get update && ./bin/install-ansible --dev
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
- ./bin/run-tests-in-batches --batch 11
|
- ./bin/run-tests-in-batches --batch 11
|
||||||
|
|
||||||
- step:
|
- step:
|
||||||
name: Molecule Test Batch - 12
|
name: Molecule Test Batch - 12
|
||||||
services:
|
services:
|
||||||
@@ -126,7 +126,7 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- apt-get update && ./bin/install-ansible --dev
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
- ./bin/run-tests-in-batches --batch 12
|
- ./bin/run-tests-in-batches --batch 12
|
||||||
|
|
||||||
- step:
|
- step:
|
||||||
name: Molecule Test Batch - 13
|
name: Molecule Test Batch - 13
|
||||||
services:
|
services:
|
||||||
@@ -134,7 +134,7 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- apt-get update && ./bin/install-ansible --dev
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
- ./bin/run-tests-in-batches --batch 13
|
- ./bin/run-tests-in-batches --batch 13
|
||||||
|
|
||||||
- step:
|
- step:
|
||||||
name: Molecule Test Batch - 14
|
name: Molecule Test Batch - 14
|
||||||
services:
|
services:
|
||||||
@@ -142,7 +142,7 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- apt-get update && ./bin/install-ansible --dev
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
- ./bin/run-tests-in-batches --batch 14
|
- ./bin/run-tests-in-batches --batch 14
|
||||||
|
|
||||||
- step:
|
- step:
|
||||||
name: Molecule Test Batch - 15
|
name: Molecule Test Batch - 15
|
||||||
services:
|
services:
|
||||||
@@ -150,7 +150,7 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- apt-get update && ./bin/install-ansible --dev
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
- ./bin/run-tests-in-batches --batch 15
|
- ./bin/run-tests-in-batches --batch 15
|
||||||
|
|
||||||
- step:
|
- step:
|
||||||
name: Molecule Test Batch - 16
|
name: Molecule Test Batch - 16
|
||||||
services:
|
services:
|
||||||
@@ -158,7 +158,7 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- apt-get update && ./bin/install-ansible --dev
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
- ./bin/run-tests-in-batches --batch 16
|
- ./bin/run-tests-in-batches --batch 16
|
||||||
|
|
||||||
- step:
|
- step:
|
||||||
name: Molecule Test Batch - 17
|
name: Molecule Test Batch - 17
|
||||||
services:
|
services:
|
||||||
@@ -166,7 +166,7 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- apt-get update && ./bin/install-ansible --dev
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
- ./bin/run-tests-in-batches --batch 17
|
- ./bin/run-tests-in-batches --batch 17
|
||||||
|
|
||||||
- step:
|
- step:
|
||||||
name: Molecule Test Batch - 18
|
name: Molecule Test Batch - 18
|
||||||
services:
|
services:
|
||||||
@@ -174,7 +174,7 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- apt-get update && ./bin/install-ansible --dev
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
- ./bin/run-tests-in-batches --batch 18
|
- ./bin/run-tests-in-batches --batch 18
|
||||||
|
|
||||||
- step:
|
- step:
|
||||||
name: Molecule Test Batch - 19
|
name: Molecule Test Batch - 19
|
||||||
services:
|
services:
|
||||||
@@ -182,7 +182,7 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- apt-get update && ./bin/install-ansible --dev
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
- ./bin/run-tests-in-batches --batch 19
|
- ./bin/run-tests-in-batches --batch 19
|
||||||
|
|
||||||
- step:
|
- step:
|
||||||
name: Molecule Test Batch - 20
|
name: Molecule Test Batch - 20
|
||||||
services:
|
services:
|
||||||
@@ -190,7 +190,7 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- apt-get update && ./bin/install-ansible --dev
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
- ./bin/run-tests-in-batches --batch 20
|
- ./bin/run-tests-in-batches --batch 20
|
||||||
|
|
||||||
- step:
|
- step:
|
||||||
name: Molecule Test Batch - 21
|
name: Molecule Test Batch - 21
|
||||||
services:
|
services:
|
||||||
@@ -198,7 +198,7 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- apt-get update && ./bin/install-ansible --dev
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
- ./bin/run-tests-in-batches --batch 21
|
- ./bin/run-tests-in-batches --batch 21
|
||||||
|
|
||||||
- step:
|
- step:
|
||||||
name: Molecule Test Batch - 22
|
name: Molecule Test Batch - 22
|
||||||
services:
|
services:
|
||||||
@@ -206,7 +206,7 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- apt-get update && ./bin/install-ansible --dev
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
- ./bin/run-tests-in-batches --batch 22
|
- ./bin/run-tests-in-batches --batch 22
|
||||||
|
|
||||||
- step:
|
- step:
|
||||||
name: Molecule Test Batch - 23
|
name: Molecule Test Batch - 23
|
||||||
services:
|
services:
|
||||||
@@ -214,7 +214,7 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- apt-get update && ./bin/install-ansible --dev
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
- ./bin/run-tests-in-batches --batch 23
|
- ./bin/run-tests-in-batches --batch 23
|
||||||
|
|
||||||
- step:
|
- step:
|
||||||
name: Molecule Test Batch - 24
|
name: Molecule Test Batch - 24
|
||||||
services:
|
services:
|
||||||
@@ -222,7 +222,7 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- apt-get update && ./bin/install-ansible --dev
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
- ./bin/run-tests-in-batches --batch 24
|
- ./bin/run-tests-in-batches --batch 24
|
||||||
|
|
||||||
- step:
|
- step:
|
||||||
name: Molecule Test Batch - 25
|
name: Molecule Test Batch - 25
|
||||||
services:
|
services:
|
||||||
@@ -230,7 +230,7 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- apt-get update && ./bin/install-ansible --dev
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
- ./bin/run-tests-in-batches --batch 25
|
- ./bin/run-tests-in-batches --batch 25
|
||||||
|
|
||||||
- step:
|
- step:
|
||||||
name: Molecule Test Batch - 26
|
name: Molecule Test Batch - 26
|
||||||
services:
|
services:
|
||||||
@@ -238,7 +238,7 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- apt-get update && ./bin/install-ansible --dev
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
- ./bin/run-tests-in-batches --batch 26
|
- ./bin/run-tests-in-batches --batch 26
|
||||||
|
|
||||||
- step:
|
- step:
|
||||||
name: Molecule Test Batch - 27
|
name: Molecule Test Batch - 27
|
||||||
services:
|
services:
|
||||||
@@ -246,7 +246,7 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- apt-get update && ./bin/install-ansible --dev
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
- ./bin/run-tests-in-batches --batch 27
|
- ./bin/run-tests-in-batches --batch 27
|
||||||
|
|
||||||
- step:
|
- step:
|
||||||
name: Molecule Test Batch - 28
|
name: Molecule Test Batch - 28
|
||||||
services:
|
services:
|
||||||
@@ -254,7 +254,7 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- apt-get update && ./bin/install-ansible --dev
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
- ./bin/run-tests-in-batches --batch 28
|
- ./bin/run-tests-in-batches --batch 28
|
||||||
|
|
||||||
- step:
|
- step:
|
||||||
name: Molecule Test Batch - 29
|
name: Molecule Test Batch - 29
|
||||||
services:
|
services:
|
||||||
@@ -262,7 +262,7 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- apt-get update && ./bin/install-ansible --dev
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
- ./bin/run-tests-in-batches --batch 29
|
- ./bin/run-tests-in-batches --batch 29
|
||||||
|
|
||||||
- step:
|
- step:
|
||||||
name: Molecule Test Batch - 30
|
name: Molecule Test Batch - 30
|
||||||
services:
|
services:
|
||||||
@@ -270,7 +270,7 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- apt-get update && ./bin/install-ansible --dev
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
- ./bin/run-tests-in-batches --batch 30
|
- ./bin/run-tests-in-batches --batch 30
|
||||||
|
|
||||||
- step:
|
- step:
|
||||||
name: Molecule Test Batch - 31
|
name: Molecule Test Batch - 31
|
||||||
services:
|
services:
|
||||||
@@ -278,7 +278,7 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- apt-get update && ./bin/install-ansible --dev
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
- ./bin/run-tests-in-batches --batch 31
|
- ./bin/run-tests-in-batches --batch 31
|
||||||
|
|
||||||
- step:
|
- step:
|
||||||
name: Molecule Test Batch - 32
|
name: Molecule Test Batch - 32
|
||||||
services:
|
services:
|
||||||
@@ -286,7 +286,7 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- apt-get update && ./bin/install-ansible --dev
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
- ./bin/run-tests-in-batches --batch 32
|
- ./bin/run-tests-in-batches --batch 32
|
||||||
|
|
||||||
- step:
|
- step:
|
||||||
name: Molecule Test Batch - 33
|
name: Molecule Test Batch - 33
|
||||||
services:
|
services:
|
||||||
@@ -294,3 +294,13 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- apt-get update && ./bin/install-ansible --dev
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
- ./bin/run-tests-in-batches --batch 33
|
- ./bin/run-tests-in-batches --batch 33
|
||||||
|
|
||||||
|
- step:
|
||||||
|
name: Molecule Test Batch - 34
|
||||||
|
services:
|
||||||
|
- docker
|
||||||
|
script:
|
||||||
|
- apt-get update && ./bin/install-ansible --dev
|
||||||
|
- ./bin/run-tests-in-batches --batch 34
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
33
roles/create_backups/.yamllint
Normal file
33
roles/create_backups/.yamllint
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
---
|
||||||
|
# Based on ansible-lint config
|
||||||
|
extends: default
|
||||||
|
|
||||||
|
rules:
|
||||||
|
braces:
|
||||||
|
max-spaces-inside: 1
|
||||||
|
level: error
|
||||||
|
brackets:
|
||||||
|
max-spaces-inside: 1
|
||||||
|
level: error
|
||||||
|
colons:
|
||||||
|
max-spaces-after: -1
|
||||||
|
level: error
|
||||||
|
commas:
|
||||||
|
max-spaces-after: -1
|
||||||
|
level: error
|
||||||
|
comments: disable
|
||||||
|
comments-indentation: disable
|
||||||
|
document-start: disable
|
||||||
|
empty-lines:
|
||||||
|
max: 3
|
||||||
|
level: error
|
||||||
|
hyphens:
|
||||||
|
level: error
|
||||||
|
indentation: disable
|
||||||
|
key-duplicates: enable
|
||||||
|
line-length: disable
|
||||||
|
new-line-at-end-of-file: disable
|
||||||
|
new-lines:
|
||||||
|
type: unix
|
||||||
|
trailing-spaces: disable
|
||||||
|
truthy: disable
|
||||||
11
roles/create_backups/defaults/main.yml
Normal file
11
roles/create_backups/defaults/main.yml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
atl_db_port: 5432
|
||||||
|
atl_systemd_service_name: "{{ atl_product_edition }}.service"
|
||||||
|
|
||||||
|
atl_slingshot_yum_repo_url: 'https://packages.atlassian.com/atlassian-slingshot-rpm'
|
||||||
|
atl_amazon_extras_postgresql_version: '9.6'
|
||||||
|
|
||||||
|
atl_slingshot_deb_pubkey_url: 'https://packages.atlassian.com/api/gpg/key/public'
|
||||||
|
atl_slingshot_deb_repo_url: 'https://packages.atlassian.com/atlassian-slingshot-deb'
|
||||||
|
atl_slingshot_deb_repo_components: 'stable main'
|
||||||
22
roles/create_backups/molecule/default/Dockerfile.j2
Normal file
22
roles/create_backups/molecule/default/Dockerfile.j2
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# Molecule managed
|
||||||
|
|
||||||
|
{% if item.registry is defined %}
|
||||||
|
FROM {{ item.registry.url }}/{{ item.image }}
|
||||||
|
{% else %}
|
||||||
|
FROM {{ item.image }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if item.env is defined %}
|
||||||
|
{% for var, value in item.env.items() %}
|
||||||
|
{% if value %}
|
||||||
|
ENV {{ var }} {{ value }}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates iproute2 && apt-get clean; \
|
||||||
|
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash iproute && dnf clean all; \
|
||||||
|
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash iproute && 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 iproute2 && 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 iproute2 && xbps-remove -O; fi
|
||||||
22
roles/create_backups/molecule/default/INSTALL.rst
Normal file
22
roles/create_backups/molecule/default/INSTALL.rst
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
*******
|
||||||
|
Docker driver installation guide
|
||||||
|
*******
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
============
|
||||||
|
|
||||||
|
* Docker Engine
|
||||||
|
|
||||||
|
Install
|
||||||
|
=======
|
||||||
|
|
||||||
|
Please refer to the `Virtual environment`_ documentation for installation best
|
||||||
|
practices. If not using a virtual environment, please consider passing the
|
||||||
|
widely recommended `'--user' flag`_ when invoking ``pip``.
|
||||||
|
|
||||||
|
.. _Virtual environment: https://virtualenv.pypa.io/en/latest/
|
||||||
|
.. _'--user' flag: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ pip install 'molecule[docker]'
|
||||||
20
roles/create_backups/molecule/default/molecule.yml
Normal file
20
roles/create_backups/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
|
||||||
11
roles/create_backups/molecule/default/playbook.yml
Normal file
11
roles/create_backups/molecule/default/playbook.yml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
- name: Converge
|
||||||
|
hosts: all
|
||||||
|
tasks:
|
||||||
|
# Role default vars must be included because we aren't running the whole role, just a subset of tasks
|
||||||
|
- name: Include role vars
|
||||||
|
include_vars:
|
||||||
|
file: ../../defaults/main.yml
|
||||||
|
|
||||||
|
- name: Install distro-specific backup support packages
|
||||||
|
include_tasks: "../../tasks/{{ ansible_distribution|lower }}.yml"
|
||||||
11
roles/create_backups/molecule/default/tests/test_default.py
Normal file
11
roles/create_backups/molecule/default/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_slingshot_installed(host):
|
||||||
|
assert host.file('/usr/bin/atlassian-slingshot').exists
|
||||||
|
assert host.file('/usr/bin/psql').exists
|
||||||
21
roles/create_backups/tasks/amazon.yml
Normal file
21
roles/create_backups/tasks/amazon.yml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: Add atlassian-slingshot yum repository
|
||||||
|
yum_repository:
|
||||||
|
name: AtlassianSlingshot
|
||||||
|
file: atlassian-slingshot
|
||||||
|
state: present
|
||||||
|
description: Atlassian Slingshot
|
||||||
|
baseurl: "{{ atl_slingshot_yum_repo_url }}"
|
||||||
|
gpgcheck: no
|
||||||
|
|
||||||
|
- name: Install atlassian-slingshot
|
||||||
|
yum:
|
||||||
|
name: atlassian-slingshot
|
||||||
|
|
||||||
|
- name: Enable Postgresql from 'extras'
|
||||||
|
command: amazon-linux-extras install -y "postgresql{{ atl_amazon_extras_postgresql_version }}"
|
||||||
|
args:
|
||||||
|
creates: /usr/bin/psql
|
||||||
|
environment:
|
||||||
|
PYTHON: /bin/python
|
||||||
38
roles/create_backups/tasks/main.yml
Normal file
38
roles/create_backups/tasks/main.yml
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: Install distro-specific backup support packages
|
||||||
|
include_tasks: "{{ ansible_distribution|lower }}.yml"
|
||||||
|
|
||||||
|
- name: Stop the {{ atl_product_edition }} service
|
||||||
|
service:
|
||||||
|
name: "{{ atl_systemd_service_name }}"
|
||||||
|
state: stopped
|
||||||
|
|
||||||
|
- name: Run the slingshot backup
|
||||||
|
command:
|
||||||
|
argv:
|
||||||
|
- "atlassian-slingshot"
|
||||||
|
- "backup"
|
||||||
|
- "--backupDir"
|
||||||
|
- "{{ atl_slingshot_backup_dir }}"
|
||||||
|
- "--dbHost"
|
||||||
|
- "{{ atl_db_host }}"
|
||||||
|
- "--dbPort"
|
||||||
|
- "{{ atl_db_port }}"
|
||||||
|
- "--dbUser"
|
||||||
|
- "{{ atl_jdbc_user }}"
|
||||||
|
- "--dbName"
|
||||||
|
- "{{ atl_jdbc_db_name }}"
|
||||||
|
- "--s3BucketName"
|
||||||
|
- "{{ atl_s3_backup_bucket }}"
|
||||||
|
- "--awsRegion"
|
||||||
|
- "{{ atl_s3_backup_region }}"
|
||||||
|
- "--sharedHomeLocation"
|
||||||
|
- "{{ atl_product_home_shared }}"
|
||||||
|
environment:
|
||||||
|
ATL_DB_PASSWORD: "{{ atl_jdbc_password }}"
|
||||||
|
|
||||||
|
- name: Restart the {{ atl_product_edition }} service
|
||||||
|
service:
|
||||||
|
name: "{{ atl_systemd_service_name }}"
|
||||||
|
state: restarted
|
||||||
27
roles/create_backups/tasks/ubuntu.yml
Normal file
27
roles/create_backups/tasks/ubuntu.yml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
---
|
||||||
|
- name: Install gnupg
|
||||||
|
apt:
|
||||||
|
name: gnupg
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Add atlassian-slingshot debian repo public key
|
||||||
|
apt_key:
|
||||||
|
url: "{{ atl_slingshot_deb_pubkey_url }}"
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Add atlassian-slingshot debian repository
|
||||||
|
apt_repository:
|
||||||
|
repo: "deb {{ atl_slingshot_deb_repo_url }} {{ atl_slingshot_deb_repo_components }}"
|
||||||
|
state: present
|
||||||
|
filename: atlassian-slingshot
|
||||||
|
|
||||||
|
- name: Install atlassian-slingshot
|
||||||
|
apt:
|
||||||
|
name: atlassian-slingshot
|
||||||
|
update_cache: yes
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Install postgresql
|
||||||
|
apt:
|
||||||
|
name: postgresql
|
||||||
|
state: present
|
||||||
Reference in New Issue
Block a user