Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
3102c621f0 | |||
e3f03edf3f | |||
f481a965dd | |||
a0aa289c05 |
5
.github/workflows/vagrant.yml
vendored
5
.github/workflows/vagrant.yml
vendored
@ -3,8 +3,9 @@ name: homelab-ci
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- testing
|
||||
- github_actions
|
||||
# - main
|
||||
# - testing
|
||||
|
||||
jobs:
|
||||
homelab-ci:
|
||||
|
@ -4,4 +4,5 @@
|
||||
roles:
|
||||
- base
|
||||
- jenkins
|
||||
- proxy
|
||||
- docker
|
||||
|
@ -26,7 +26,7 @@
|
||||
ansible.builtin.template:
|
||||
src: smb.conf.j2
|
||||
dest: /etc/samba/smb.conf
|
||||
mode: "700"
|
||||
mode: "644"
|
||||
notify: restart_samba
|
||||
|
||||
- name: Start smbd and enable on boot
|
||||
|
@ -18,6 +18,28 @@
|
||||
src: /etc/wireguard/privatekey
|
||||
register: wgkey
|
||||
|
||||
- name: Check if WireGuard preshared key file exists
|
||||
ansible.builtin.stat:
|
||||
path: /etc/wireguard/presharedkey-{{ item.name }}
|
||||
loop: "{{ wireguard.peers }}"
|
||||
loop_control:
|
||||
label: "{{ item.name }}"
|
||||
register: presharedkey_files
|
||||
|
||||
- name: Grab WireGuard preshared key for configuration
|
||||
ansible.builtin.slurp:
|
||||
src: /etc/wireguard/presharedkey-{{ item.item.name }}
|
||||
register: wgshared
|
||||
loop: "{{ presharedkey_files.results }}"
|
||||
loop_control:
|
||||
label: "{{ item.item.name }}"
|
||||
when: item.stat.exists
|
||||
|
||||
- name: Grab WireGuard private key for configuration
|
||||
ansible.builtin.slurp:
|
||||
src: /etc/wireguard/privatekey
|
||||
register: wgkey
|
||||
|
||||
- name: Install WireGuard configuration
|
||||
ansible.builtin.template:
|
||||
src: wireguard.j2
|
||||
|
@ -1,4 +1,6 @@
|
||||
[Interface]
|
||||
# {{ ansible_managed }}
|
||||
|
||||
[Interface] # {{ ansible_hostname }}
|
||||
PrivateKey = {{ wgkey['content'] | b64decode | trim }}
|
||||
Address = {{ wireguard.address }}
|
||||
{% if wireguard.listenport is defined %}
|
||||
@ -6,8 +8,26 @@ ListenPort = {{ wireguard.listenport }}
|
||||
{% endif %}
|
||||
|
||||
{% for peer in wireguard.peers %}
|
||||
{% if peer.name is defined %}
|
||||
[Peer] # {{ peer.name }}
|
||||
{% else %}
|
||||
[Peer]
|
||||
{% endif %}
|
||||
PublicKey = {{ peer.publickey }}
|
||||
{% if peer.presharedkey is defined %}
|
||||
PresharedKey = {{ peer.presharedkey }}
|
||||
{% else %}
|
||||
{% set preshared_key = (
|
||||
wgshared.results
|
||||
| selectattr('item.item.name', 'equalto', peer.name)
|
||||
| first
|
||||
).content
|
||||
| default(none)
|
||||
%}
|
||||
{% if preshared_key is not none %}
|
||||
PresharedKey = {{ preshared_key | b64decode | trim }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if peer.endpoint is defined %}
|
||||
Endpoint = {{ peer.endpoint }}
|
||||
{% endif %}
|
||||
|
@ -35,6 +35,12 @@ server {
|
||||
client_max_body_size {{ item.client_max_body_size }};
|
||||
{% endif %}
|
||||
location / {
|
||||
{% if item.allowedips is defined %}
|
||||
{% for ip in item.allowedips %}
|
||||
allow {{ ip }};
|
||||
{% endfor %}
|
||||
deny all;
|
||||
{% endif %}
|
||||
{% if item.restrict is defined and item.restrict %}
|
||||
auth_basic "{{ item.restrict_name | default('Restricted Access') }}";
|
||||
auth_basic_user_file {{ item.restrict_file | default('/etc/nginx/.htpasswd') }};
|
||||
|
Loading…
Reference in New Issue
Block a user