mirror of
https://github.com/iiab/iiab.git
synced 2025-02-14 20:22:08 +00:00
commit
39163b5fac
13 changed files with 143 additions and 5 deletions
|
@ -61,6 +61,7 @@
|
|||
- bzip2
|
||||
- i2c-tools
|
||||
- bridge-utils
|
||||
- netmask
|
||||
- usbutils
|
||||
- hostapd
|
||||
- wget
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
owner: "{{ apache_user }}"
|
||||
group: "{{ apache_user }}"
|
||||
state: directory
|
||||
recurse: true
|
||||
force: true
|
||||
with_items:
|
||||
- "{{ awstats_data_dir }}"
|
||||
|
|
|
@ -4,6 +4,7 @@ wireless_lan_present: False
|
|||
strict_networking: False
|
||||
iiab_demo_mode: False
|
||||
gui_static_wan: False
|
||||
wan_cidr:
|
||||
|
||||
# Set defaults for discovery process as strings
|
||||
wifi1: "not found-1"
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
dest: /etc/NetworkManager/system-connections/
|
||||
src: network/bridge-br0
|
||||
mode: 0600
|
||||
when: iiab_network_mode != "Appliance"
|
||||
|
||||
- name: Remove br0 in Appliance Mode for NetworkManager
|
||||
file:
|
||||
|
@ -24,6 +25,39 @@
|
|||
state: absent
|
||||
when: iiab_network_mode == "Appliance"
|
||||
|
||||
- name: Removing static for NetworkManager
|
||||
file:
|
||||
dest: /etc/NetworkManager/system-connections/iiab-static
|
||||
state: absent
|
||||
when: wan_ip == "dhcp"
|
||||
|
||||
- name: Static IP computing CIDR
|
||||
shell: netmask {{ wan_ip }}/{{ wan_netmask }} | awk -F "/" '{print $2}'
|
||||
register: CIDR
|
||||
when: wan_ip != "dhcp"
|
||||
|
||||
- name: Static IP setting CIDR
|
||||
set_fact:
|
||||
wan_cidr: "{{ CIDR.stdout }}"
|
||||
when: wan_ip != "dhcp"
|
||||
|
||||
- name: Create uuid for NM's keyfile store static
|
||||
shell: uuidgen
|
||||
register: uuid_response2
|
||||
when: wan_ip != "dhcp"
|
||||
|
||||
- name: Put the uuid in place
|
||||
set_fact:
|
||||
gen_uuid2: "{{ uuid_response2.stdout_lines[0] }}"
|
||||
when: wan_ip != "dhcp"
|
||||
|
||||
- name: Copy static template for NetworkManager
|
||||
template:
|
||||
dest: /etc/NetworkManager/system-connections/iiab-static
|
||||
src: network/NM-static.j2
|
||||
mode: 0600
|
||||
when: wan_ip != "dhcp"
|
||||
|
||||
- name: Stop wpa_supplicant service
|
||||
service:
|
||||
name: wpa_supplicant
|
||||
|
|
|
@ -37,13 +37,25 @@
|
|||
- name: Copy the bridge script
|
||||
template: dest=/etc/network/interfaces.d/iiab
|
||||
src=network/systemd.j2
|
||||
when: not is_rpi and (iiab_lan_iface == "br0" or wan_ip != "dhcp")
|
||||
when: not is_rpi and (iiab_lan_iface == "br0" or wan_ip != "dhcp" or gui_static_wan_ip == "undefined")
|
||||
|
||||
- name: Copy the bridge script for RPi
|
||||
template: dest=/etc/network/interfaces.d/iiab
|
||||
src=network/rpi.j2
|
||||
when: is_rpi and iiab_lan_iface == "br0"
|
||||
|
||||
- name: Workaround auto issue on Debian-9
|
||||
template: dest=/etc/network/interfaces.d/patch_auto
|
||||
src=network/debian-auto.j2
|
||||
when: iiab_wan_iface != "none" and is_debian_9
|
||||
|
||||
- name: Clearing out /etc/network/interfaces for static addresses (is_debian_9)
|
||||
lineinfile:
|
||||
state: absent
|
||||
path: /etc/network/interfaces
|
||||
regexp: "{{ iiab_wan_iface }}"
|
||||
when: wan_ip != "dhcp" and iiab_wan_iface != "none" and is_debian_9
|
||||
|
||||
- name: bind may be affected
|
||||
service: name={{ dns_service }} state=stopped
|
||||
when: named_install and dnsmasq_enabled
|
||||
|
|
|
@ -28,6 +28,39 @@
|
|||
state: stopped
|
||||
when: is_ubuntu_18
|
||||
|
||||
- name: Static IP computing CIDR
|
||||
shell: netmask {{ wan_ip }}/{{ wan_netmask }} | awk -F "/" '{print $2}'
|
||||
register: CIDR
|
||||
when: wan_ip != "dhcp"
|
||||
|
||||
- name: Static IP setting CIDR
|
||||
set_fact:
|
||||
wan_cidr: "{{ CIDR.stdout }}"
|
||||
when: wan_ip != "dhcp"
|
||||
|
||||
# ICO will always set gui_static_wan_ip away from the default of 'unset' while
|
||||
# gui_static_wan turns dhcp on/off through wan_ip in computed_network and
|
||||
# overrides gui_static_wan_ip that is present. Changing wan_ip in local_vars
|
||||
# is a oneway street to static.
|
||||
- name: Supply static template
|
||||
template:
|
||||
dest: /etc/netplan/50-cloud-init.yaml
|
||||
src: network/cloud-init.j2
|
||||
backup: no
|
||||
when: (wan_ip != "dhcp" or gui_static_wan_ip == "undefined") and is_ubuntu_18
|
||||
|
||||
- name: Remove static WAN template
|
||||
file:
|
||||
state: absent
|
||||
dest: /etc/systemd/network/IIAB-Static.network
|
||||
when: wan_ip == "dhcp" and not is_ubuntu_18
|
||||
|
||||
- name: Supply static WAN template
|
||||
template:
|
||||
dest: /etc/systemd/network/IIAB-Static.network
|
||||
src: network/systemd-static-net.j2
|
||||
when: wan_ip != "dhcp" and not is_ubuntu_18
|
||||
|
||||
- name: Reload systemd
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
|
|
20
roles/network/templates/network/NM-static.j2
Normal file
20
roles/network/templates/network/NM-static.j2
Normal file
|
@ -0,0 +1,20 @@
|
|||
[connection]
|
||||
id=iiab-wan-static
|
||||
uuid={{ gen_uuid2 }}
|
||||
type=802-3-ethernet
|
||||
interface-name={{ iiab_wan_iface }}
|
||||
permissions=
|
||||
|
||||
[ipv4]
|
||||
method=manual
|
||||
dns={{ wan_nameserver }};
|
||||
dns-search={{ iiab_domain }};
|
||||
addresses1={{ wan_ip }};{{ wan_cidr }};{{ wan_gateway }};
|
||||
may-fail=true
|
||||
|
||||
[802-3-ethernet]
|
||||
duplex=full
|
||||
|
||||
[ipv6]
|
||||
method=link-local
|
||||
may-fail=true
|
23
roles/network/templates/network/cloud-init.j2
Normal file
23
roles/network/templates/network/cloud-init.j2
Normal file
|
@ -0,0 +1,23 @@
|
|||
{% if wan_ip != "dhcp" %}
|
||||
network:
|
||||
ethernets:
|
||||
{{ iiab_wan_iface }}:
|
||||
addresses:
|
||||
- {{ wan_ip }}/{{ wan_cidr }}
|
||||
gateway4: {{ wan_gateway }}
|
||||
nameservers:
|
||||
addresses:
|
||||
- {{ wan_nameserver }}
|
||||
search:
|
||||
- {{ iiab_domain }}
|
||||
optional: true
|
||||
version: 2
|
||||
{% else %}
|
||||
network:
|
||||
ethernets:
|
||||
{{ iiab_wan_iface }}:
|
||||
addresses: []
|
||||
dhcp4: true
|
||||
optional: true
|
||||
version: 2
|
||||
{% endif %}
|
1
roles/network/templates/network/debian-auto.j2
Normal file
1
roles/network/templates/network/debian-auto.j2
Normal file
|
@ -0,0 +1 @@
|
|||
auto {{ iiab_wan_iface }}
|
12
roles/network/templates/network/systemd-static-net.j2
Normal file
12
roles/network/templates/network/systemd-static-net.j2
Normal file
|
@ -0,0 +1,12 @@
|
|||
# /etc/systemd/network/IIAB-static.network
|
||||
[Match]
|
||||
Name={{ iiab_wan_iface }}
|
||||
|
||||
[Network]
|
||||
Address={{ wan_ip }}/{{ wan_cidr }}
|
||||
Gateway={{ wan_gateway }}
|
||||
LinkLocalAddressing=yes
|
||||
DNS={{ wan_namserver }}
|
||||
Domains={{ iiab_domain }}
|
||||
|
||||
|
|
@ -27,14 +27,14 @@ iface br0 inet static
|
|||
{% if dhcpcd_result == "enabled" or wan_in_interfaces %}
|
||||
# client or user defined
|
||||
{% endif %}
|
||||
{% if dhcpcd_result != "enabled" and not wan_in_interfaces %}
|
||||
{% if dhcpcd_result != "enabled" and not wan_in_interfaces and wan_ip == "dhcp" %}
|
||||
#cover butt
|
||||
auto {{ iiab_wan_iface }}
|
||||
iface {{ iiab_wan_iface }} inet dhcp
|
||||
{% endif %}
|
||||
# end dhcp clients
|
||||
# static wan
|
||||
{% if wan_ip != "dhcp" and dhcpcd_result != "enabled" and wan_in_interfaces == "false" %}
|
||||
{% if wan_ip != "dhcp" and dhcpcd_result != "enabled" %}
|
||||
auto {{ iiab_wan_iface }}
|
||||
iface {{ iiab_wan_iface }} inet static
|
||||
address {{ wan_ip }}
|
||||
|
|
|
@ -4,7 +4,7 @@ echo -e '\nATTEMPTING TO INSTALL THE LATEST (RELEASED VERSION OF) ANSIBLE.'
|
|||
echo -e 'Ensure you'"'"'re online before running this script!'
|
||||
echo -e 'OR: consider scripts/ansible-2.4.x or scripts/ansible/2.5.x "slow food" instead.\n'
|
||||
|
||||
GOOD_VER="2.5.0" # Ansible version for OLPC XO laptops (pip install).
|
||||
GOOD_VER="2.5.2" # Ansible version for OLPC XO laptops (pip install).
|
||||
# On other OS's we install/upgrade to THE latest (released version of) Ansible.
|
||||
CURR_VER="undefined"
|
||||
# below are unused for future use
|
||||
|
|
|
@ -4,7 +4,7 @@ echo -e '\nATTEMPTING TO INSTALL THE LATEST ANSIBLE 2.5.x'
|
|||
echo -e 'Ensure you'"'"'re online before running this script!'
|
||||
echo -e 'OR: consider scripts/ansible to keep up-to-date with Ansible'"'"'s evolution.\n'
|
||||
|
||||
GOOD_VER="2.5.0" # Ansible version for OLPC XO laptops (pip install).
|
||||
GOOD_VER="2.5.2" # Ansible version for OLPC XO laptops (pip install).
|
||||
# On other OS's we attempt to install/upgrade/pin to the latest Ansible 2.5.x
|
||||
CURR_VER="undefined"
|
||||
# below are unused for future use
|
||||
|
|
Loading…
Reference in a new issue