Skip to content

Commit

Permalink
Fix violations reported by "yamllint" (wrong indentation).
Browse files Browse the repository at this point in the history
Fixing 141 indentation violations similar to:
  yaml: wrong indentation: expected 8 but found 10 (yaml[indentation])

Signed-off-by: Pavel Bar <[email protected]>
Bug-Url: https://bugzilla.redhat.com/2097332
  • Loading branch information
barpavel committed Jun 27, 2022
1 parent b15be2e commit e30e627
Show file tree
Hide file tree
Showing 27 changed files with 374 additions and 374 deletions.
2 changes: 1 addition & 1 deletion roles/disaster_recovery/examples/dr_ovirt_setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
roles:
- disaster_recovery
collections:
- @NAMESPACE@.@NAME@
- @NAMESPACE@.@NAME@
2 changes: 1 addition & 1 deletion roles/disaster_recovery/examples/dr_play.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
roles:
- disaster_recovery
collections:
- @NAMESPACE@.@NAME@
- @NAMESPACE@.@NAME@
10 changes: 5 additions & 5 deletions roles/disaster_recovery/tasks/clean/remove_disks.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
- block:
- name: Remove disk
ovirt_disk:
state: absent
id: "{{ disk.id }}"
auth: "{{ ovirt_auth }}"
state: absent
id: "{{ disk.id }}"
auth: "{{ ovirt_auth }}"
ignore_errors: "{{ dr_ignore_error_clean }}"
tags:
- fail_back
- clean_engine
- fail_back
- clean_engine
18 changes: 9 additions & 9 deletions roles/disaster_recovery/tasks/clean/remove_domain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
# We should wait for some time and try again
- name: Remove storage domain
ovirt_storage_domain:
state: absent
id: "{{ sd.id }}"
name: "{{ sd.name }}"
auth: "{{ ovirt_auth }}"
host: "{{ host }}"
destroy: "{{ dr_force }}"
data_center: "{{ sp_uuid }}"
state: absent
id: "{{ sd.id }}"
name: "{{ sd.name }}"
auth: "{{ ovirt_auth }}"
host: "{{ host }}"
destroy: "{{ dr_force }}"
data_center: "{{ sp_uuid }}"
register: result
until: dr_force or result is not failed
retries: "{{ dr_cleanup_retries_maintenance }}"
delay: "{{ dr_cleanup_delay_maintenance }}"
ignore_errors: "{{ dr_ignore_error_clean }}"
tags:
- fail_back
- clean_engine
- fail_back
- clean_engine
8 changes: 4 additions & 4 deletions roles/disaster_recovery/tasks/clean/remove_domain_process.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@
- name: Remove storage domain with no force
include_tasks: remove_domain.yml
vars:
host: "{{ host_info.ovirt_hosts[0].id }}"
host: "{{ host_info.ovirt_hosts[0].id }}"
when: "host_info.ovirt_hosts is defined and host_info.ovirt_hosts|length > 0 and not dr_force"

- name: Force remove storage domain
include_tasks: remove_domain.yml
vars:
host: "00000000-0000-0000-0000-000000000000"
host: "00000000-0000-0000-0000-000000000000"
when: "dr_force"
ignore_errors: "{{ dr_ignore_error_clean }}"
tags:
- fail_back
- clean_engine
- fail_back
- clean_engine
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
- block:
- name: Fetch invalid storage domain for remove
ovirt_storage_domain_info:
pattern: name={{ storage['dr_' + dr_source_map + '_name'] }} and {{ dr_inactive_domain_search }}
auth: "{{ ovirt_auth }}"
pattern: name={{ storage['dr_' + dr_source_map + '_name'] }} and {{ dr_inactive_domain_search }}
auth: "{{ ovirt_auth }}"
register: storage_domain_info

- name: Remove invalid storage domain
include_tasks: remove_domain_process.yml
vars:
sd: "{{ sd }}"
sd: "{{ sd }}"
with_items:
- "{{ storage_domain_info.ovirt_storage_domains }}"
- "{{ storage_domain_info.ovirt_storage_domains }}"
when: (not only_master and not sd.master) or (only_master and sd.master)
loop_control:
loop_var: sd
loop_var: sd
ignore_errors: "{{ dr_ignore_error_clean }}"
tags:
- fail_back
- clean_engine
- fail_back
- clean_engine
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
- block:
- name: Fetch active/maintenance/detached storage domain for remove
ovirt_storage_domain_info:
pattern: >
name={{ storage['dr_' + dr_source_map + '_name'] }} and
(
datacenter={{ storage['dr_' + dr_source_map + '_dc_name'] }} and {{ dr_active_domain_search }} or
datacenter={{ storage['dr_' + dr_source_map + '_dc_name'] }} and {{ dr_maintenance_domain_search }} or
{{ dr_unattached_domain_search }}
)
auth: "{{ ovirt_auth }}"
pattern: >
name={{ storage['dr_' + dr_source_map + '_name'] }} and
(
datacenter={{ storage['dr_' + dr_source_map + '_dc_name'] }} and {{ dr_active_domain_search }} or
datacenter={{ storage['dr_' + dr_source_map + '_dc_name'] }} and {{ dr_maintenance_domain_search }} or
{{ dr_unattached_domain_search }}
)
auth: "{{ ovirt_auth }}"
register: storage_domain_info

