update: add network configuration variables and enhance Ansible playbooks for dynamic IP handling
This commit is contained in:
parent
eba7f8322d
commit
ae59661982
6 changed files with 68 additions and 31 deletions
|
|
@ -53,9 +53,10 @@ for vm in $running_vms; do
|
|||
vm_ips=$(vagrant ssh "$vm" -c "ip -j addr" | jq -r '.[] |
|
||||
select(.addr_info != null) |
|
||||
.addr_info[] |
|
||||
select(.family == "inet" and (.local | startswith("192.168.56.8"))) |
|
||||
select(.family == "inet" and (.local | startswith("'${VAGRANT_NETWORK_PREFIX:-192.168.56}'."))) |
|
||||
.local')
|
||||
|
||||
|
||||
# Save the VM's IP to the array if it matches our pattern
|
||||
if [ ! -z "$vm_ips" ]; then
|
||||
network_info+=("$vm:$vm_ips")
|
||||
|
|
@ -108,7 +109,6 @@ ips=()
|
|||
for info in "${network_info[@]}"; do
|
||||
echo "----------------------------------------"
|
||||
echo -e "$info"
|
||||
# vm2:192.168.56.81
|
||||
ip_addr=$(echo "$info" | cut -d':' -f2)
|
||||
ips+=("$ip_addr")
|
||||
echo "----------------------------------------"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue