ArieLevs / Raspberry-WiFi-Repeater

Guide to set raspberry pi as wifi access point - bridge
MIT License
60 stars 11 forks source link

Failure in "TASK [setup_raspberry_repeater : Bridge | Set wpa_supplicant.conf file]" #4

Closed autarkper closed 3 years ago

autarkper commented 3 years ago
TASK [setup_raspberry_repeater : Bridge | Set wpa_supplicant.conf file] *************
fatal: [192.168.1.26]: FAILED! => {"changed": false, "msg": "Could not find or access 'wpa_supplicant.conf.j2'\nSearched in:\n\t/home/pang/project/Raspberry-WiFi-Repeater/ansible/roles/setup_raspberry_repeater/templates/wpa_supplicant.conf.j2\n\t/home/pang/project/Raspberry-WiFi-Repeater/ansible/roles/setup_raspberry_repeater/wpa_supplicant.conf.j2\n\t/home/pang/project/Raspberry-WiFi-Repeater/ansible/roles/setup_raspberry_repeater/tasks/templates/wpa_supplicant.conf.j2\n\t/home/pang/project/Raspberry-WiFi-Repeater/ansible/roles/setup_raspberry_repeater/tasks/wpa_supplicant.conf.j2\n\t/home/pang/project/Raspberry-WiFi-Repeater/ansible/templates/wpa_supplicant.conf.j2\n\t/home/pang/project/Raspberry-WiFi-Repeater/ansible/wpa_supplicant.conf.j2 on the Ansible Controller.\nIf you are using a module and expect the file to exist on the remote, see the remote_src option"}

Full story:

$ ansible-playbook -u pi --ask-pass -i "192.168.1.26," ansible/setup_repeater.yaml -e ap_ssid_name=yyyy -e ap_ssid_pass=aaaa -e ssid_name=bbbb -e ssid_pass=cccc
SSH password: 

PLAY [Setup Raspberry PI Repeater] **************************************************

TASK [Gathering Facts] **************************************************************
[WARNING]: Platform linux on host 192.168.1.26 is using the discovered Python
interpreter at /usr/bin/python, but future installation of another Python
interpreter could change this. See
https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html
for more information.
ok: [192.168.1.26]

TASK [setup_raspberry_access_point : Access Point | Update and upgrade apt packages] ***
[WARNING]: The value True (type bool) in a string field was converted to u'True'
(type string). If this does not look like what you expect, quote the entire value to
ensure it does not change.
ok: [192.168.1.26]

TASK [setup_raspberry_access_point : Access Point | Install requiered packages] *****
ok: [192.168.1.26]

TASK [setup_raspberry_access_point : Access Point | Stop hostapd, dnsmasq, if running] ***
changed: [192.168.1.26] => (item=hostapd)
changed: [192.168.1.26] => (item=dnsmasq)

TASK [setup_raspberry_access_point : Access Point | Set dhcpcd.conf file] ***********
ok: [192.168.1.26]

TASK [setup_raspberry_access_point : Access Point | Restart dhcpcd and enable it] ***
changed: [192.168.1.26]

TASK [setup_raspberry_access_point : Access Point | Set dnsmasq.conf file] **********
ok: [192.168.1.26]

TASK [setup_raspberry_access_point : Access Point | Set hostapd.conf file] **********
ok: [192.168.1.26]

TASK [setup_raspberry_access_point : Access Point | Set hostapd daemon file] ********
ok: [192.168.1.26]

TASK [setup_raspberry_access_point : Access Point | Check if hostapd service -> /dev/null exists] ***
ok: [192.168.1.26]

TASK [setup_raspberry_access_point : Access Point | Remove hostapd service -> /dev/null link] ***
skipping: [192.168.1.26]

TASK [setup_raspberry_access_point : Access Point | Restart hostapd, dnsmasq and enable them] ***
changed: [192.168.1.26] => (item=hostapd)
changed: [192.168.1.26] => (item=dnsmasq)

TASK [setup_raspberry_access_point : Access Point | Set sysctl.conf file] ***********
ok: [192.168.1.26]

TASK [setup_raspberry_access_point : Access Point | Update iptables] ****************
changed: [192.168.1.26]

TASK [setup_raspberry_access_point : Access Point | Update iptables] ****************
changed: [192.168.1.26]

TASK [setup_raspberry_access_point : Access Point | Set rc.local file] **************
ok: [192.168.1.26]

TASK [setup_raspberry_repeater : Bridge | Identify Network Interfaces] **************
ok: [192.168.1.26] => {
    "msg": "Raspberry pi has these interfaces: ['lo', 'wlan1', 'wlan0', 'eth0']"
}

TASK [setup_raspberry_repeater : Bridge | Identify wlan1 interface | exists] ********
ok: [192.168.1.26] => {
    "msg": "Since wlan1 exists, setting up bridge between wlan0 and wlan1"
}

TASK [setup_raspberry_repeater : fail] **********************************************
skipping: [192.168.1.26]

TASK [setup_raspberry_repeater : Bridge | Identify wlan1 interface | not exists] ****
skipping: [192.168.1.26]

TASK [setup_raspberry_repeater : Bridge | Update and upgrade apt packages] **********
ok: [192.168.1.26]

TASK [setup_raspberry_repeater : Bridge | Install requiered packages] ***************
ok: [192.168.1.26]

TASK [setup_raspberry_repeater : Bridge | Stop hostapd, dnsmasq, if running] ********
changed: [192.168.1.26] => (item=hostapd)

TASK [setup_raspberry_repeater : Bridge | Set wpa_supplicant.conf file] *************
fatal: [192.168.1.26]: FAILED! => {"changed": false, "msg": "Could not find or access 'wpa_supplicant.conf.j2'\nSearched in:\n\t/home/pang/project/Raspberry-WiFi-Repeater/ansible/roles/setup_raspberry_repeater/templates/wpa_supplicant.conf.j2\n\t/home/pang/project/Raspberry-WiFi-Repeater/ansible/roles/setup_raspberry_repeater/wpa_supplicant.conf.j2\n\t/home/pang/project/Raspberry-WiFi-Repeater/ansible/roles/setup_raspberry_repeater/tasks/templates/wpa_supplicant.conf.j2\n\t/home/pang/project/Raspberry-WiFi-Repeater/ansible/roles/setup_raspberry_repeater/tasks/wpa_supplicant.conf.j2\n\t/home/pang/project/Raspberry-WiFi-Repeater/ansible/templates/wpa_supplicant.conf.j2\n\t/home/pang/project/Raspberry-WiFi-Repeater/ansible/wpa_supplicant.conf.j2 on the Ansible Controller.\nIf you are using a module and expect the file to exist on the remote, see the remote_src option"}

PLAY RECAP **************************************************************************
192.168.1.26               : ok=20   changed=6    unreachable=0    failed=1    skipped=3    rescued=0    ignored=0   

Using ansible 2.9.6 on current GitHub master (dbf37bd047b7cf7edf46935a2402187010380ae7)

autarkper commented 3 years ago

How do I proceed from here? My Ansible skills are a bit rusty.

The "missing" file seems to exist though:

 $ find . -name wpa_supplicant.conf.j2
./ansible/roles/setup_raspberry_access_point/templates/wpa_supplicant.conf.j2

 $ ls -l ./ansible/roles/setup_raspberry_access_point/templates/wpa_supplicant.conf.j2
-rw-rw-r-- 1 pang pang 145 jul  9 16:11 ./ansible/roles/setup_raspberry_access_point/templates/wpa_supplicant.conf.j2

$ cat ./ansible/roles/setup_raspberry_access_point/templates/wpa_supplicant.conf.j2
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
        ssid="{{ ssid_name }}"
        psk="{{ ssid_pass }}"
}
autarkper commented 3 years ago

Looking more carefully at the error message, I now see that ansible is looking for the template in ansible/roles/setup_raspberry_repeater and subdirectories. Since the file resides under setup_raspberry_access_point, this might be why the task fails.

I will try a fix later on to see if this hypothesis is valid.

ArieLevs commented 3 years ago

Hi @autarkper, Thanks for raising this up, I've merged the PR. will add extra major changes to align with latest RPI version.

thanks again