diff options
| author | Luke Hoersten <[email protected]> | 2022-09-10 14:52:58 -0500 |
|---|---|---|
| committer | Luke Hoersten <[email protected]> | 2022-09-10 14:52:58 -0500 |
| commit | c8ed357319d0f597aca9fa50c5176d0e19205e7d (patch) | |
| tree | f06760d7ee064de418b6a38024377f4070528a37 /octoprint | |
| parent | 7896e9ba37e627d274119fd85367290db1b8a0cd (diff) | |
Initial octoprint role.
Diffstat (limited to 'octoprint')
| -rw-r--r-- | octoprint/files/octoprint.service | 14 | ||||
| -rw-r--r-- | octoprint/handlers/main.yaml | 5 | ||||
| -rw-r--r-- | octoprint/tasks/main.yaml | 21 | ||||
| -rw-r--r-- | octoprint/vars/main.yaml | 6 |
4 files changed, 46 insertions, 0 deletions
diff --git a/octoprint/files/octoprint.service b/octoprint/files/octoprint.service new file mode 100644 index 0000000..0aab27f --- /dev/null +++ b/octoprint/files/octoprint.service @@ -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 --git a/octoprint/handlers/main.yaml b/octoprint/handlers/main.yaml new file mode 100644 index 0000000..0c2665e --- /dev/null +++ b/octoprint/handlers/main.yaml @@ -0,0 +1,5 @@ +--- + +- name: restart octoprint + become: yes + systemd: name="octoprint.service" state="restarted" daemon_reload="yes" diff --git a/octoprint/tasks/main.yaml b/octoprint/tasks/main.yaml new file mode 100644 index 0000000..debed3c --- /dev/null +++ b/octoprint/tasks/main.yaml @@ -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 --git a/octoprint/vars/main.yaml b/octoprint/vars/main.yaml new file mode 100644 index 0000000..7fd4267 --- /dev/null +++ b/octoprint/vars/main.yaml @@ -0,0 +1,6 @@ +--- + +octoprint_groups: + - "tty" + - "dialout" + - "video" |
