Include floating ip
This commit is contained in:
parent
25b688ec42
commit
c6dc7b0008
@ -36,6 +36,12 @@ swap_block_size: 1024
|
|||||||
swap_block_count: 2097152
|
swap_block_count: 2097152
|
||||||
# Default is 2GB of swapfile
|
# Default is 2GB of swapfile
|
||||||
|
|
||||||
|
## NETWORKING
|
||||||
|
floating_ips: []
|
||||||
|
# - ipv4: 10.11.12.13
|
||||||
|
# ipv6: 2001:0db8:85a3:08d3::1/64
|
||||||
|
# - ipv4: 192.168.0.2
|
||||||
|
# ipv6: 2001:0db8:bca2:98d6::1/64
|
||||||
|
|
||||||
## USER + GROUPS
|
## USER + GROUPS
|
||||||
root_user_cred: MyVeryStrongPassword
|
root_user_cred: MyVeryStrongPassword
|
||||||
|
|||||||
@ -17,3 +17,9 @@
|
|||||||
state: restarted
|
state: restarted
|
||||||
enabled: yes
|
enabled: yes
|
||||||
when: wireguard_installed is defined and not wireguard_installed.changed
|
when: wireguard_installed is defined and not wireguard_installed.changed
|
||||||
|
|
||||||
|
- name: restart networking service
|
||||||
|
service:
|
||||||
|
name: networking
|
||||||
|
state: restarted
|
||||||
|
enabled: yes
|
||||||
@ -28,6 +28,9 @@
|
|||||||
import_tasks: swap.yml
|
import_tasks: swap.yml
|
||||||
when: swap_on
|
when: swap_on
|
||||||
|
|
||||||
|
- name: Setup networking
|
||||||
|
import_tasks: networking.yml
|
||||||
|
|
||||||
- name: Setup basic cloud folders for apps and storage
|
- name: Setup basic cloud folders for apps and storage
|
||||||
file:
|
file:
|
||||||
state: directory
|
state: directory
|
||||||
|
|||||||
9
tasks/networking.yml
Normal file
9
tasks/networking.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
- name: setup floating ips
|
||||||
|
template:
|
||||||
|
src: "./etc/networking/interfaces.d/60-floating-ip.cfg.j2"
|
||||||
|
dest: "/etc/networking/interfaces.d/60-floating-ip.cfg"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0644
|
||||||
|
notify: restart networking service
|
||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
- name: install fail2ban service
|
- name: install wireguard service
|
||||||
apt:
|
apt:
|
||||||
update_cache: yes
|
update_cache: yes
|
||||||
state: "{% if cloud_update | bool %}latest{% else %}present{% endif %}"
|
state: "{% if cloud_update | bool %}latest{% else %}present{% endif %}"
|
||||||
|
|||||||
14
templates/etc/networking/interfaces.d/60-floating-ip.cfg.j2
Normal file
14
templates/etc/networking/interfaces.d/60-floating-ip.cfg.j2
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{% for config in floating_ips %}
|
||||||
|
{%if 'ipv4' in config % }
|
||||||
|
auto eth0:{{ loop.index }}
|
||||||
|
iface eth0:{{ loop.index }} inet static
|
||||||
|
address {{ config.ipv4 }}
|
||||||
|
netmask 32
|
||||||
|
{% endif %}
|
||||||
|
{%if 'ipv6' in config % }
|
||||||
|
auto eth0:{{ loop.index }}
|
||||||
|
iface eth0:{{ loop.index }} inet6 static
|
||||||
|
address {{ config.ipv6 }}
|
||||||
|
netmask 64
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
Loading…
Reference in New Issue
Block a user