forked from usegalaxy-au/infrastructure
-
Notifications
You must be signed in to change notification settings - Fork 0
/
galaxy-backup_playbook.yml
49 lines (49 loc) · 1.56 KB
/
galaxy-backup_playbook.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
- hosts: galaxy-backup
become: true
vars_files:
- group_vars/all.yml
- group_vars/galaxy_etca.yml
- group_vars/VAULT
- host_vars/galaxy-backup.yml
- secret_group_vars/stats_server_vault
- secret_group_vars/ubuntu_maintenance_key
pre_tasks:
- name: Attach volume to instance
include_role:
name: attached-volumes
vars:
- galaxy_backup_ansible_version: '5.6.0'
- galaxy_backup_ansible_venv: /home/ubuntu/venv
roles:
- common
- geerlingguy.pip
- slg.db-backup
- dj-wasabi.telegraf
post_tasks:
- name: Ensure desired version of ansible is installed
pip:
name: "ansible=={{ galaxy_backup_ansible_version }}"
umask: "0022"
virtualenv: "{{ galaxy_backup_ansible_venv }}"
- name: Clone infrastructure repo
git:
repo: https://github.com/usegalaxy-au/infrastructure
dest: /home/ubuntu/infrastructure
update: yes
become: yes
become_user: ubuntu
- name: Update ansible roles
command:
cmd: "{{ galaxy_backup_ansible_venv }}/bin/ansible-galaxy install -p roles -r requirements.yml"
chdir: /home/ubuntu/infrastructure
become: yes
become_user: ubuntu
- name: add galaxy australia authorised key
authorized_key:
user: ubuntu
state: present
key: "{{ lookup('file', 'files/keys/galaxy-australia.pub') }}"
- name: Add venv activation to ubuntu's .bashrc
lineinfile:
path: /home/ubuntu/.bashrc
line: ". {{ galaxy_backup_ansible_venv }}/bin/activate"