Make roles to fetch and backup stratums to reduce duplicate code

This commit is contained in:
CactiChameleon9 2022-07-13 22:04:45 +01:00
parent b6f3344689
commit 02d4d676ec
3 changed files with 38 additions and 7 deletions

View 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

View 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 }}

View File

@ -1,8 +1,11 @@
- name: fetch alpine linux - name: Fetch new alpine strata
ansible.builtin.shell: include_role:
cmd: brl remove -d alpine; brl fetch alpine name: fetch-strata
vars:
- name: fetch arch linux strata: alpine
ansible.builtin.shell:
cmd: brl remove -d arch; brl fetch arch
- name: Fetch new arch linux
include_role:
name: fetch-strata
vars:
strata: arch