mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-05-15 22:12:08 +00:00
roles: Fix ansible-lint warning on var-naming.
ansible-lint warns if set_fact sets a variable where the name is used or can be as a parameter for the role.
This commit is contained in:
@@ -9,23 +9,23 @@
|
||||
|
||||
- name: Set controller source directory
|
||||
ansible.builtin.set_fact:
|
||||
ipabackup_controller_dir:
|
||||
__derived_controller_dir:
|
||||
"{{ ipabackup_controller_path | default(lookup('env', 'PWD')) }}"
|
||||
|
||||
- name: Set ipabackup_item
|
||||
ansible.builtin.set_fact:
|
||||
ipabackup_item:
|
||||
__derived_item:
|
||||
"{{ ipabackup_name | regex_search('.*_(ipa-.+)', '\\1') | first }}"
|
||||
when: "'_ipa-' in ipabackup_name"
|
||||
|
||||
- name: Set ipabackup_item
|
||||
ansible.builtin.set_fact:
|
||||
ipabackup_item: "{{ ipabackup_name }}"
|
||||
__derived_item: "{{ ipabackup_name }}"
|
||||
when: "'_ipa-' not in ipabackup_name"
|
||||
|
||||
- name: Stat backup to copy
|
||||
ansible.builtin.stat:
|
||||
path: "{{ ipabackup_controller_dir }}/{{ ipabackup_name }}"
|
||||
path: "{{ __derived_controller_dir }}/{{ ipabackup_name }}"
|
||||
register: result_backup_stat
|
||||
delegate_to: localhost
|
||||
become: no
|
||||
@@ -35,10 +35,10 @@
|
||||
msg: "Unable to find backup {{ ipabackup_name }}"
|
||||
when: result_backup_stat.stat.isdir is not defined
|
||||
|
||||
- name: Copy backup files to server for "{{ ipabackup_item }}"
|
||||
- name: Copy backup files to server for "{{ __derived_item }}"
|
||||
ansible.builtin.copy:
|
||||
src: "{{ ipabackup_controller_dir }}/{{ ipabackup_name }}/"
|
||||
dest: "{{ ipabackup_dir }}/{{ ipabackup_item }}"
|
||||
src: "{{ __derived_controller_dir }}/{{ ipabackup_name }}/"
|
||||
dest: "{{ ipabackup_dir }}/{{ __derived_item }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: u=rw,go=r
|
||||
|
||||
Reference in New Issue
Block a user