- name: Remove valid storage domain
include_tasks: remove_domain_process.yml
vars:
sd: "{{ sd }}"
sd: "{{ sd }}"
with_items:
- "{{ storage_domain_info.ovirt_storage_domains }}"
- "{{ storage_domain_info.ovirt_storage_domains }}"
when: (not only_master and not sd.master) or (only_master and sd.master)
loop_control:
loop_var: sd
loop_var: sd
ignore_errors: "{{ dr_ignore_error_clean }}"
tags:
- fail_back
- clean_engine
- fail_back
- clean_engine
10 changes: 5 additions & 5 deletions roles/disaster_recovery/tasks/clean/remove_vms.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
- block:
- name: Remove diskless VMs
ovirt_vm:
state: absent
name: "{{ vm.name }}"
auth: "{{ ovirt_auth }}"
state: absent
name: "{{ vm.name }}"
auth: "{{ ovirt_auth }}"
ignore_errors: "{{ dr_ignore_error_clean }}"
tags:
- fail_back
- clean_engine
- fail_back
- clean_engine
14 changes: 7 additions & 7 deletions roles/disaster_recovery/tasks/clean/shutdown_vm.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
- block:
- name: Shutdown VM
ovirt_vm:
state: stopped
name: "{{ vms.name }}"
force: true
wait: true
auth: "{{ ovirt_auth }}"
state: stopped
name: "{{ vms.name }}"
force: true
wait: true
auth: "{{ ovirt_auth }}"
ignore_errors: "{{ dr_ignore_error_clean }}"
tags:
- fail_back
- clean_engine
- fail_back
- clean_engine
16 changes: 8 additions & 8 deletions roles/disaster_recovery/tasks/clean/shutdown_vms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
# Get all the running VMs related to a storage domain and shut them down
- name: Fetch VMs in the storage domain
ovirt_vm_info:
pattern: >
status != down and
storage.name={{ storage['dr_' + dr_source_map + '_name'] }} and
datacenter={{ storage['dr_' + dr_source_map + '_dc_name'] }}
auth: "{{ ovirt_auth }}"
pattern: >
status != down and
storage.name={{ storage['dr_' + dr_source_map + '_name'] }} and
datacenter={{ storage['dr_' + dr_source_map + '_dc_name'] }}
auth: "{{ ovirt_auth }}"
register: vm_info

# TODO: Add a wait until the VM is really down
- name: Shutdown VMs
include_tasks: shutdown_vm.yml
vars:
vms: "{{ item }}"
vms: "{{ item }}"
with_items: "{{ vm_info.ovirt_vms }}"
ignore_errors: "{{ dr_ignore_error_clean }}"
tags:
- fail_back
- clean_engine
- fail_back
- clean_engine
14 changes: 7 additions & 7 deletions roles/disaster_recovery/tasks/clean/update_ovf_store.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
- block:
- name: Fetch storage domain only if active
ovirt_storage_domain_info:
pattern: status = active and storage.name={{ storage['dr_' + dr_source_map + '_name'] }}
auth: "{{ ovirt_auth }}"
pattern: status = active and storage.name={{ storage['dr_' + dr_source_map + '_name'] }}
auth: "{{ ovirt_auth }}"
register: storage_domain_info

- name: Update OVF store for active storage domain
ovirt_storage_domain:
state: update_ovf_store
name: "{{ iscsi_storage['dr_' + dr_source_map + '_name'] }}"
auth: "{{ ovirt_auth }}"
state: update_ovf_store
name: "{{ iscsi_storage['dr_' + dr_source_map + '_name'] }}"
auth: "{{ ovirt_auth }}"
with_items:
- "{{ storage_domain_info.ovirt_storage_domains }}"
ignore_errors: "{{ dr_ignore_error_clean }}"
tags:
- fail_back
- clean_engine
- fail_back
- clean_engine
64 changes: 32 additions & 32 deletions roles/disaster_recovery/tasks/clean_engine.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
- block:
- name: Obtain SSO token
ovirt_auth:
url: "{{ vars['dr_sites_' + dr_source_map + '_url'] }}"
username: "{{ vars['dr_sites_' + dr_source_map + '_username'] }}"
password: "{{ vars['dr_sites_' + dr_source_map + '_password'] }}"
ca_file: "{{ vars['dr_sites_' + dr_source_map + '_ca_file'] }}"
url: "{{ vars['dr_sites_' + dr_source_map + '_url'] }}"
username: "{{ vars['dr_sites_' + dr_source_map + '_username'] }}"
password: "{{ vars['dr_sites_' + dr_source_map + '_password'] }}"
ca_file: "{{ vars['dr_sites_' + dr_source_map + '_ca_file'] }}"

- name: Shutdown running VMs
include_tasks: clean/shutdown_vms.yml
with_items:
- "{{ dr_import_storages }}"
- "{{ dr_import_storages }}"
loop_control:
loop_var: storage
loop_var: storage

