Skip to content
This repository has been archived by the owner on Feb 9, 2022. It is now read-only.

Commit

Permalink
Remove register variables when the variable name is the same as set_fact
Browse files Browse the repository at this point in the history
Without it the role will fail in Ansible 2.9.11

Bug-Url: https://bugzilla.redhat.com/1859483
Signed-off-by: Asaf Rachmani <[email protected]>
  • Loading branch information
arachmani committed Jul 22, 2020
1 parent 4b80453 commit fc716c0
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion tasks/filter_team_devices.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@
msg: >-
Only Team devices {{ team_if | join(', ') }} are present.
Teaming is not supported.
when: (otopi_host_net | length == 0)
when: (otopi_host_net.ansible_facts.otopi_host_net | length == 0)
4 changes: 2 additions & 2 deletions tasks/pre_checks/001_validate_network_interfaces.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@
host_net: >-
{{ [bridge_interface] if bridge_interface is defined else bb_filtered_list.results |
reject('skipped') | map(attribute='bond_item.ansible_facts.otopi_net_host') | list }}
register: host_net
- debug: var=host_net
- import_tasks: filter_team_devices.yml
- name: Validate selected bridge interface if management bridge does not exist
fail:
msg: The selected network interface is not valid
when:
he_bridge_if not in otopi_host_net and bridge_interface is not defined and not he_just_collect_network_interfaces
he_bridge_if not in otopi_host_net.ansible_facts.otopi_host_net and bridge_interface is not defined and
not he_just_collect_network_interfaces
...
1 change: 0 additions & 1 deletion tasks/pre_checks/define_variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
- name: Define he_cloud_init_host_name
set_fact:
he_cloud_init_host_name: "{{ he_fqdn }}"
register: he_cloud_init_host_name
- debug: var=he_cloud_init_host_name

- name: Define he_vm_uuid
Expand Down
1 change: 0 additions & 1 deletion tasks/pre_checks/validate_mac_address.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
set_fact:
he_vm_mac_addr: >-
{{ mac_address.stdout if he_vm_mac_addr is not defined or he_vm_mac_addr is none else he_vm_mac_addr }}
register: he_vm_mac_addr
- name: Fail if MAC address structure is incorrect
fail:
msg: "Invalid unicast MAC address format. Got {{ he_vm_mac_addr }}"
Expand Down
2 changes: 0 additions & 2 deletions tasks/pre_checks/validate_memory_size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@
- name: Set Max memory
set_fact:
max_mem: "{{ free_mem.stdout|int + cached_mem.stdout|int - he_reserved_memory_MB + he_avail_memory_grace_MB }}"
register: max_mem
- debug: var=max_mem

- name: set he_mem_size_MB to max available if not defined
set_fact:
he_mem_size_MB: "{{ he_mem_size_MB if he_mem_size_MB != 'max' else max_mem }}"
register: he_mem_size_MB
- debug: var=he_mem_size_MB

- name: Fail if available memory is less then the minimal requirement
Expand Down
2 changes: 0 additions & 2 deletions tasks/pre_checks/validate_vcpus_count.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@
- name: Set he_maxvcpus
set_fact:
he_maxvcpus: "{{ max_cpus.stdout }}"
register: he_maxvcpus
- debug: var=he_maxvcpus

- name: Set he_vcpus to maximum amount if not defined
set_fact:
he_vcpus: "{{ he_vcpus if he_vcpus != 'max' else he_maxvcpus }}"
register: he_vcpus
- debug: var=he_vcpus

- name: Check number of chosen CPUs
Expand Down

0 comments on commit fc716c0

Please sign in to comment.