---
##############################################################################
# Max USB power output
- name: Switch USB to max power output
  lineinfile: dest=/boot/config.txt line='max_usb_current=1'
  notify: reboot

##############################################################################
# Interfaces

- name: Remove wificlient interface references from the main interface file 
  replace:
    dest=/etc/network/interfaces
    regexp='^.*{{ wificlient_interface }}(.|\n)*?(\n|\Z)$'
    replace=''
  notify: restart-networking

- name: Ensure interface.d source-dir reference
  lineinfile: 
    dest=/etc/network/interfaces 
    line='source /etc/network/interfaces.d/*.cfg'  
  notify: restart-networking
  
- name: Add separate file for hotspot to interface.d
  template: src=interface.j2 dest=/etc/network/interfaces.d/{{ wificlient_interface }}_wificlient
  notify: restart-networking
    
##############################################################################
# wpa supplicant

- name: Configure wpa_supplicant 
  template: src=wpa_supplicant_conf.j2 dest=/etc/wpa_supplicant/wpa_supplicant.conf 
  notify: restart-networking

# Reboot due to possible changes now
- meta: flush_handlers
---
##############################################################################
# Max USB power output
- name: Switch USB to max power output
  lineinfile: dest=/boot/config.txt line='max_usb_current=1'
  notify: reboot

##############################################################################
# Interfaces

- name: Remove wificlient interface references from the main interface file 
  replace:
    dest=/etc/network/interfaces
    regexp='^.*{{ wificlient_interface }}(.|\n)*?(\n|\Z)$'
    replace=''
  notify: restart-networking

- name: Ensure interface.d source-dir reference
  lineinfile: 
    dest=/etc/network/interfaces 
    line='source-directory /etc/network/interfaces.d'
  notify: restart-networking
  
- name: Add separate file for hotspot to interface.d
  template: src=interface.j2 dest=/etc/network/interfaces.d/{{ wificlient_interface }}_wificlient
  notify: restart-networking
    
##############################################################################
# wpa supplicant

- name: Configure wpa_supplicant 
  template: src=wpa_supplicant_conf.j2 dest=/etc/wpa_supplicant/wpa_supplicant.conf 
  notify: restart-networking

# Reboot due to possible changes now
- meta: flush_handlers
Use the default source dir to avoid duplicate inclusions
Use the default source dir to avoid duplicate inclusions
