Created
November 23, 2019 13:54
-
-
Save radimih/0c8509fd3919d1ea4e06a6cba6f6a334 to your computer and use it in GitHub Desktop.
Ansible: get address host from Ansible inventory from bash-script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Получить адрес хоста по его имени в Ansible inventory | |
| host_address=`ansible --inventory ansible/inventories/hosts.yml \ | |
| --module-name debug --args msg="{{ hostvars['host-name'].ansible_host }}" \ | |
| --one-line localhost | sed -E 's/.+"msg":\s"(.+)".+/\1/'` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment