From 5d543b3f0c7e91439cddd089baded05d288db96a Mon Sep 17 00:00:00 2001 From: Ben Partridge Date: Fri, 3 Jan 2020 13:32:27 +1100 Subject: [PATCH] DCD-880: Install postgresql as part of slingshot backup --- roles/create_backups/defaults/main.yml | 1 + .../create_backups/molecule/default/tests/test_default.py | 1 + roles/create_backups/tasks/amazon.yml | 7 ++++++- roles/create_backups/tasks/main.yml | 5 +++++ roles/create_backups/tasks/ubuntu.yml | 5 +++++ 5 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 roles/create_backups/tasks/main.yml diff --git a/roles/create_backups/defaults/main.yml b/roles/create_backups/defaults/main.yml index f687b28..5db9b36 100644 --- a/roles/create_backups/defaults/main.yml +++ b/roles/create_backups/defaults/main.yml @@ -1,5 +1,6 @@ --- 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' diff --git a/roles/create_backups/molecule/default/tests/test_default.py b/roles/create_backups/molecule/default/tests/test_default.py index 4b2be48..69b0d76 100644 --- a/roles/create_backups/molecule/default/tests/test_default.py +++ b/roles/create_backups/molecule/default/tests/test_default.py @@ -8,3 +8,4 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( def test_slingshot_installed(host): assert host.file('/usr/bin/atlassian-slingshot').exists + assert host.file('/usr/bin/psql').exists diff --git a/roles/create_backups/tasks/amazon.yml b/roles/create_backups/tasks/amazon.yml index e89b233..796ef30 100644 --- a/roles/create_backups/tasks/amazon.yml +++ b/roles/create_backups/tasks/amazon.yml @@ -11,4 +11,9 @@ - name: Install atlassian-slingshot yum: - name: atlassian-slingshot \ No newline at end of file + 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 diff --git a/roles/create_backups/tasks/main.yml b/roles/create_backups/tasks/main.yml new file mode 100644 index 0000000..a20ae3f --- /dev/null +++ b/roles/create_backups/tasks/main.yml @@ -0,0 +1,5 @@ +--- +- name: Install distro-specific backup support packages + include_tasks: "../../tasks/{{ ansible_distribution|lower }}.yml" + + \ No newline at end of file diff --git a/roles/create_backups/tasks/ubuntu.yml b/roles/create_backups/tasks/ubuntu.yml index 218c579..94476a6 100644 --- a/roles/create_backups/tasks/ubuntu.yml +++ b/roles/create_backups/tasks/ubuntu.yml @@ -19,4 +19,9 @@ apt: name: atlassian-slingshot update_cache: yes + state: present + +- name: Install postgresql + apt: + name: postgresql state: present \ No newline at end of file