mirror of https://github.com/ansible/ansible.git
Add a toggle for the leading separator for keyed_groups (#60882)
* Add a toggle for the leading separator for keyed_groups if no prefix is given * changelog * Add tests for backward compatibility and the new togglepull/72329/head
parent
0b2b82c0b6
commit
8b07d46166
@ -0,0 +1,2 @@
|
||||
minor_changes:
|
||||
- constructed - Add a toggle to allow the separator to be omitted if no prefix has been provided.
|
@ -0,0 +1 @@
|
||||
shippable/posix/group3
|
@ -0,0 +1,19 @@
|
||||
plugin: constructed
|
||||
keyed_groups:
|
||||
- key: hostvar0
|
||||
- key: hostvar1
|
||||
- key: hostvar2
|
||||
|
||||
- key: hostvar0
|
||||
separator: 'separator'
|
||||
- key: hostvar1
|
||||
separator: 'separator'
|
||||
- key: hostvar2
|
||||
separator: 'separator'
|
||||
|
||||
- key: hostvar0
|
||||
prefix: 'prefix'
|
||||
- key: hostvar1
|
||||
prefix: 'prefix'
|
||||
- key: hostvar2
|
||||
prefix: 'prefix'
|
@ -0,0 +1,20 @@
|
||||
plugin: constructed
|
||||
keyed_groups:
|
||||
- key: hostvar0
|
||||
- key: hostvar1
|
||||
- key: hostvar2
|
||||
|
||||
- key: hostvar0
|
||||
separator: 'separator'
|
||||
- key: hostvar1
|
||||
separator: 'separator'
|
||||
- key: hostvar2
|
||||
separator: 'separator'
|
||||
|
||||
- key: hostvar0
|
||||
prefix: 'prefix'
|
||||
- key: hostvar1
|
||||
prefix: 'prefix'
|
||||
- key: hostvar2
|
||||
prefix: 'prefix'
|
||||
leading_separator: False
|
@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -ex
|
||||
|
||||
ansible-inventory -i static_inventory.yml -i constructed.yml --graph | tee out.txt
|
||||
|
||||
grep '@_hostvalue1' out.txt
|
||||
grep '@_item0' out.txt
|
||||
grep '@_key0_value0' out.txt
|
||||
grep '@prefix_hostvalue1' out.txt
|
||||
grep '@prefix_item0' out.txt
|
||||
grep '@prefix_key0_value0' out.txt
|
||||
grep '@separatorhostvalue1' out.txt
|
||||
grep '@separatoritem0' out.txt
|
||||
grep '@separatorkey0separatorvalue0' out.txt
|
||||
|
||||
ansible-inventory -i static_inventory.yml -i no_leading_separator_constructed.yml --graph | tee out.txt
|
||||
|
||||
grep '@hostvalue1' out.txt
|
||||
grep '@item0' out.txt
|
||||
grep '@key0_value0' out.txt
|
||||
grep '@key0separatorvalue0' out.txt
|
||||
grep '@prefix_hostvalue1' out.txt
|
||||
grep '@prefix_item0' out.txt
|
||||
grep '@prefix_key0_value0' out.txt
|
@ -0,0 +1,8 @@
|
||||
all:
|
||||
hosts:
|
||||
host0:
|
||||
hostvar0:
|
||||
key0: value0
|
||||
hostvar1: hostvalue1
|
||||
hostvar2:
|
||||
- item0
|
Loading…
Reference in New Issue