bnr Use replace instead of lineinfile and grouped similar tasks in a loop

Currently when the backup is executed and the history is kept,
there was two tasks that modify the configuration adding "timestamp"
to the name of the files of a couple of variables.

The modification of the configuration was done by lineinfile, but it
added the line whether exits or not. That's why the use of the replace
module instead of lineinfile.

This patch grouped these two tasks in one with a loop and also added
the variable OUTPUT_PREFIX_PXE to be configured in case of integration
with ironic.

Change-Id: I0260c8b5d1a6ccbddf1029ee9a3af35cb77fd525
This commit is contained in:
Juan Badia Payno 2021-09-30 14:21:02 +02:00
parent a9310256df
commit c665c379bf
1 changed files with 8 additions and 16 deletions

View File

@ -76,23 +76,15 @@
tags: tags:
- bar_create_recover_image - bar_create_recover_image
- name: Modify ISO_PREFIX on /etc/rear/local.conf - name: Configuring /etc/rear/local.conf
lineinfile: replace:
path: /etc/rear/local.conf path: /etc/rear/local.conf
regexp: "^ISO_PREFIX.*" regexp: "^{{ item }}.*"
line: ISO_PREFIX=$HOSTNAME-{{ bar_timestamp.stdout }} replace: "{{ item }}=$HOSTNAME-{{ bar_timestamp.stdout }}"
when: loop:
- tripleo_backup_and_restore_historical - ISO_PREFIX
tags: - BACKUP_PROG_ARCHIVE
- bar_create_recover_image - OUTPUT_PREFIX_PXE
- name: Modify BACKUP_PROG_ARCHIVE on /etc/rear/local.conf
lineinfile:
path: /etc/rear/local.conf
regexp: "^BACKUP_PROG_ARCHIVE.*"
line: BACKUP_PROG_ARCHIVE=$HOSTNAME-{{ bar_timestamp.stdout }}
when:
- tripleo_backup_and_restore_historical
tags: tags:
- bar_create_recover_image - bar_create_recover_image