Skip to content
Snippets Groups Projects
Commit 923208b9 authored by Thomas Woerner's avatar Thomas Woerner
Browse files

ipabackup: Fix undefined vars for conditions in shell tasks without else

The use of conditions in shell tasks without else clause is failing on
some systems with an undefined variable error.
parent 06d73ba8
No related branches found
No related tags found
No related merge requests found
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
- name: Create backup - name: Create backup
shell: > shell: >
ipa-backup ipa-backup
{{ "--gpg" if ipabackup_gpg | bool }} {{ "--gpg" if ipabackup_gpg | bool else "" }}
{{ "--gpg-keyring="+ipabackup_gpg_keyring if ipabackup_gpg_keyring is defined }} {{ "--gpg-keyring="+ipabackup_gpg_keyring if ipabackup_gpg_keyring is defined else "" }}
{{ "--data" if ipabackup_data | bool }} {{ "--data" if ipabackup_data | bool else "" }}
{{ "--logs" if ipabackup_logs | bool }} {{ "--logs" if ipabackup_logs | bool else "" }}
{{ "--online" if ipabackup_online | bool }} {{ "--online" if ipabackup_online | bool else "" }}
{{ "--disable-role-check" if ipabackup_disable_role_check | bool }} {{ "--disable-role-check" if ipabackup_disable_role_check | bool else "" }}
{{ "--log-file="+ipabackup_log_file if ipabackup_log_file is defined }} {{ "--log-file="+ipabackup_log_file if ipabackup_log_file is defined else "" }}
register: result_ipabackup register: result_ipabackup
- block: - block:
......
...@@ -105,13 +105,13 @@ ...@@ -105,13 +105,13 @@
ipa-restore ipa-restore
{{ ipabackup_item }} {{ ipabackup_item }}
--unattended --unattended
{{ "--password="+ipabackup_password if ipabackup_password is defined }} {{ "--password="+ipabackup_password if ipabackup_password is defined else "" }}
{{ "--data" if ipabackup_data | bool }} {{ "--data" if ipabackup_data | bool else "" }}
{{ "--online" if ipabackup_online | bool }} {{ "--online" if ipabackup_online | bool else "" }}
{{ "--instance="+ipabackup_instance if ipabackup_instance is defined }} {{ "--instance="+ipabackup_instance if ipabackup_instance is defined else "" }}
{{ "--backend="+ipabackup_backend if ipabackup_backend is defined }} {{ "--backend="+ipabackup_backend if ipabackup_backend is defined else "" }}
{{ "--no-logs" if ipabackup_no_logs | bool }} {{ "--no-logs" if ipabackup_no_logs | bool else "" }}
{{ "--log-file="+ipabackup_log_file if ipabackup_log_file is defined }} {{ "--log-file="+ipabackup_log_file if ipabackup_log_file is defined else "" }}
register: result_iparestore register: result_iparestore
ignore_errors: yes ignore_errors: yes
...@@ -127,21 +127,21 @@ ...@@ -127,21 +127,21 @@
command: > command: >
firewall-cmd firewall-cmd
--permanent --permanent
--zone="{{ ipabackup_firewalld_zone if ipabackup_firewalld_zone is defined }}" {{ "--zone="+ipabackup_firewalld_zone if ipabackup_firewalld_zone is defined else "" }}
--add-service=freeipa-ldap --add-service=freeipa-ldap
--add-service=freeipa-ldaps --add-service=freeipa-ldaps
{{ "--add-service=freeipa-trust" if ipabackup_service_adtrust in ipabackup_services }} {{ "--add-service=freeipa-trust" if ipabackup_service_adtrust in ipabackup_services else "" }}
{{ "--add-service=dns" if ipabackup_service_dns in ipabackup_services }} {{ "--add-service=dns" if ipabackup_service_dns in ipabackup_services else "" }}
{{ "--add-service=ntp" if ipabackup_service_ntp in ipabackup_services }} {{ "--add-service=ntp" if ipabackup_service_ntp in ipabackup_services else "" }}
when: ipabackup_setup_firewalld | bool when: ipabackup_setup_firewalld | bool
- name: Configure firewalld runtime - name: Configure firewalld runtime
command: > command: >
firewall-cmd firewall-cmd
--zone="{{ ipabackup_firewalld_zone if ipabackup_firewalld_zone is defined }}" {{ "--zone="+ipabackup_firewalld_zone if ipabackup_firewalld_zone is defined else "" }}
--add-service=freeipa-ldap --add-service=freeipa-ldap
--add-service=freeipa-ldaps --add-service=freeipa-ldaps
{{ "--add-service=freeipa-trust" if ipabackup_service_adtrust in ipabackup_services }} {{ "--add-service=freeipa-trust" if ipabackup_service_adtrust in ipabackup_services else "" }}
{{ "--add-service=dns" if ipabackup_service_dns in ipabackup_services }} {{ "--add-service=dns" if ipabackup_service_dns in ipabackup_services else "" }}
{{ "--add-service=ntp" if ipabackup_service_ntp in ipabackup_services }} {{ "--add-service=ntp" if ipabackup_service_ntp in ipabackup_services else "" }}
when: ipabackup_setup_firewalld | bool when: ipabackup_setup_firewalld | bool
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment