mirror of
https://github.com/ruanbekker/rpi-ansible.git
synced 2025-04-20 01:11:38 +02:00
add fallback to wlan0 for raspberry pi zero w local mode
This commit is contained in:
parent
c13f5fba07
commit
2d492a44e2
@ -4,13 +4,26 @@
|
|||||||
- name: store MAC address for eth0
|
- name: store MAC address for eth0
|
||||||
set_fact:
|
set_fact:
|
||||||
my_macaddr: "{{ hostvars[inventory_hostname].ansible_eth0.macaddress }}"
|
my_macaddr: "{{ hostvars[inventory_hostname].ansible_eth0.macaddress }}"
|
||||||
when: inventory_hostname == 'localhost'
|
when: "inventory_hostname == 'localhost' and 'ansible_eth0' in hostvars[inventory_hostname]"
|
||||||
tags:
|
tags:
|
||||||
- raspi
|
- raspi
|
||||||
- sw
|
- sw
|
||||||
- sshd
|
- sshd
|
||||||
- motd
|
- motd
|
||||||
|
|
||||||
|
# Raspberry Pi Zero W has no eth0, so fall back to wlan0
|
||||||
|
- name: store MAC address for wlan0
|
||||||
|
set_fact:
|
||||||
|
my_macaddr: "{{ hostvars[inventory_hostname].ansible_wlan0.macaddress }}"
|
||||||
|
when: "inventory_hostname == 'localhost' and my_macaddr is not defined"
|
||||||
|
tags:
|
||||||
|
- raspi
|
||||||
|
- sw
|
||||||
|
- sshd
|
||||||
|
- motd
|
||||||
|
|
||||||
|
# for model A, we cannot proceed because there is no mac address
|
||||||
|
|
||||||
- name: load raspberry pi configuration (local mode)
|
- name: load raspberry pi configuration (local mode)
|
||||||
include_vars:
|
include_vars:
|
||||||
file: "../../../host_vars/{{ macaddrs[my_macaddr] }}"
|
file: "../../../host_vars/{{ macaddrs[my_macaddr] }}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user