Make roles to fetch and backup stratums to reduce duplicate code
This commit is contained in:
parent
b6f3344689
commit
02d4d676ec
19
roles/backup-remove-strata/tasks/main.yaml
Normal file
19
roles/backup-remove-strata/tasks/main.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
---
|
||||
|
||||
- name: Find if backup {{strata}} strata exists
|
||||
stat:
|
||||
path: /bedrock/strata/{{ strata }}.backup
|
||||
register: strata_backup
|
||||
|
||||
|
||||
- name: Delete previous backup {{ strata }} strata
|
||||
ansible.builtin.shell:
|
||||
cmd: brl remove {{ strata }}.backup
|
||||
when: strata_backup.stat.exists
|
||||
|
||||
|
||||
- name: Backup old {{ strata }} strata
|
||||
ansible.builtin.shell: |
|
||||
brl disable {{ strata }}
|
||||
brl rename {{ strata }} {{ strata }}.backup
|
||||
brl hide {{ strata }}.backup
|
9
roles/fetch-strata/tasks/main.yaml
Normal file
9
roles/fetch-strata/tasks/main.yaml
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
- name: Backup and remove old {{ strata }} strata
|
||||
include_role:
|
||||
name: backup-remove-strata
|
||||
|
||||
- name: Fetch {{ strata }} strata
|
||||
ansible.builtin.shell:
|
||||
cmd: brl fetch {{ strata }}
|
||||
|
@ -1,8 +1,11 @@
|
||||
- name: fetch alpine linux
|
||||
ansible.builtin.shell:
|
||||
cmd: brl remove -d alpine; brl fetch alpine
|
||||
|
||||
- name: fetch arch linux
|
||||
ansible.builtin.shell:
|
||||
cmd: brl remove -d arch; brl fetch arch
|
||||
- name: Fetch new alpine strata
|
||||
include_role:
|
||||
name: fetch-strata
|
||||
vars:
|
||||
strata: alpine
|
||||
|
||||
- name: Fetch new arch linux
|
||||
include_role:
|
||||
name: fetch-strata
|
||||
vars:
|
||||
strata: arch
|
||||
|
Loading…
Reference in New Issue
Block a user