- name: Update OVF_STORE disk for storage domains
include_tasks: clean/update_ovf_store.yml
with_items:
- "{{ dr_import_storages }}"
- "{{ dr_import_storages }}"
loop_control:
loop_var: storage
loop_var: storage

- name: Set force remove flag to false for non master domains
set_fact: dr_force=False
Expand All @@ -27,20 +27,20 @@
# Note: Export storage domain is not supported and should not be part of storage mapping
- name: Setup queries for storage domains
set_fact:
dr_active_domain_search='status = active and type != cinder'
dr_maintenance_domain_search='status = maintenance and type != cinder'
dr_unattached_domain_search='status = unattached and type != cinder and type != glance'
dr_inactive_domain_search='type != glance and type != cinder and status != active'
dr_active_domain_search='status = active and type != cinder'
dr_maintenance_domain_search='status = maintenance and type != cinder'
dr_unattached_domain_search='status = unattached and type != cinder and type != glance'
dr_inactive_domain_search='type != glance and type != cinder and status != active'

- name: Set master storage domain filter
set_fact: only_master=False

- name: Remove non master storage domains with valid statuses
include_tasks: clean/remove_valid_filtered_master_domains.yml
with_items:
- "{{ dr_import_storages }}"
- "{{ dr_import_storages }}"
loop_control:
loop_var: storage
loop_var: storage

# We use inactive filter only at the end, since we are not sure if there were any storage domains
# which became inactive on the process or if there were any at the beginning.
Expand All @@ -50,9 +50,9 @@
- name: Remove non master storage domains with invalid statuses using force remove
include_tasks: clean/remove_invalid_filtered_master_domains.yml
with_items:
- "{{ dr_import_storages }}"
- "{{ dr_import_storages }}"
loop_control:
loop_var: storage
loop_var: storage

- name: Set master storage domain filter
set_fact: only_master=True
Expand All @@ -63,66 +63,66 @@
- name: Remove master storage domains with valid statuses
include_tasks: clean/remove_valid_filtered_master_domains.yml
with_items:
- "{{ dr_import_storages }}"
- "{{ dr_import_storages }}"
loop_control:
loop_var: storage
loop_var: storage

- name: Set force remove flag to true for master domain
set_fact: dr_force=True

- name: Remove master storage domains with invalid statuses using force remove
include_tasks: clean/remove_invalid_filtered_master_domains.yml
with_items:
- "{{ dr_import_storages }}"
- "{{ dr_import_storages }}"
loop_control:
loop_var: storage
loop_var: storage

- name: Fetch leftover storage domains
ovirt_storage_domain_info:
pattern: type != glance
auth: "{{ ovirt_auth }}"
pattern: type != glance
auth: "{{ ovirt_auth }}"
register: storage_domain_info

# TODO: Document that behavior
# Remove VMs only if there are no data storage domains left in the setup
- name: Fetch leftover VMs in the setup
ovirt_vm_info:
pattern: status = down
auth: "{{ ovirt_auth }}"
pattern: status = down
auth: "{{ ovirt_auth }}"
register: vm_info
when: dr_clean_orphaned_vms and storage_domain_info.ovirt_storage_domains | length == 0

- name: Remove vms if no storage domains left in setup
include_tasks: clean/remove_vms.yml
vars:
vm: "{{ item }}"
vm: "{{ item }}"
with_items: "{{ vm_info.ovirt_vms }}"
when: dr_clean_orphaned_vms and storage_domain_info.ovirt_storage_domains | length == 0

# Remove direct LUN disks
- name: Fetch leftover direct LUN disks in the setup
ovirt_disk_info:
pattern: disk_type = lun and number_of_vms =0
auth: "{{ ovirt_auth }}"
pattern: disk_type = lun and number_of_vms =0
auth: "{{ ovirt_auth }}"
register: disk_info
when: dr_clean_orphaned_disks and storage_domain_info.ovirt_storage_domains | length == 0

- name: Remove LUN disks if no storage domains left in setup
include_tasks: clean/remove_disks.yml
vars:
disk: "{{ item }}"
disk: "{{ item }}"
with_items: "{{ disk_info.ovirt_disks }}"
when: dr_clean_orphaned_disks and storage_domain_info.ovirt_storage_domains | length == 0


# Default value is set in role defaults
ignore_errors: "{{ dr_ignore_error_clean }}"
tags:
- fail_back
- clean_engine
- fail_back
- clean_engine

always:
- name: Revoke the SSO token
ovirt_auth:
state: absent
ovirt_auth: "{{ ovirt_auth }}"
state: absent
ovirt_auth: "{{ ovirt_auth }}"
2 changes: 1 addition & 1 deletion roles/disaster_recovery/tasks/generate_mapping.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
command: python3 {{ role_path }}/files/generate_mapping.py -a "{{ site }}" -u "{{ username }}" -p "{{ password }}" -c "{{ ca }}" -f "{{ var_file }}"
run_once: true
tags:
- generate_mapping
- generate_mapping
Loading

0 comments on commit e30e627

Please sign in to comment.