# HG changeset patch # User Luke Hoersten # Date 1662839578 18000 # Node ID fd46c0e68c2c1f2b5aa579d6e5aadc3a273138d6 # Parent febbf9c3394cc9f2ad2958acad1c4c679f1432ff Initial octoprint role. diff -r febbf9c3394c -r fd46c0e68c2c octoprint/files/octoprint.service --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/octoprint/files/octoprint.service Sat Sep 10 14:52:58 2022 -0500 @@ -0,0 +1,14 @@ +[Unit] +Description=Octoprint +After=network.target + +[Service] +Environment="LC_ALL=C.UTF-8" +Environment="LANG=C.UTF-8" +User=octoprint +Group=octoprint +WorkingDirectory=/opt/octoprint/ +ExecStart=/usr/local/bin/octoprint + +[Install] +WantedBy=multi-user.target diff -r febbf9c3394c -r fd46c0e68c2c octoprint/handlers/main.yaml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/octoprint/handlers/main.yaml Sat Sep 10 14:52:58 2022 -0500 @@ -0,0 +1,5 @@ +--- + +- name: restart octoprint + become: yes + systemd: name="octoprint.service" state="restarted" daemon_reload="yes" diff -r febbf9c3394c -r fd46c0e68c2c octoprint/tasks/main.yaml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/octoprint/tasks/main.yaml Sat Sep 10 14:52:58 2022 -0500 @@ -0,0 +1,21 @@ +--- + +- name: add octoprint user + become: yes + user: name="octoprint" groups="{{octoprint_groups}}" home="/opt/octoprint" system="yes" + +- name: pip install octoprint + become: yes + pip: name="octoprint" executable="pip3" + notify: restart octoprint + +- name: install octoprint systemd service + become: yes + copy: + src: "octoprint.service" + dest: "/lib/systemd/system/octoprint.service" + notify: restart octoprint + +- name: ensure octoprint service is started + become: yes + systemd: name="octoprint.service" enabled="yes" diff -r febbf9c3394c -r fd46c0e68c2c octoprint/vars/main.yaml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/octoprint/vars/main.yaml Sat Sep 10 14:52:58 2022 -0500 @@ -0,0 +1,6 @@ +--- + +octoprint_groups: + - "tty" + - "dialout" + - "video"