Compare commits
3 Commits
607a9374db
...
925289b675
Author | SHA1 | Date | |
---|---|---|---|
|
925289b675 | ||
|
79497476c2 | ||
|
318c638df7 |
@ -1,17 +1,93 @@
|
|||||||
---
|
---
|
||||||
all:
|
all:
|
||||||
hosts:
|
hosts:
|
||||||
prusa.lan:
|
router:
|
||||||
iron-man.lan:
|
ansible_host: 192.168.50.2
|
||||||
router.lan:
|
vars:
|
||||||
|
ip: 2
|
||||||
|
mac: 2c:b0:5d:4a:72:62
|
||||||
|
bender:
|
||||||
|
ansible_host: 192.168.50.3
|
||||||
|
vars:
|
||||||
|
ip: 3
|
||||||
|
mac: e0:3f:49:6f:03:c2
|
||||||
|
|
||||||
|
home-assistant:
|
||||||
|
ansible_host: 192.168.50.5
|
||||||
|
vars:
|
||||||
|
ip: 5
|
||||||
|
mac: dc:a6:32:8b:7b:ab
|
||||||
|
mac2: 6a:1b:c8:63:58:7a
|
||||||
|
prusa:
|
||||||
|
ansible_host: 192.168.50.6
|
||||||
|
vars:
|
||||||
|
ip: 6
|
||||||
|
mac: b8:27:eb:96:f3:3f
|
||||||
|
mac2: b8:27:eb:c3:a6:6a
|
||||||
|
# rpi3-02:
|
||||||
|
iron-man:
|
||||||
|
ansible_host: 192.168.50.7
|
||||||
|
vars:
|
||||||
|
ip: 7
|
||||||
|
mac: b8:27:eb:19:f8:0d
|
||||||
|
rpi3a:
|
||||||
|
ansible_host: 192.168.50.8
|
||||||
|
vars:
|
||||||
|
ip: 8
|
||||||
|
mac: b8:27:eb:ff:2a:86
|
||||||
|
kvm-bender:
|
||||||
|
ansible_host: 192.168.50.11
|
||||||
|
vars:
|
||||||
|
ip: 11
|
||||||
|
mac: dc:a6:32:f6:63:c1
|
||||||
|
android-sgs9:
|
||||||
|
vars:
|
||||||
|
ip: 41
|
||||||
|
mac: 24:18:1d:bc:fe:4f
|
||||||
|
ipad:
|
||||||
|
vars:
|
||||||
|
ip: 42
|
||||||
|
mac: b8:63:4d:b6:4c:bc
|
||||||
|
node-01.lan:
|
||||||
|
ansible_host: 192.168.50.101
|
||||||
|
vars:
|
||||||
|
ip: 101
|
||||||
|
mac: dc:a6:32:03:6d:fa
|
||||||
|
node-02.lan:
|
||||||
|
ansible_host: 192.168.50.102
|
||||||
|
vars:
|
||||||
|
ip: 102
|
||||||
|
mac: dc:a6:32:3c:0f:ff
|
||||||
|
node-03.lan:
|
||||||
|
ansible_host: 192.168.50.103
|
||||||
|
vars:
|
||||||
|
ip: 103
|
||||||
|
mac: dc:a6:32:3c:1a:ec
|
||||||
|
node-x86.lan:
|
||||||
|
ansible_host: 192.168.50.186
|
||||||
|
vars:
|
||||||
|
ip: 186
|
||||||
children:
|
children:
|
||||||
docker_cluster:
|
raspberry:
|
||||||
hosts:
|
hosts:
|
||||||
node-01.lan:
|
node-01.lan:
|
||||||
ansible_host: 192.168.50.101
|
|
||||||
node-02.lan:
|
node-02.lan:
|
||||||
ansible_host: 192.168.50.102
|
|
||||||
node-03.lan:
|
node-03.lan:
|
||||||
ansible_host: 192.168.50.103
|
lan:
|
||||||
node-x86.lan:
|
hosts:
|
||||||
ansible_host: 192.168.50.186
|
router:
|
||||||
|
bender:
|
||||||
|
home-assistant:
|
||||||
|
rpi3-01:
|
||||||
|
# rpi3-02:
|
||||||
|
iron-man:
|
||||||
|
prusa:
|
||||||
|
|
||||||
|
|
||||||
|
children:
|
||||||
|
docker_cluster:
|
||||||
|
hosts:
|
||||||
|
node-01.lan:
|
||||||
|
node-02.lan:
|
||||||
|
node-03.lan:
|
||||||
|
node-x86.lan:
|
20
main.yml
20
main.yml
@ -4,18 +4,22 @@
|
|||||||
# - ssh
|
# - ssh
|
||||||
# - ubuntu
|
# - ubuntu
|
||||||
#
|
#
|
||||||
#- hosts: prusa.lan
|
- hosts: prusa
|
||||||
# roles:
|
|
||||||
# - ssh
|
|
||||||
# - octoprint
|
|
||||||
# - ubuntu
|
|
||||||
|
|
||||||
- hosts: docker_cluster
|
|
||||||
roles:
|
roles:
|
||||||
- ssh
|
- ssh
|
||||||
- docker-cluster
|
- octoprint
|
||||||
- ubuntu
|
- ubuntu
|
||||||
|
|
||||||
|
#- hosts: docker_cluster
|
||||||
|
# roles:
|
||||||
|
# - ssh
|
||||||
|
# - docker-cluster
|
||||||
|
# - ubuntu
|
||||||
|
#
|
||||||
|
#- hosts: raspberry
|
||||||
|
# roles:
|
||||||
|
# - i2c-clock
|
||||||
|
|
||||||
#- hosts: router.lan
|
#- hosts: router.lan
|
||||||
# roles:
|
# roles:
|
||||||
# - router
|
# - router
|
||||||
|
@ -1 +1,2 @@
|
|||||||
node-02 IPaddr::192.168.50.100/24/eth0:0
|
node-02 IPaddr::192.168.50.100/24/eth0:0
|
||||||
|
node-02 ssh-external
|
28
roles/docker-cluster/files/etc/ha.d/resource.d/ssh-external
Executable file
28
roles/docker-cluster/files/etc/ha.d/resource.d/ssh-external
Executable file
@ -0,0 +1,28 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
SERVICE=sshd-external
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
systemctl start "${SERVICE}"
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
systemctl stop "${SERVICE}"
|
||||||
|
;;
|
||||||
|
reload)
|
||||||
|
systemctl reload "${SERVICE}"
|
||||||
|
;;
|
||||||
|
force-reload)
|
||||||
|
systemctl force-reload "${SERVICE}"
|
||||||
|
;;
|
||||||
|
restart)
|
||||||
|
systemctl restart "${SERVICE}"
|
||||||
|
;;
|
||||||
|
status)
|
||||||
|
systemctl status "${SERVICE}"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: /etc/init.d/ssh {start|stop|reload|force-reload|restart|status}" || true
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
@ -0,0 +1,19 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=OpenBSD Secure Shell server
|
||||||
|
After=network.target auditd.service
|
||||||
|
ConditionPathExists=!/etc/ssh/sshd_not_to_be_run
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
EnvironmentFile=-/etc/default/ssh
|
||||||
|
ExecStartPre=/usr/sbin/sshd -t
|
||||||
|
ExecStart=/usr/sbin/sshd -D $SSHD_OPTS -f /etc/ssh/sshd_config_external
|
||||||
|
ExecReload=/usr/sbin/sshd -t
|
||||||
|
ExecReload=/bin/kill -HUP $MAINPID
|
||||||
|
KillMode=process
|
||||||
|
Restart=on-failure
|
||||||
|
RestartPreventExitStatus=255
|
||||||
|
Type=notify
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
Alias=sshd-external.service
|
@ -11,4 +11,6 @@
|
|||||||
|
|
||||||
- import_tasks: hostfile.yml
|
- import_tasks: hostfile.yml
|
||||||
|
|
||||||
- import_tasks: docker-watcher.yml
|
- import_tasks: docker-watcher.yml
|
||||||
|
|
||||||
|
- import_tasks: ssh-external.yml
|
24
roles/docker-cluster/tasks/ssh-external.yml
Normal file
24
roles/docker-cluster/tasks/ssh-external.yml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
---
|
||||||
|
- become: yes
|
||||||
|
block:
|
||||||
|
- name: copy config
|
||||||
|
copy:
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0600
|
||||||
|
directory_mode: yes
|
||||||
|
src: etc/ssh
|
||||||
|
dest: /etc
|
||||||
|
|
||||||
|
- name: copy ha.d resource ssh-external
|
||||||
|
copy:
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0755
|
||||||
|
src: etc/ha.d/resource.d/ssh-external
|
||||||
|
dest: /etc/ha.d/resource.d/ssh-external
|
||||||
|
|
||||||
|
- name: add systemd service
|
||||||
|
copy:
|
||||||
|
src: lib/systemd/system/sshd-external.service
|
||||||
|
dest: /lib/systemd/system/sshd-external.service
|
@ -12,3 +12,12 @@
|
|||||||
vars:
|
vars:
|
||||||
network: "{{ lan }}"
|
network: "{{ lan }}"
|
||||||
serial: "{{ ansible_date_time.year }}{{ ansible_date_time.month }}{{ ansible_date_time.day }}02"
|
serial: "{{ ansible_date_time.year }}{{ ansible_date_time.month }}{{ ansible_date_time.day }}02"
|
||||||
|
|
||||||
|
- name: Create db.lan
|
||||||
|
# become: yes
|
||||||
|
template:
|
||||||
|
src: etc/bind/db.reverse.j2
|
||||||
|
dest: build/dns/db.{{ lan.network_reverse }}
|
||||||
|
vars:
|
||||||
|
network: "{{ lan }}"
|
||||||
|
serial: "{{ ansible_date_time.year }}{{ ansible_date_time.month }}{{ ansible_date_time.day }}02"
|
||||||
|
@ -8,7 +8,7 @@ $ORIGIN {{ network.network_name }}.
|
|||||||
86400;
|
86400;
|
||||||
)
|
)
|
||||||
|
|
||||||
@ IN NS dns.lan.
|
@ IN NS dns.{{ network.network_name }}.
|
||||||
|
|
||||||
DNS IN A {{ network.network_prefix }}.100
|
DNS IN A {{ network.network_prefix }}.100
|
||||||
|
|
||||||
|
15
roles/network/templates/etc/bind/db.reverse.j2
Normal file
15
roles/network/templates/etc/bind/db.reverse.j2
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
$TTL 86400
|
||||||
|
$ORIGIN {{ network.network_name }}.
|
||||||
|
@ IN SOA {{ network.network_name }}. dns.{{ network.network_name }}. (
|
||||||
|
{{ serial }};
|
||||||
|
604800;
|
||||||
|
86400;
|
||||||
|
2419200;
|
||||||
|
86400;
|
||||||
|
)
|
||||||
|
|
||||||
|
{{ network.network_reverse }} IN A dns.{{ network.network_name }}
|
||||||
|
|
||||||
|
{% for host in network.hosts %}
|
||||||
|
{{ host.ip }} IN PTR {{ host.name }}
|
||||||
|
{% endfor %}
|
@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
lan:
|
lan:
|
||||||
network_prefix: 192.168.50
|
network_prefix: 192.168.50
|
||||||
|
network_reverse: 50.168.192
|
||||||
network_name: lan
|
network_name: lan
|
||||||
address: 192.168.50.0
|
address: 192.168.50.0
|
||||||
mask: 255.255.255.0
|
mask: 255.255.255.0
|
||||||
@ -15,29 +16,36 @@ lan:
|
|||||||
- name: bender
|
- name: bender
|
||||||
ip: 3
|
ip: 3
|
||||||
mac: e0:3f:49:6f:03:c2
|
mac: e0:3f:49:6f:03:c2
|
||||||
- name: prusa-new
|
|
||||||
ip: 4
|
|
||||||
mac: b8:27:eb:96:f3:3f
|
|
||||||
mac2: b8:27:eb:c3:a6:6a
|
|
||||||
- name: home-assistant
|
- name: home-assistant
|
||||||
ip: 5
|
ip: 5
|
||||||
mac: dc:a6:32:8b:7b:ab
|
mac: dc:a6:32:8b:7b:ab
|
||||||
mac2: 6a:1b:c8:63:58:7a
|
mac2: 6a:1b:c8:63:58:7a
|
||||||
|
- name: prusa
|
||||||
|
ip: 6
|
||||||
|
mac: b8:27:eb:96:f3:3f
|
||||||
|
mac2: b8:27:eb:c3:a6:6a
|
||||||
|
# - name: rpi3
|
||||||
- name: iron-man
|
- name: iron-man
|
||||||
ip: 7
|
ip: 7
|
||||||
mac: dc:a6:32:03:6d:fa
|
mac: dc:a6:32:03:6d:fa
|
||||||
- name: prusa
|
- name: rpi3a
|
||||||
ip: 8
|
ip: 8
|
||||||
mac: b8:27:eb:ff:2a:86
|
mac: b8:27:eb:ff:2a:86
|
||||||
- name: farnsworth
|
- name: kvm-bender
|
||||||
|
ip: 11
|
||||||
|
mac: dc:a6:32:f6:63:c1
|
||||||
|
- name: hulk
|
||||||
ip: 21
|
ip: 21
|
||||||
|
mac: 24:4b:fe:05:e2:8b
|
||||||
|
- name: farnsworth
|
||||||
|
ip: 22
|
||||||
mac: e0:3f:49:83:e8:dd
|
mac: e0:3f:49:83:e8:dd
|
||||||
- name: ipad
|
|
||||||
ip: 46
|
|
||||||
mac: b8:63:4d:b6:4c:bc
|
|
||||||
- name: android-sgs9
|
- name: android-sgs9
|
||||||
ip: 47
|
ip: 41
|
||||||
mac: 24:18:1d:bc:fe:4f
|
mac: 24:18:1d:bc:fe:4f
|
||||||
|
- name: ipad
|
||||||
|
ip: 42
|
||||||
|
mac: b8:63:4d:b6:4c:bc
|
||||||
- name: node-01
|
- name: node-01
|
||||||
ip: 101
|
ip: 101
|
||||||
mac: dc:a6:32:03:6d:fa
|
mac: dc:a6:32:03:6d:fa
|
||||||
|
@ -6,7 +6,7 @@ After=network.target
|
|||||||
User=octoprint
|
User=octoprint
|
||||||
Group=octoprint
|
Group=octoprint
|
||||||
Restart=always
|
Restart=always
|
||||||
ExecStart=/home/octoprint/.local/bin/octoprint
|
ExecStart=/home/octoprint/bin/octoprint
|
||||||
Type=simple
|
Type=simple
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
@ -5,44 +5,29 @@
|
|||||||
apt:
|
apt:
|
||||||
update_cache: yes
|
update_cache: yes
|
||||||
pkg:
|
pkg:
|
||||||
- python-pip
|
- python3-pip
|
||||||
- python-dev
|
- python3-all-dev
|
||||||
- python-setuptools
|
- python3-setuptools
|
||||||
- python-virtualenv
|
- python3-virtualenv
|
||||||
- python-pillow
|
|
||||||
- git
|
- git
|
||||||
- libyaml-dev
|
- libyaml-dev
|
||||||
- build-essential
|
- build-essential
|
||||||
|
- acl
|
||||||
|
- libjpeg8-dev
|
||||||
|
|
||||||
- name: install octoprint software
|
- name: install octoprint software
|
||||||
|
become: true
|
||||||
become_user: octoprint
|
become_user: octoprint
|
||||||
shell:
|
shell:
|
||||||
chdir: /home/octoprint
|
chdir: /home/octoprint
|
||||||
cmd: |
|
cmd: |
|
||||||
virtualenv --system-site-packages .
|
virtualenv --system-site-packages .
|
||||||
source bin/activate
|
source bin/activate
|
||||||
pip install pip --upgrade
|
pip3 install pip --upgrade
|
||||||
pip install octoprint
|
pip3 install octoprint
|
||||||
args:
|
args:
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
|
|
||||||
- name: enable system wide packages
|
|
||||||
file:
|
|
||||||
path: /home/octoprint/lib/python2.7/no-global-site-packages.txt
|
|
||||||
state: absent
|
|
||||||
|
|
||||||
- name: Create symbolic link for PIL package
|
|
||||||
file:
|
|
||||||
src: /usr/lib/python2.7/dist-packages/PIL
|
|
||||||
dest: /home/octoprint/lib/python2.7/site-packages/PIL
|
|
||||||
state: link
|
|
||||||
|
|
||||||
- name: Create symbolic link for pillow package
|
|
||||||
file:
|
|
||||||
src: /usr/lib/python2.7/dist-packages/Pillow-5.1.0.egg-info
|
|
||||||
dest: /home/octoprint/lib/python2.7/site-packages/Pillow-5.1.0.egg-info
|
|
||||||
state: link
|
|
||||||
|
|
||||||
- name: install plugins
|
- name: install plugins
|
||||||
become_user: octoprint
|
become_user: octoprint
|
||||||
pip:
|
pip:
|
||||||
@ -58,6 +43,4 @@
|
|||||||
- https://github.com/paukstelis/OctoPrint-Cancelobject/archive/master.zip
|
- https://github.com/paukstelis/OctoPrint-Cancelobject/archive/master.zip
|
||||||
- https://github.com/Renaud11232/OctoPrint-Resource-Monitor/archive/master.zip
|
- https://github.com/Renaud11232/OctoPrint-Resource-Monitor/archive/master.zip
|
||||||
- https://github.com/agrif/OctoPrint-InfluxDB/archive/master.zip
|
- https://github.com/agrif/OctoPrint-InfluxDB/archive/master.zip
|
||||||
- https://github.com/juergenpabel/OctoPrint-Procastinator/archive/master.zip
|
|
||||||
- https://github.com/ManuelMcLure/OctoPrint-WiFiStatus/archive/master.zip
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user