Fix internal_ip detection in {enroll,deploy}-dynamic
Gather facts on localhost before running them to learn the IP address of the network_interface, which, in turn, is needed for the default value of ironic_url. Do not try to fetch interface information from target hosts, best case it will fail, worst case - will provide IP information from hosts themselves. Change-Id: Ib884c739457fa6e4d0159441c2ae855af61c55c1
This commit is contained in:
parent
3823944c76
commit
dc57b72767
@ -1,4 +1,9 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
name: "Gather facts on localhost"
|
||||
become: no
|
||||
gather_facts: yes
|
||||
|
||||
- hosts: baremetal
|
||||
name: "Create configuration drive files and deploy machines from inventory"
|
||||
become: no
|
||||
|
@ -1,4 +1,9 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
name: "Gather facts on localhost"
|
||||
become: no
|
||||
gather_facts: yes
|
||||
|
||||
- hosts: baremetal
|
||||
name: "Enroll hardware from inventory into Ironic"
|
||||
become: no
|
||||
|
@ -3,7 +3,10 @@ noauth_mode: true
|
||||
|
||||
network_interface: "virbr0"
|
||||
ans_network_interface: "{{ network_interface | replace('-', '_') }}"
|
||||
internal_ip: "{{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}"
|
||||
# NOTE(dtantsur): dynamic playbooks are run on bare metal hosts, not on
|
||||
# localhost, and the interface fact may not be available for them.
|
||||
ans_interface_host: "{{ groups['target'][0] if 'target' in groups else '127.0.0.1' }}"
|
||||
internal_ip: "{{ hostvars[ans_interface_host]['ansible_' + ans_network_interface]['ipv4']['address'] }}"
|
||||
|
||||
enable_tls: false
|
||||
api_protocol: "{{ 'https' if enable_tls | bool else 'http' }}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user