Samuli Silvius | bb3bef8 | 2019-04-04 08:22:08 +0300 | [diff] [blame] | 1 | --- |
| 2 | - name: Fetch docker host ip |
| 3 | block: |
| 4 | - name: Get docker host ip to access host where container running (as dood) |
| 5 | shell: | |
| 6 | set -o pipefail |
| 7 | ip route | awk '/default/ { print $3 }' |
| 8 | args: |
| 9 | executable: /bin/bash |
| 10 | register: ip |
| 11 | changed_when: false |
| 12 | |
| 13 | - name: "set docker host ip {{ ip.stdout }} for cluster_ip" |
| 14 | set_fact: |
| 15 | cluster_ip: "{{ ip.stdout }}" |
| 16 | when: inventory_hostname != 'localhost' |
| 17 | |
| 18 | - name: Set fact for localhost OS |
| 19 | block: |
| 20 | - name: set localhost fact |
| 21 | set_fact: |
| 22 | localhost_ansible_os_family: "{{ hostvars['localhost'].ansible_os_family }}" |
| 23 | |
| 24 | - name: debug |
| 25 | debug: |
| 26 | var: localhost_ansible_os_family |
| 27 | when: hostvars['localhost'].ansible_os_family is defined |
| 28 | |
| 29 | - name: debug |
| 30 | debug: |
| 31 | var: ansible_os_family |