diff --git a/hosts b/hosts index 87b2f08..31b8054 100644 --- a/hosts +++ b/hosts @@ -1,4 +1,6 @@ noodlehub.binary.kitchen +cannelloni.binary.kitchen +bkvoron [3D_Printers] spaghetti.binary.kitchen @@ -9,5 +11,5 @@ maccaroni.binary.kitchen [Octoprint_hosts] spaghetti.binary.kitchen maccaroni.binary.kitchen -cannelloni.binary.kitchen +#cannelloni.binary.kitchen diff --git a/roles/moonraker/templates/moonraker.conf.j2 b/roles/moonraker/templates/moonraker.conf.j2 index 26dc0da..022f6c9 100644 --- a/roles/moonraker/templates/moonraker.conf.j2 +++ b/roles/moonraker/templates/moonraker.conf.j2 @@ -1,6 +1,7 @@ [server] host: {{ moonraker_host }} port: {{ moonraker_port }} +klippy_uds_address: /tmp/klipper_uds [file_manager] config_path: {{ moonraker_file_manager_config_path }} @@ -12,13 +13,15 @@ enable_object_processing: True trusted_clients: 0.0.0.0/0 -[secrets] -secrets_path: /etc/moonraker/passwd - [octoprint_compat] [history] [zeroconf] - +[mqtt] +address: pizza.binary.kitchen +username: 3dprinter +password: Su7nu3oof6ah +instance_name: MainC/Lab/3dPrinter/cannelloni +publish_split_status: True diff --git a/roles/octoprint/defaults/main.yml b/roles/octoprint/defaults/main.yml index 1351fa9..ba280d3 100644 --- a/roles/octoprint/defaults/main.yml +++ b/roles/octoprint/defaults/main.yml @@ -7,6 +7,7 @@ octoprint_has_webcam: false octoprint_default_plugins: - "https://github.com/OctoPrint/OctoPrint-MQTT/archive/master.zip" + - "https://github.com/eyal0/OctoPrint-PrintTimeGenius/archive/master.zip" octoprint_config_salt: "{{ octoprint_salt }}" octoprint_config_api_key: "{{ octoprint_api_key}}" diff --git a/roles/octoprint/templates/config.yaml.j2 b/roles/octoprint/templates/config.yaml.j2 index a309496..4f0a6fb 100644 --- a/roles/octoprint/templates/config.yaml.j2 +++ b/roles/octoprint/templates/config.yaml.j2 @@ -5,10 +5,11 @@ appearance: accessControl: salt: "{{ octoprint_config_salt }}" + autologinLocal: true autologinAs: binarykitchen localNetworks: - 127.0.0.0/8 - - 172.23.0.0/16 + - 172.23.3.0/24 api: key: "{{ octoprint_config_api_key }}" @@ -16,6 +17,10 @@ api: plugins: tracking: enabled: false + announcements: + enabled_channels: + - _important + - _releases printerProfiles: default: {{ octoprint_config_default_profile }} diff --git a/roles/octoprint/templates/nginx_vhost.j2 b/roles/octoprint/templates/nginx_vhost.j2 index fa8fe59..dded82a 100644 --- a/roles/octoprint/templates/nginx_vhost.j2 +++ b/roles/octoprint/templates/nginx_vhost.j2 @@ -1,66 +1,66 @@ {% if not octoprint_ssl %} server { - listen 80; - listen [::]:80; + listen 80; + listen [::]:80; - server_name {{ octoprint_domain }}; + server_name {{ octoprint_domain }}; - location /webcam/ { - postpone_output 0; - proxy_buffering off; - proxy_ignore_headers X-Accel-Buffering; - proxy_pass http://localhost:8080/; - } + location /webcam/ { + postpone_output 0; + proxy_buffering off; + proxy_ignore_headers X-Accel-Buffering; + proxy_pass http://localhost:8080/; + } - location / { - client_max_body_size 1024M; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header Host $http_host; + location / { + client_max_body_size 1024M; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header Host $http_host; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Scheme $scheme; proxy_http_version 1.1; - proxy_pass http://localhost:5000; - } + proxy_pass http://localhost:5000; + } } {% else %} server { - listen 80; - listen [::]:80; + listen 80; + listen [::]:80; - server_name {{ octoprint_domain }}; + server_name {{ octoprint_domain }}; - location /.well-known/acme-challenge { - default_type "text/plain"; - alias /var/www/acme-challenge; - } + location /.well-known/acme-challenge { + default_type "text/plain"; + alias /var/www/acme-challenge; + } - location / { - return 301 https://{{ octoprint_domain }}$request_uri; - } + location / { + return 301 https://{{ octoprint_domain }}$request_uri; + } } server { - listen 443 ssl http2; - listen [::]:443 ssl http2; + listen 443 ssl http2; + listen [::]:443 ssl http2; - server_name {{ gitea_domain }}; + server_name {{ gitea_domain }}; - ssl_certificate_key /etc/nginx/ssl/{{ gitea_domain }}.key; - ssl_certificate /etc/nginx/ssl/{{ gitea_domain }}.crt; + ssl_certificate_key /etc/nginx/ssl/{{ gitea_domain }}.key; + ssl_certificate /etc/nginx/ssl/{{ gitea_domain }}.crt; - location / { - client_max_body_size 1024M; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header Host $http_host; + location / { + client_max_body_size 1024M; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header Host $http_host; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Scheme $scheme; proxy_set_header X-Script-Name /octoprint; proxy_http_version 1.1; - proxy_pass http://localhost:5000; - } + proxy_pass http://localhost:5000; + } } {% endif %} diff --git a/roles/ustreamer/defaults/main.yml b/roles/ustreamer/defaults/main.yml new file mode 100644 index 0000000..e736df7 --- /dev/null +++ b/roles/ustreamer/defaults/main.yml @@ -0,0 +1,2 @@ +ustreamer_user: ustreamer +ustreamer_group: ustreamer diff --git a/roles/ustreamer/handlers/main.yml b/roles/ustreamer/handlers/main.yml new file mode 100644 index 0000000..577ef8a --- /dev/null +++ b/roles/ustreamer/handlers/main.yml @@ -0,0 +1,5 @@ +- name: Reload systemd + systemd: daemon_reload=yes + +- name: Restart ustreamer + service: name=ustreamer state=restared diff --git a/roles/ustreamer/tasks/main.yml b/roles/ustreamer/tasks/main.yml new file mode 100644 index 0000000..6564c57 --- /dev/null +++ b/roles/ustreamer/tasks/main.yml @@ -0,0 +1,29 @@ +- name: Create group + group: + name: "{{ ustreamer_group }}" + +- name: Create user + user: + name: "{{ ustreamer_user }}" + group: "{{ ustreamer_group }}" + append: yes + groups: + - video + +- name: Install ustreamer dependencies + apt: + name: + - ffmpeg + - ustreamer + +- name: Install systemd unit + template: src=ustreamer.service.j2 dest=/lib/systemd/system/ustreamer.service + notify: + - Reload systemd + - Restart ustreamer + +- name: Enable and start ustreamer + service: + name: ustreamer + state: started + enabled: yes diff --git a/roles/ustreamer/templates/ustreamer.service.j2 b/roles/ustreamer/templates/ustreamer.service.j2 new file mode 100644 index 0000000..7f76eaf --- /dev/null +++ b/roles/ustreamer/templates/ustreamer.service.j2 @@ -0,0 +1,19 @@ +[Unit] +Description=Ustreamer +After=syslog.target +After=network.target + +[Service] +RestartSec=2s +Type=simple +User={{ ustreamer_user }} +Group={{ ustreamer_user }} +{% if ustreamer_args is defined %} +ExecStart=/usr/bin/ustreamer {{ustreamer_args}} +{% else %} +ExecStart=/usr/bin/ustreamer +{% endif %} +Restart=always + +[Install] +WantedBy=multi-user.target diff --git a/site.yml b/site.yml index 20e9e28..338da3d 100644 --- a/site.yml +++ b/site.yml @@ -4,20 +4,7 @@ - common - root_keys -- name: Setup noodlehub - hosts: noodlehub.binary.kitchen - roles: - - noodlehub - tags: noodlehub - -- name: Setup klipper - hosts: cannelloni.binary.kitchen - roles: - - klipper - tags: klipper - - name: Setup octoprint hosts: [Octoprint_hosts] roles: - - octoprint - tags: octoprint \ No newline at end of file + - octoprint \ No newline at end of file diff --git a/site_testing.yml b/site_testing.yml index 0b8c0c3..e9bda1e 100644 --- a/site_testing.yml +++ b/site_testing.yml @@ -1,10 +1,5 @@ -- name: Setup common rules - hosts: raspberrypi +- name: Setup mainsail + hosts: cannelloni.binary.kitchen roles: - - common - - root_keys - -- name: Setup octoprint - hosts: raspberrypi - roles: - - octoprint \ No newline at end of file + - moonraker + - mainsail \ No newline at end of file