Fixed all

This commit is contained in:
2020-12-02 23:35:47 +03:00
parent 2ff2469fe3
commit d28e254be8
19 changed files with 198 additions and 91 deletions
View File
+31 -13
View File
@@ -7,27 +7,29 @@
become: yes
roles:
- { role: apache2config }
- { role: metricbeat }
- { role: 0x0i.systemd }
# TODO
# https://ru.alxschwarz.com/posts/sshfs-with-password-in-systemd/
vars:
tmpl:
- { file: "101-syncthing", value: 'Use ProxyHost "syncthing.rudolf" "/" "http://192.168.17.2:{{ syncthing_port }}/" "syncthing.rudolf"' }
- { file: "102-jenkins", value: 'Use ProxyHost "jenkins.rudolf" "/" "http://192.168.17.2:{{ jenkins_port }}/" "jenkins.rudolf"' }
- { file: "103-zabbix", value: 'Use ProxyHost "zabbix.rudolf" "/" "http://94.177.197.15:8081/" "zabbix.rudolf"' }
- { file: "000-gogs", value: 'Use ProxyHost "rudolf" "/" "http://192.168.17.4:{{ gogs_port }}/" "rudolf"' }
- { file: "101-syncthing", value: 'Use ProxyHost "syncthing.rudolf" "/" "http://192.168.17.4:{{ syncthing_port }}/" "syncthing.rudolf"' }
# - { file: "102-jenkins", value: 'Use ProxyHost "jenkins.rudolf" "/" "http://192.168.17.2:{{ jenkins_port }}/" "jenkins.rudolf"' }
# - { file: "103-zabbix", value: 'Use ProxyHost "zabbix.rudolf" "/" "http://94.177.197.15:8081/" "zabbix.rudolf"' }
- { file: "104-ssh", value: 'Use ProxyHost "sh.rudolf" "/" "http://192.168.17.4:4200/" "sh.rudolf"' }
- { file: "torrent", value: 'Use ProxyHost "torrent.rudolf" "/transmission" "http://192.168.17.2:9091/transmission" "torrent.rudolf"' }
# - { file: "torrent", value: 'Use ProxyHost "torrent.rudolf" "/transmission" "http://192.168.17.2:9091/transmission" "torrent.rudolf"' }
# - {file: "static", value: 'Use DocRootVHost "static.rudolf" "/home/www/static"' }
# - {file: "", value: '# TODO Header edit Location ^http://jenkins.rudolf.com.ua https://jenkins.rudolf.com.ua' }
# - {file: "webmin", value: 'Use ProxySSLVHost "webmin.rudolf" "/" "http://localhost:10000/" "webmin.rudolf"' }
# - {file: "", value: 'Use ProxySSLVHost "bitsync.rudolf" "/" "http://localhost:8888/" "bitsync.rudolf"' }
domains:
- rudolf.com.ua
- jenkins.rudolf.com.ua
# - jenkins.rudolf.com.ua
- syncthing.rudolf.com.ua
- smarthome.rudolf.com.ua
- torrent.rudolf.com.ua
- zabbix.rudolf.com.ua
# - torrent.rudolf.com.ua
# - zabbix.rudolf.com.ua
- sh.rudolf.com.ua
# - part.syncthing.rudolf.com.ua
# - static.rudolf.com.ua
@@ -36,10 +38,25 @@
# - webmin.rudolf.com.ua
# - bitsync.rudolf.com.ua
# - wa.rudolf.com.ua
metricbeat_es_user: "metricbeat"
metricbeat_es_password: "metricbeat"
metricbeat_kibana_index: "metricbeat"
elasticsearch_host: "192.168.17.2:9200"
# metricbeat_es_user: "metricbeat"
# metricbeat_es_password: "metricbeat"
# metricbeat_kibana_index: "metricbeat"
# elasticsearch_host: "192.168.17.2:9200"
unit_config:
- name: mnt-DATA
type: mount
Unit:
Description: Mount DATA fs
Mount:
What: /dev/disk/by-uuid/2DC48EE00DE0CBC9
Where: /mnt/DATA
Type: ntfs-3g
Options: rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096
Install:
WantedBy: multi-user.target
- hosts: serva4og
become: yes
@@ -51,4 +68,5 @@
become: yes
roles:
- { role: jdk }
# https://hub.docker.com/r/mmontagna/docker-vpn-pptp/
+35
View File
@@ -0,0 +1,35 @@
- hosts: odroid
become: yes
roles:
- { role: 0x0i.systemd }
vars:
unit_config:
- name: gogs
Unit:
Description: Gogs git repo service
Service:
User: 'git'
Group: 'git'
WorkingDirectory: /mnt/DATA/gogsRuntime/home
ExecStart: /mnt/DATA/gogsRuntime/dist/gogs web -c /mnt/DATA/gogsRuntime/gogs/conf/app.ini
Install:
WantedBy: multi-user.target
tasks:
- name: group git exists
group:
name: "git"
state: present
- name: user git
user:
name: "git"
group: "git"
append: yes
home: /mnt/DATA/gogsRuntime/home
shell: /bin/bash
createhome: yes
generate_ssh_key: yes
state: present
+1 -1
View File
@@ -1,4 +1,4 @@
gogs_port: 8081
gogs_port: 3000
gogs_ssh: 23
jenkins_port: 8080
jenkins_cli: 50000
+4 -4
View File
@@ -1,9 +1,9 @@
[online]
serva4og ansible_ssh_user=rudolf ansible_ssh_host=192.168.17.2
odroid ansible_ssh_user=rudolf ansible_ssh_host=192.168.17.4
main ansible_ssh_user=rudolf ansible_ssh_host=94.177.197.15
#main ansible_ssh_user=rudolf ansible_ssh_host=94.177.197.15
[offline]
pi ansible_ssh_user=pi ansible_ssh_host=192.168.17.3
malta4ka ansible_ssh_user=kate ansible_ssh_host=192.168.17.113
# serva4og ansible_ssh_user=rudolf ansible_ssh_host=192.168.17.2
# pi ansible_ssh_user=pi ansible_ssh_host=192.168.17.3
# malta4ka ansible_ssh_user=kate ansible_ssh_host=192.168.17.113
+3
View File
@@ -0,0 +1,3 @@
#! /bin/bash
ansible-galaxy install -r requirements.yaml
+2
View File
@@ -0,0 +1,2 @@
- src: tumf.systemd-service
- src: 0x0i.systemd
+2
View File
@@ -1,3 +1,5 @@
- name: sysctl
command: sysctl -p
- name: sshd
service: name=ssh state=restarted
+18 -1
View File
@@ -26,15 +26,32 @@
- name: ssh authorized keys
authorized_key: user="{{ user }}" key="{{ lookup('file', lookup('env','HOME') + '/.ssh/id_rsa.pub') }}"
- name: Disallow password authentication
lineinfile:
dest: /etc/ssh/sshd_config
regexp: "^PasswordAuthentication"
line: "PasswordAuthentication no"
state: present
notify: sshd
- name: Disallow root SSH access
lineinfile:
dest: /etc/ssh/sshd_config
regexp: "^PermitRootLogin"
line: "PermitRootLogin no"
state: present
notify: sshd
- name: install packages
apt: name={{ item }} update_cache=yes state=latest
with_items:
- git
- etckeeper
- zip
- name: Remote etc git
git_config:
repo: /etc
repo: /etc/
scope: local
name: remote.origin.url
value: http://rudolf.com.ua/rudolf/etckeeper.git
+3 -1
View File
@@ -26,7 +26,9 @@
- { name: macro , state: present }
- { name: auth_openidc , state: present }
- { name: ssl , state: present }
- { name: cgid , state: present }
- { name: cgid , state: present }
- { name: proxy_wstunnel, state: present }
# - { name: ssl , state: absent }
notify:
- restart apache2
@@ -1,16 +0,0 @@
<IfModule mod_ssl.c>
<VirtualHost *:{{ https_port }}>
ServerAdmin rudolfss13@gmail.com
ServerName rudolf.com.ua
#Redirect 404 /
#ErrorDocument 404 "Page Not Found xxx"
Use MacroSSL rudolf
</VirtualHost>
</IfModule>
Use ProxyHost "rudolf" "/" "http://192.168.17.2:{{ gogs_port }}/" "rudolf"
@@ -13,8 +13,13 @@
Require claim email:malta4ka@gmail.com
</Location>
ProxyPass / http://192.168.17.4:{{ tomcat_port }}/smarthome/
ProxyPassReverse / http://192.168.17.4:{{ tomcat_port }}/smarthome/
RewriteEngine on
RewriteCond ${HTTP:Upgrade} websocket [NC]
RewriteCond ${HTTP:Connection} upgrade [NC]
RewriteRule .* "wss:/192.168.17.4:8888/$1" [P,L]
ProxyPass / http://192.168.17.4:8888/
ProxyPassReverse / http://192.168.17.4:8888/
</VirtualHost>
</IfModule>
@@ -30,8 +35,10 @@
Allow from 188.134.29.71
</Location>
ProxyPass / http://192.168.17.4:{{ tomcat_port }}/smarthome/
ProxyPassReverse / http://192.168.17.4:{{ tomcat_port }}/smarthome/
ProxyPass "/rest/ws" "ws://192.168.17.4:8888/rest/ws"
ProxyPass / http://192.168.17.4:8888/
ProxyPassReverse / http://192.168.17.4:8888/
</VirtualHost>
-5
View File
@@ -1,5 +0,0 @@
- name: restart gogs docker
service:
name: docker
state: restarted
restart_policy: always
-15
View File
@@ -1,15 +0,0 @@
galaxy_info:
author: your name
description: your description
company: your company (optional)
license: license (GPLv2, CC-BY, etc)
min_ansible_version: 1.2
galaxy_tags: []
dependencies:
- { role: docker }
-31
View File
@@ -1,31 +0,0 @@
- name: run gogs docker container
docker:
name: gogs
image: gogs/gogs
detach: True
restart_policy: always
net: default
volumes:
- "/var/gogs:/data"
ports:
- "0.0.0.0:{{ gogs_port }}:3000"
state: reloaded
- name: oauth config
blockinfile:
dest: /var/gogs/gogs/conf/app.ini
block: |
[oauth]
ENABLED = true
[oauth.google]
ENABLED = true
CLIENT_ID = `259977835489-5lrmult5iimh3f7dik848fb00mn8td2j.apps.googleusercontent.com`
CLIENT_SECRET = `3xzC51fw-yBeWv63pxYlmYE7`
SCOPES = `https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile`
AUTH_URL = `https://accounts.google.com/o/oauth2/auth`
TOKEN_URL = `https://accounts.google.com/o/oauth2/token`
notify: restart gogs docker
+3
View File
@@ -0,0 +1,3 @@
# Secrets for authentication using CHAP
# client server secret IP addresses
rudolf * rudolf-pptpd *
+2
View File
@@ -0,0 +1,2 @@
- name: restart pptpd
service: name=pptpd state=restarted
+41
View File
@@ -0,0 +1,41 @@
- name: install pptpd
apt: name=pptpd update_cache=yes state=latest
- name: add users
copy:
src: "files/chap-secrets"
dest: /etc/ppp/chap-secrets
mode: 0600
notify: restart pptpd
- name: config 1
lineinfile:
dest: /etc/pptpd.conf
regexp: "^.*{{ item.line }}"
line: "{{ item.line }}"
state: present
with_items:
- { line: "localip 10.10.10.1" }
- { line: "remoteip 10.10.10.2-10" }
- { line: "bcrelay eth0" }
notify: restart pptpd
- name: config 2
lineinfile:
dest: /etc/ppp/pptpd-options
regexp: "^.*{{ item.line }}"
line: "{{ item.line }}"
state: present
with_items:
- { line: "ms-dns 8.8.8.8" }
- { line: "auth" }
- { line: "logfile /var/log/pptpd.log" }
notify: restart pptpd
- name: pptpd running
service:
name: pptpd
state: started
enabled: yes
+42
View File
@@ -0,0 +1,42 @@
- hosts: odroid
become: yes
roles:
- { role: 0x0i.systemd }
vars:
unit_config:
- name: syncthing
Unit:
Description: Syncthing - Open Source Continuous File Synchronization
Documentation: man:syncthing(1)
Wants: syncthing-inotify.service
Service:
ExecStart: /usr/bin/syncthing -home=/mnt/DATA/syncthingRuntime -no-browser -no-restart -logflags=0
User: 'syncthing'
Group: 'syncthing'
Restart: on-failure
SuccessExitStatus: 3 4
RestartForceExitStatus: 3 4
Install:
WantedBy: default.target
tasks:
- name: install packages
apt: name={{ item }} update_cache=yes state=latest
with_items:
- syncthing
- name: group syncthing exists
group:
name: "syncthing"
state: present
- name: user syncthing
user:
name: "syncthing"
group: "syncthing"
append: yes
shell: /bin/bash
state: present