mirror of https://github.com/ansible/ansible.git
preserve same order as inventory manager when using host lookup (#55331)
* preserve same order as inventory manager when using inventory_hostnames lookup add a test * move generic codepull/55535/head
parent
0330ea616e
commit
afb5e02c19
@ -0,0 +1 @@
|
||||
shippable/posix/group2
|
@ -0,0 +1,6 @@
|
||||
[group01]
|
||||
test01
|
||||
test05
|
||||
test03
|
||||
test02
|
||||
test04
|
@ -0,0 +1,13 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
gather_facts: no
|
||||
tasks:
|
||||
- set_fact:
|
||||
hosts_a: "{{ lookup('inventory_hostnames', 'group01', wantlist=true) }}"
|
||||
|
||||
- set_fact:
|
||||
hosts_b: "{{ groups['group01'] }}"
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- hosts_a == hosts_b
|
@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eux
|
||||
|
||||
ansible-playbook main.yml -i inventory -e "$@"
|
Loading…
Reference in New Issue