Made execution dependent on database parameter

This commit is contained in:
Kevin Veen-Birkenbach 2023-12-26 12:41:51 +01:00
parent 57b74201a0
commit 729b2d06c3

View File

@ -38,6 +38,12 @@
command: command:
cmd: "python database_entry_seeder.py databases.csv {{database_instance}} {{database_host}} {{database_databasename}} {{database_username}} {{database_password}}" cmd: "python database_entry_seeder.py databases.csv {{database_instance}} {{database_host}} {{database_databasename}} {{database_username}} {{database_password}}"
chdir: "{{backup_docker_to_local_folder}}" chdir: "{{backup_docker_to_local_folder}}"
when: >
database_instance is defined or
database_host is defined or
database_databasename is defined or
database_username is defined or
database_password is defined
- name: Set file permissions for databases.csv to be readable, writable, and executable by root only - name: Set file permissions for databases.csv to be readable, writable, and executable by root only
ansible.builtin.file: ansible.builtin.file:
@ -45,7 +51,19 @@
mode: '0700' mode: '0700'
owner: root owner: root
group: root group: root
when: run_once_backup_docker_to_local is not defined when: >
(database_instance is defined or
database_host is defined or
database_databasename is defined or
database_username is defined or
database_password is defined) and
run_once_backup_docker_to_local_file_permission is not defined
register: file_permission_result
- name: run the backup_docker_to_local_file_permission tasks once
set_fact:
run_once_backup_docker_to_local_file_permission: true
when: run_once_backup_docker_to_local_file_permission is not defined and file_permission_result is defined and file_permission_result.changed
- name: run the backup_docker_to_local tasks once - name: run the backup_docker_to_local tasks once
set_fact: set_fact: