Closed jackding2000 closed 1 year ago
do you have a reproducible test case which shows that the output of ansible_facts.keys() | list | intersect(__storage_required_facts)
is not in the same order as __storage_required_facts
?
please provide
Yes.
Here is the output from my playbook run:
Perform task: TASK: redhat.rhel_system_roles.storage : Display vars fact (N)o/(y)es/(c)ontinue: ***
TASK [redhat.rhel_system_roles.storage : Display vars fact] *** ok: [servera.lab.example.com] => { "msg": [ "ansible_facts.keys: ['hostnqn', 'lsb', 'system', 'kernel', 'kernel_version', 'machine', 'python_version', 'fqdn', 'hostname', 'nodename', 'domain', 'userspace_bits', 'architecture', 'userspace_architecture', 'machine_id', 'user_id', 'user_uid', 'user_gid', 'user_gecos', 'user_dir', 'user_shell', 'real_user_id', 'effective_user_id', 'real_group_id', 'effective_group_id', 'dns', 'system_capabilities_enforced', 'system_capabilities', 'is_chroot', 'cmdline', 'proc_cmdline', 'virtualization_role', 'virtualization_type', 'virtualization_tech_guest', 'virtualization_tech_host', 'env', 'ssh_host_key_rsa_public', 'ssh_host_key_rsa_public_keytype', 'ssh_host_key_ecdsa_public', 'ssh_host_key_ecdsa_public_keytype', 'ssh_host_key_ed25519_public', 'ssh_host_key_ed25519_public_keytype', 'distribution', 'distribution_release', 'distribution_version', 'distribution_major_version', 'distribution_file_path', 'distribution_file_variety', 'distribution_file_parsed', 'distribution_file_search_string', 'os_family', 'processor', 'processor_count', 'processor_cores', 'processor_threads_per_core', 'processor_vcpus', 'processor_nproc', 'memtotal_mb', 'memfree_mb', 'swaptotal_mb', 'swapfree_mb', 'memory_mb', 'bios_date', 'bios_vendor', 'bios_version', 'board_asset_tag', 'board_name', 'board_serial', 'board_vendor', 'board_version', 'chassis_asset_tag', 'chassis_serial', 'chassis_vendor', 'chassis_version', 'form_factor', 'product_name', 'product_serial', 'product_uuid', 'product_version', 'system_vendor', 'devices', 'device_links', 'uptime_seconds', 'lvm', 'mounts', 'fibre_channel_wwn', 'ansible_local', 'iscsi_iqn', 'python', 'apparmor', 'selinux_python_present', 'selinux', 'fips', 'pkg_mgr', 'interfaces', 'eth0', 'lo', 'eth1', 'default_ipv4', 'default_ipv6', 'all_ipv4_addresses', 'all_ipv6_addresses', 'date_time', 'service_mgr', 'gather_subset', 'module_setup', 'discovered_interpreter_python', '_ansible_facts_gathered']", "storage_provider: blivet", "List intersect: ['distribution', 'distribution_version', 'distribution_major_version', 'os_family']", "__storage_required_facts: ['distribution', 'distribution_major_version', 'distribution_version', 'os_family']", "Sorted List intersect: ['distribution', 'distribution_major_version', 'distribution_version', 'os_family']", "Sorted __storage_required_facts: ['distribution', 'distribution_major_version', 'distribution_version', 'os_family']" ] }
1 --- 2 - name: Display vars fact 3 debug: 4 msg: 5 - "ansible_facts.keys: {{ ansible_facts.keys() }}" 6 - "storage_provider: {{ storage_provider }}" 7 - "List intersect: {{ ansible_facts.keys() | list | intersect(storage_required_facts) }}" 8 - "storage_required_facts: {{ __storage_required_facts }}" 9 - "Sorted List intersect: {{ ansible_facts.keys() | list | intersect(storage_required_facts) | sort }}" 10 - "Sorted storage_required_facts: {{ __storage_required_facts | sort }}" 11
@jackding2000 thanks - do you have some way to test https://github.com/linux-system-roles/storage/pull/374 ?
do you have a reproducible test case which shows that the output of
ansible_facts.keys() | list | intersect(__storage_required_facts)
is not in the same order as__storage_required_facts
?please provide
- ansible version [ jack comments ] ansible-navigator 2.1.0
- controller node platform and version [ jack comments ] RHEL 9.0
- managed node platform and version [ jack comments ] RHEL 9.0
do you have a reproducible test case which shows that the output of
ansible_facts.keys() | list | intersect(__storage_required_facts)
is not in the same order as__storage_required_facts
? please provide
- ansible version [ jack comments ] ansible-navigator 2.1.0
- controller node platform and version [ jack comments ] RHEL 9.0
- managed node platform and version [ jack comments ] RHEL 9.0
Thanks - if you are using navigator you might not have a way to edit the role files to test https://github.com/linux-system-roles/storage/pull/374 - not sure Also, if you are a Red Hat and/or Ansible customer - have you already filed a case or issue with Red Hat/Ansible support?
In the set_vars.yml, below task should compare two sorted lists, and "not" is not needed for the conditional check
Should looks like: