76 lines
2.6 KiB
YAML
76 lines
2.6 KiB
YAML
|
- hosts: localhost
|
||
|
vars:
|
||
|
dhcp_start_num: 10
|
||
|
vars_prompt:
|
||
|
- name: node_network_ipv4
|
||
|
prompt: 'IPv4 network?'
|
||
|
default: '172.29.0.1/24'
|
||
|
- name: node_network_ipv6
|
||
|
prompt: 'IPv6 network?'
|
||
|
default: 'fc00:1234:5678::/64'
|
||
|
- name: batman_interface
|
||
|
prompt: 'Name of the BATMAN interface?'
|
||
|
default: batman0
|
||
|
- name: batman_limit_upload
|
||
|
prompt: 'Limit BATMAN upload? (none no limit)'
|
||
|
- name: batman_limit_download
|
||
|
prompt: 'Limit BATMAN download? (none no limit)'
|
||
|
- name: fastd_secret_key
|
||
|
prompt: 'fastd secret key?'
|
||
|
- name: fastd_log_level
|
||
|
prompt: 'fastd log level?'
|
||
|
default: info
|
||
|
- name: fastd_verify_client_peers
|
||
|
prompt: 'fastd verify client peers?'
|
||
|
default: no
|
||
|
- name: fastd_mtu
|
||
|
prompt: 'fastd MTU?'
|
||
|
default: 1300
|
||
|
- name: fastd_peer_limit
|
||
|
prompt: 'fastd peer limit?'
|
||
|
default: 100
|
||
|
- name: max_number_of_clients
|
||
|
prompt: 'Max number of clients'
|
||
|
default: 100
|
||
|
|
||
|
tasks:
|
||
|
- stat:
|
||
|
path: .env
|
||
|
register: env_file
|
||
|
|
||
|
- fail:
|
||
|
msg: "The .env file already exists so it's seem the node was already set up. Delete the file and repeat if you want to set up again."
|
||
|
when: env_file.stat.exists
|
||
|
|
||
|
- copy:
|
||
|
content: |
|
||
|
BATMAN_IPV4={{ node_network_ipv4 }}
|
||
|
BATMAN_IPV6={{ node_network_ipv6 }}
|
||
|
BATMAN_BRIDGE={{ batman_interface }}
|
||
|
BATMAN_LIMIT_DOWNLOAD={{ batman_limit_download }}
|
||
|
BATMAN_LIMIT_UPLOAD={{ batman_limit_upload }}
|
||
|
|
||
|
FASTD_BATMAN_INTERFACE={{ batman_interface }}
|
||
|
FASTD_SECRET_KEY={{ fastd_secret_key }}
|
||
|
FASTD_LOG_LEVEL={{ fastd_log_level }}
|
||
|
FASTD_DONT_VERIFY_PEERS={% if fastd_verify_client_peers %}0{% else %}1{% endif %}
|
||
|
FASTD_INTERFACE=
|
||
|
FASTD_PEER_LIMIT={{ fastd_peer_limit }}
|
||
|
FASTD_MTU={{ fastd_mtu }}
|
||
|
|
||
|
DHCPD_V4_NET={{ node_network_ipv4 |ipaddr('net') }}
|
||
|
DHCPD_V4_RANGE={{ node_network_ipv4 |ipaddr(dhcp_start_num |int) }} {{ node_network_ipv4 |ipaddr((dhcp_start_num |int) + (max_number_of_clients |int)) }}
|
||
|
DHCPD_V6_NET={{ node_network_ipv6 }}
|
||
|
DHCPD_V6_RANGE={{ node_network_ipv6 |ipaddr(dhcp_start_num |int) }} {{ node_network_ipv6 |ipaddr((dhcp_start_num |int) + (max_number_of_clients |int)) }}
|
||
|
DHCPD_INTERFACE={{ batman_interface }}
|
||
|
|
||
|
RADVD_INTERFACE={{ batman_interface }}
|
||
|
RADVD_PREFIX={{ node_network_ipv6 }}
|
||
|
RADVD_SOURCE_LL_ADDRESS=on
|
||
|
RADVD_ADV_MANAGEMENT_FLAG=on
|
||
|
RADVD_OTHER_CONFIG_FLAG=on
|
||
|
RADVD_MTU={{ fastd_mtu }}
|
||
|
dest: .env
|
||
|
mode: u=rw,g=,o=
|
||
|
when: False
|