Init
This commit is contained in:
commit
452f4bef14
3
ansible.cfg
Normal file
3
ansible.cfg
Normal file
@ -0,0 +1,3 @@
|
||||
# ansible.cfg
|
||||
[defaults]
|
||||
inventory = inventory
|
7
inventory
Normal file
7
inventory
Normal file
@ -0,0 +1,7 @@
|
||||
# inventory/hosts
|
||||
|
||||
[vpns]
|
||||
test_vpn ansible_host=195.140.147.45 ansible_ssh_user=root
|
||||
|
||||
[all:vars]
|
||||
ansible_python_interpreter=/usr/bin/python3
|
11
playbook.yml
Normal file
11
playbook.yml
Normal file
@ -0,0 +1,11 @@
|
||||
---
|
||||
- hosts: vpns
|
||||
roles:
|
||||
- docker
|
||||
- wireguard
|
||||
- openvpn
|
||||
- nyancat
|
||||
vars:
|
||||
wg_pubkey: PHww02NctXHyNM8Jf/n/QzhL07VXbFYxuUsq6OAXHFc=
|
||||
wg_privkey: uDUNwltNneDXvurpw/yZGpTfL+Vfcp7GX6BmOFbNBXg=
|
||||
wg_port: 40124
|
14
roles/docker/tasks/main.yml
Normal file
14
roles/docker/tasks/main.yml
Normal file
@ -0,0 +1,14 @@
|
||||
---
|
||||
- name: Install docker
|
||||
apt:
|
||||
name: ['docker.io', 'docker-compose']
|
||||
state: present
|
||||
update_cache: yes
|
||||
- name: Run mtproto container
|
||||
community.docker.docker_container:
|
||||
name: mtproto-telegram
|
||||
state: present
|
||||
image: telegrammessenger/proxy
|
||||
ports:
|
||||
- '443:443'
|
||||
|
17
roles/nyancat/files/nyancat-tty.service
Normal file
17
roles/nyancat/files/nyancat-tty.service
Normal file
@ -0,0 +1,17 @@
|
||||
[Unit]
|
||||
Description=nyancat on tty1
|
||||
After=graphical.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStartPre=/bin/sleep 5
|
||||
ExecStart=/usr/bin/nyancat -snI
|
||||
ExecStop=/bin/kill -HUP ${MAINPID}
|
||||
StandardInput=tty
|
||||
StandardOutput=tty
|
||||
TTYPath=/dev/tty1
|
||||
Restart=always
|
||||
RestartSec=2
|
||||
|
||||
[Install]
|
||||
WantedBy=graphical.target
|
28
roles/nyancat/tasks/main.yml
Normal file
28
roles/nyancat/tasks/main.yml
Normal file
@ -0,0 +1,28 @@
|
||||
---
|
||||
- name: Install nyancat
|
||||
apt:
|
||||
name: nyancat
|
||||
state: present
|
||||
when: ansible_facts['os_family'] == "Debian"
|
||||
|
||||
- name: Install nyancat unit
|
||||
copy:
|
||||
src: files/nyancat-tty.service
|
||||
dest: /etc/systemd/system/nyancat-tty.service
|
||||
|
||||
- name: Disable tty
|
||||
systemd:
|
||||
name: "{{ item }}"
|
||||
enabled: no
|
||||
state: stopped
|
||||
loop:
|
||||
- getty
|
||||
- getty@tty1
|
||||
ignore_errors: True
|
||||
|
||||
- name: Install nyancat unit
|
||||
systemd:
|
||||
name: nyancat-tty
|
||||
enabled: yes
|
||||
state: started
|
||||
daemon_reload: yes
|
0
roles/openvpn/tasks/main.yml
Normal file
0
roles/openvpn/tasks/main.yml
Normal file
23
roles/wireguard/tasks/main.yml
Normal file
23
roles/wireguard/tasks/main.yml
Normal file
@ -0,0 +1,23 @@
|
||||
---
|
||||
- name: install wg packages
|
||||
apt:
|
||||
name: ['wireguard','wireguard-tools']
|
||||
state: present
|
||||
|
||||
- name: install wg hub config
|
||||
template:
|
||||
src: templates/wghub.conf.j2
|
||||
dest: /etc/wireguard/wghub.conf
|
||||
|
||||
- name: enable and persist ip forwarding
|
||||
sysctl:
|
||||
name: net.ipv4.ip_forward
|
||||
value: "1"
|
||||
state: present
|
||||
sysctl_set: yes
|
||||
reload: yes
|
||||
- name: start and enable wireguard
|
||||
systemd:
|
||||
name: wg-quick@wghub
|
||||
enabled: yes
|
||||
state: started
|
4
roles/wireguard/templates/wghub.conf.j2
Normal file
4
roles/wireguard/templates/wghub.conf.j2
Normal file
@ -0,0 +1,4 @@
|
||||
[Interface]
|
||||
Address = 10.205.101.1/24
|
||||
ListenPort = {{ wg_port }}
|
||||
PrivateKey = {{ wg_privkey }}
|
Loading…
Reference in New Issue
Block a user