mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-11-25 10:23:49 +00:00
Merge pull request #904 from rjeffman/ipabackup_fix_parameter_eval_order
ipabackup: Fix order of ipabackup_name parameter evaluation.
This commit is contained in:
@@ -26,6 +26,12 @@
|
|||||||
fail: msg="ipabackup_from_controller and ipabackup_to_controller are set"
|
fail: msg="ipabackup_from_controller and ipabackup_to_controller are set"
|
||||||
when: ipabackup_from_controller | bool and ipabackup_to_controller | bool
|
when: ipabackup_from_controller | bool and ipabackup_to_controller | bool
|
||||||
|
|
||||||
|
- name: Fail for given ipabackup_name if state is not copied, restored or absent
|
||||||
|
fail: msg="ipabackup_name is given and state is not copied, restored or absent"
|
||||||
|
when: state is not defined or
|
||||||
|
(state != "copied" and state != "restored" and state != "absent") and
|
||||||
|
ipabackup_name is defined
|
||||||
|
|
||||||
- name: Get ipabackup_dir from IPA installation
|
- name: Get ipabackup_dir from IPA installation
|
||||||
include_tasks: "{{ role_path }}/tasks/get_ipabackup_dir.yml"
|
include_tasks: "{{ role_path }}/tasks/get_ipabackup_dir.yml"
|
||||||
|
|
||||||
@@ -33,12 +39,6 @@
|
|||||||
include_tasks: "{{ role_path }}/tasks/backup.yml"
|
include_tasks: "{{ role_path }}/tasks/backup.yml"
|
||||||
when: state|default("present") == "present"
|
when: state|default("present") == "present"
|
||||||
|
|
||||||
- name: Fail for given ipabackup_name if state is not copied, restored or absent
|
|
||||||
fail: msg="ipabackup_name is given and state is not copied, restored or absent"
|
|
||||||
when: state is not defined or
|
|
||||||
(state != "copied" and state != "restored" and state != "absent") and
|
|
||||||
ipabackup_name is defined
|
|
||||||
|
|
||||||
- name: Fail on missing ipabackup_name
|
- name: Fail on missing ipabackup_name
|
||||||
fail: msg="ipabackup_name is not set"
|
fail: msg="ipabackup_name is not set"
|
||||||
when: (ipabackup_name is not defined or not ipabackup_name) and
|
when: (ipabackup_name is not defined or not ipabackup_name) and
|
||||||
|
|||||||
@@ -383,6 +383,31 @@
|
|||||||
loop_var: server_backup_data
|
loop_var: server_backup_data
|
||||||
label: server_backup_data.path
|
label: server_backup_data.path
|
||||||
|
|
||||||
|
# Test issue #900
|
||||||
|
- name: Remove all backup from server.
|
||||||
|
ansible.builtin.include_role:
|
||||||
|
name: ipabackup
|
||||||
|
vars:
|
||||||
|
state: absent
|
||||||
|
ipabackup_name: all
|
||||||
|
|
||||||
|
- name: Test issue 900 fix.
|
||||||
|
block:
|
||||||
|
- name: Invalid role configuration that should not produce a backup on the server.
|
||||||
|
ansible.builtin.include_role:
|
||||||
|
name: ipabackup
|
||||||
|
vars:
|
||||||
|
state: present
|
||||||
|
ipabackup_name: this_must_fail
|
||||||
|
rescue:
|
||||||
|
- name: List all existing backups on server
|
||||||
|
ansible.builtin.find:
|
||||||
|
path: /var/lib/ipa/backup
|
||||||
|
recurse: no
|
||||||
|
file_type: directory
|
||||||
|
register: server_backups
|
||||||
|
failed_when: server_backups.files
|
||||||
|
|
||||||
# CLEANUP
|
# CLEANUP
|
||||||
|
|
||||||
- name: List all existing backups on controller
|
- name: List all existing backups on controller
|
||||||
|
|||||||
Reference in New Issue
Block a user