[FIX] hostname should not have hyphens
This commit is contained in:
parent
3e9ece5237
commit
c4e3a9e407
|
@ -1,10 +1,10 @@
|
|||
---
|
||||
# defaults file for tinc
|
||||
tinc_base_dir: /etc/tinc
|
||||
tinc_tmp_pubkey: "tmp/rsa_key-{{ ansible_hostname }}.pub"
|
||||
tinc_tmp_pubkey: "tmp/rsa_key-{{ ansible_hostname | replace('-', '_') }}.pub"
|
||||
|
||||
# ID of the vpn to create
|
||||
tinc_vpn_id: vpn0
|
||||
|
||||
# hostname of the always-on server
|
||||
tinc_central_host: hetzner-01
|
||||
tinc_central_host: hetzner_01
|
||||
|
|
|
@ -38,14 +38,14 @@
|
|||
become: yes
|
||||
fetch:
|
||||
src: "{{ tinc_base_dir }}/{{ tinc_vpn_id }}/rsa_key.pub"
|
||||
dest: "{{ role_path }}/templates/tmp/rsa_key-{{ ansible_hostname }}.pub"
|
||||
dest: "{{ role_path }}/templates/tmp/rsa_key-{{ ansible_hostname | replace('-', '_') }}.pub"
|
||||
flat: yes
|
||||
|
||||
- name: Main - Create own hostfile
|
||||
become: yes
|
||||
template:
|
||||
src: "{{ role_path }}/templates/hostfile.j2"
|
||||
dest: "{{ tinc_base_dir }}/{{ tinc_vpn_id }}/hosts/{{ ansible_hostname }}"
|
||||
dest: "{{ tinc_base_dir }}/{{ tinc_vpn_id }}/hosts/{{ ansible_hostname | replace('-', '_') }}"
|
||||
|
||||
- name: Main - Create tinc-up script
|
||||
become: yes
|
||||
|
@ -64,8 +64,8 @@
|
|||
- name: Main - Fetch all hostfiles
|
||||
become: yes
|
||||
fetch:
|
||||
src: "{{ tinc_base_dir }}/{{ tinc_vpn_id }}/hosts/{{ ansible_hostname }}"
|
||||
dest: "{{ role_path }}/files/tmp/{{ ansible_hostname }}"
|
||||
src: "{{ tinc_base_dir }}/{{ tinc_vpn_id }}/hosts/{{ ansible_hostname | replace('-', '_') }}"
|
||||
dest: "{{ role_path }}/files/tmp/{{ ansible_hostname | replace('-', '_') }}"
|
||||
flat: yes
|
||||
|
||||
- name: "Main - Enable {{ tinc_vpn_id }}"
|
||||
|
|
|
@ -16,7 +16,7 @@ iptables -t nat -A POSTROUTING -o eth0 -s {{ tinc_vpn_net }} -j MASQUERADE
|
|||
|
||||
{% elif ansible_os_family == 'Darwin' %}
|
||||
# only a single endpoint works, because tun interface is p2p
|
||||
/sbin/ifconfig tun0 inet {{ tinc_client_ip | ipaddr('address') }} {{ tinc_remote_nets[0].gateway }} up netmast 255.255.255.0
|
||||
/sbin/ifconfig tun0 inet {{ tinc_client_ip | ipaddr('address') }} {{ tinc_remote_nets[0].gateway }} up netmask 255.255.255.0
|
||||
|
||||
/sbin/route -n add -net {{ tinc_remote_nets[0].net_cidr }} {{ tinc_remote_nets[0].gateway }}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
Name = {{ ansible_hostname }}
|
||||
Name = {{ ansible_hostname | replace('-', '_') }}
|
||||
{% if (override_os_family is defined) | ternary(override_os_family,ansible_os_family) != 'Darwin' %}
|
||||
Device = /dev/net/tun
|
||||
{% endif %}
|
||||
{% if ansible_hostname != tinc_central_host %}
|
||||
{% if ansible_hostname | replace('-', '_') != tinc_central_host %}
|
||||
ConnectTo = {{ tinc_central_host }}
|
||||
{% endif %}
|
||||
AddressFamily = any
|
||||
|
|
Loading…
Reference in a new issue