Compare commits
5 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
195859625a | |
|
|
b3971199bd | |
|
|
2f807008f4 | |
|
|
da05908d65 | |
|
|
8d38f71eb5 |
|
|
@ -1,2 +1,3 @@
|
||||||
.DS_Store
|
.DS_Store
|
||||||
ansible/playbooks/wg_clients
|
ansible/playbooks/wg_clients
|
||||||
|
ansible/playbooks/filter_plugins/__pycache__
|
||||||
|
|
@ -215,7 +215,7 @@ ask_vault_pass=True
|
||||||
# (string) Set the main callback used to display Ansible output. You can only have one at a time.
|
# (string) Set the main callback used to display Ansible output. You can only have one at a time.
|
||||||
# You can have many other callbacks, but just one can be in charge of stdout.
|
# You can have many other callbacks, but just one can be in charge of stdout.
|
||||||
# See :ref:`callback_plugins` for a list of available options.
|
# See :ref:`callback_plugins` for a list of available options.
|
||||||
;stdout_callback=default
|
stdout_callback=debug
|
||||||
|
|
||||||
# (string) Set the default strategy used for plays.
|
# (string) Set the default strategy used for plays.
|
||||||
;strategy=linear
|
;strategy=linear
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
---
|
||||||
|
bind_allow_query:
|
||||||
|
- "any"
|
||||||
|
|
||||||
|
bind_zones:
|
||||||
|
- name: 'vlab1.arpa.'
|
||||||
|
networks:
|
||||||
|
- "{{ vlan_network }}"
|
||||||
|
name_servers:
|
||||||
|
- "{{ inventory_hostname }}"
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
---
|
---
|
||||||
wg_interface: wg0
|
wg_interface: wg0
|
||||||
wg_port: 51820
|
wg_port: 51820
|
||||||
#wg_server_public_interface: eth0
|
vlan_network: 192.168.99
|
||||||
wg_server_address: 192.168.99.1/32
|
wg_server_address: 192.168.99.1/32
|
||||||
#wg_server_private_key: "{{ wg_server_private_key }}"
|
|
||||||
|
dns_server: True
|
||||||
|
|
||||||
|
|
||||||
wg_peers:
|
wg_peers:
|
||||||
|
|
@ -19,7 +20,6 @@ wg_peers:
|
||||||
- "192.168.99.0/24"
|
- "192.168.99.0/24"
|
||||||
- "10.22.0.0/16"
|
- "10.22.0.0/16"
|
||||||
- name: forced_missing_key_test
|
- name: forced_missing_key_test
|
||||||
forceRegeneration: True
|
|
||||||
ip: "192.168.99.6/32"
|
ip: "192.168.99.6/32"
|
||||||
allowedIPs :
|
allowedIPs :
|
||||||
- "192.168.99.0/24"
|
- "192.168.99.0/24"
|
||||||
|
|
|
||||||
|
|
@ -20,4 +20,7 @@ vlab-1:
|
||||||
tester.sse.cloud.isti.cnr.it:
|
tester.sse.cloud.isti.cnr.it:
|
||||||
controller:
|
controller:
|
||||||
hosts:
|
hosts:
|
||||||
controller.sse.cloud.isti.cnr.it:
|
controller.sse.cloud.isti.cnr.it:
|
||||||
|
nameserver:
|
||||||
|
hosts:
|
||||||
|
vpn-1.sse.cloud.isti.cnr.it:
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
collections:
|
||||||
|
- openstack.cloud
|
||||||
|
vars:
|
||||||
|
cloud: openstack
|
||||||
|
tasks:
|
||||||
|
- name : Get images
|
||||||
|
resources:
|
||||||
|
service: image
|
||||||
|
type: image
|
||||||
|
register: images
|
||||||
|
|
||||||
|
- debug:
|
||||||
|
msg: "Images : {{images.resources | mapattributes(['name','status']) | to_nice_yaml}}"
|
||||||
|
|
||||||
|
- name : Get compute flavors
|
||||||
|
resources:
|
||||||
|
service: compute
|
||||||
|
type: flavor
|
||||||
|
register: flavors
|
||||||
|
|
||||||
|
- debug:
|
||||||
|
msg: "Flavors : {{flavors.resources | mapattributes(['name','ram','vcpus']) | to_nice_yaml}}"
|
||||||
|
|
||||||
|
- name : Get networks
|
||||||
|
resources:
|
||||||
|
service: network
|
||||||
|
type: network
|
||||||
|
register: networks
|
||||||
|
|
||||||
|
- debug:
|
||||||
|
msg: "Networks : {{networks.resources | mapattributes(['name','status']) | to_nice_yaml}}"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
# Source - https://stackoverflow.com/a/57665825
|
||||||
|
# Posted by Rabin, modified by community. See post 'Timeline' for change history
|
||||||
|
# Retrieved 2026-07-14, License - CC BY-SA 4.0
|
||||||
|
|
||||||
|
#!/usr/bin/env python
|
||||||
|
class FilterModule(object):
|
||||||
|
def filters(self):
|
||||||
|
return { 'mapattributes': self.mapattributes }
|
||||||
|
|
||||||
|
def mapattributes(self, list_of_dicts, list_of_keys):
|
||||||
|
l = []
|
||||||
|
for di in list_of_dicts:
|
||||||
|
newdi = { }
|
||||||
|
for key in list_of_keys:
|
||||||
|
# newdi[key] = di[key]
|
||||||
|
if di.get(key, None) != None:
|
||||||
|
newdi[key] = di[key]
|
||||||
|
|
||||||
|
l.append(newdi)
|
||||||
|
return l
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
---
|
||||||
|
- name: Preparing hosts
|
||||||
|
vars:
|
||||||
|
vpn_dns_hosts: []
|
||||||
|
set_fact:
|
||||||
|
vpn_dns_hosts: "{{vpn_dns_hosts + [{'name': item.name, 'ip': (item.ip | split('/'))[0] }] }}"
|
||||||
|
loop: "{{wg_peers + [{'name': 'ns1', 'ip':wg_server_address}] }}"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Preparing bind zones
|
||||||
|
set_fact:
|
||||||
|
bind_zones : "{{ bind_zones | combine ({'primaries':[(wg_server_address | split ('/'))[0]], 'hosts':vpn_dns_hosts}) }}"
|
||||||
|
|
||||||
|
- name: Import role Bind
|
||||||
|
vars:
|
||||||
|
bind_listen:
|
||||||
|
ipv4:
|
||||||
|
- port: 53
|
||||||
|
addresses:
|
||||||
|
- "127.0.0.1"
|
||||||
|
- "{{ (wg_server_address | split ('/'))[0] }}"
|
||||||
|
- port: 5353
|
||||||
|
addresses:
|
||||||
|
- "127.0.1.1"
|
||||||
|
ansible.builtin.import_role:
|
||||||
|
name: bodsch.dns.bind
|
||||||
|
|
||||||
|
- name: Start a service
|
||||||
|
become: True
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
name: named
|
||||||
|
state: restarted
|
||||||
|
|
@ -2,5 +2,11 @@
|
||||||
- name: Configure VPN Server
|
- name: Configure VPN Server
|
||||||
hosts: wireguard_server
|
hosts: wireguard_server
|
||||||
become: true
|
become: true
|
||||||
|
debugger: on_failed
|
||||||
roles:
|
roles:
|
||||||
- wireguard_server
|
- wireguard_server
|
||||||
|
tasks:
|
||||||
|
- name: Import role vpn_dns
|
||||||
|
ansible.builtin.import_role:
|
||||||
|
name: vpn_dns
|
||||||
|
when: dns_server is defined and dns_server
|
||||||
|
|
@ -32,6 +32,9 @@ collections:
|
||||||
- name: chrissayon.wordpress_docker
|
- name: chrissayon.wordpress_docker
|
||||||
version: 1.0.2
|
version: 1.0.2
|
||||||
|
|
||||||
|
- name: openstack.cloud
|
||||||
|
version: 2.6.0
|
||||||
|
|
||||||
# dockerless wordpress
|
# dockerless wordpress
|
||||||
# - name: iamgini.wordpress
|
# - name: iamgini.wordpress
|
||||||
# version: 1.0.0
|
# version: 1.0.0
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue