Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "hosts": {
- "a_hostname" : {
- "ips" : [
- 1,
- 2,
- 3
- ]
- },
- {...}
- }
- }
- jq -n {hosts:{}} |
- for host in $( ansible -i hosts all --list-hosts ) ;
- do jq ".hosts += {$host:{}}" |
- jq ".hosts.$host += {ips:[1,2,3]}" ;
- done ;
- {
- "hosts": {
- "host_1": {
- "ips": [
- 1,
- 2,
- 3
- ]
- }
- }
- }
Add Comment
Please, Sign In to add comment