Moved bastion config to separate role
This commit is contained in:
parent
ef3c7ea33b
commit
17d6182123
@ -49,32 +49,13 @@
|
|||||||
backup: true
|
backup: true
|
||||||
tags: docker
|
tags: docker
|
||||||
|
|
||||||
|
|
||||||
- name: Setup bastion
|
- name: Setup bastion
|
||||||
hosts: bastion
|
hosts: bastion
|
||||||
vars:
|
vars:
|
||||||
tags:
|
tags:
|
||||||
- bastion
|
- bastion
|
||||||
tasks:
|
roles:
|
||||||
- name: Enable IP forwarding
|
- bastion
|
||||||
ansible.builtin.lineinfile:
|
|
||||||
path: /etc/sysctl.conf
|
|
||||||
regexp: '^#?.*net\.ipv4\.ip_forward='
|
|
||||||
line: 'net.ipv4.ip_forward=1'
|
|
||||||
- name: Install Wireguard
|
|
||||||
ansible.builtin.package:
|
|
||||||
name: wireguard
|
|
||||||
state: present
|
|
||||||
- name: Shutdown Wireguard (remove iptables rules)
|
|
||||||
ansible.builtin.shell: wg-quick down wg0
|
|
||||||
ignore_errors: true
|
|
||||||
- name: Copy Wireguard config
|
|
||||||
ansible.builtin.template:
|
|
||||||
src: assets/{{ inventory_hostname }}/wg0.conf.j2
|
|
||||||
dest: /etc/wireguard/wg0.conf
|
|
||||||
backup: true
|
|
||||||
- name: Enable Wireguard int
|
|
||||||
ansible.builtin.shell: wg-quick up wg0
|
|
||||||
|
|
||||||
#- name: Setup Docker hosts
|
#- name: Setup Docker hosts
|
||||||
# hosts:
|
# hosts:
|
||||||
@ -140,8 +121,10 @@
|
|||||||
- name: Local server Wireguard
|
- name: Local server Wireguard
|
||||||
hosts:
|
hosts:
|
||||||
- docker-ext
|
- docker-ext
|
||||||
|
tags:
|
||||||
|
- bastion
|
||||||
tasks:
|
tasks:
|
||||||
- name: "docker-ext Wireguard"
|
- name: "Local server Wireguard"
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: assets/{{ inventory_hostname }}/wg0.conf.j2
|
src: assets/{{ inventory_hostname }}/wg0.conf.j2
|
||||||
dest: /etc/wireguard/wg0.conf
|
dest: /etc/wireguard/wg0.conf
|
||||||
|
|||||||
19
ansible/roles/bastion/tasks/main.yml
Normal file
19
ansible/roles/bastion/tasks/main.yml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
- name: Enable IP forwarding
|
||||||
|
ansible.builtin.lineinfile:
|
||||||
|
path: /etc/sysctl.conf
|
||||||
|
regexp: '^#?.*net\.ipv4\.ip_forward='
|
||||||
|
line: 'net.ipv4.ip_forward=1'
|
||||||
|
- name: Install Wireguard
|
||||||
|
ansible.builtin.package:
|
||||||
|
name: wireguard
|
||||||
|
state: present
|
||||||
|
- name: Shutdown Wireguard (remove iptables rules)
|
||||||
|
ansible.builtin.shell: wg-quick down wg0
|
||||||
|
ignore_errors: true
|
||||||
|
- name: Copy Wireguard config
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: assets/{{ inventory_hostname }}/wg0.conf.j2
|
||||||
|
dest: /etc/wireguard/wg0.conf
|
||||||
|
backup: true
|
||||||
|
- name: Enable Wireguard int
|
||||||
|
ansible.builtin.shell: wg-quick up wg0
|
||||||
Loading…
x
Reference in New Issue
Block a user