--- - name: install octoprint hosts: prusa.lan become_method: sudo become_user: root become: yes tasks: - name: install needed tools apt: update_cache: yes pkg: - python-pip - python-dev - python-setuptools - python-virtualenv - git - libyaml-dev - build-essential - name: create octoprint account user: name: octoprint comment: Octoprint account groups: tty,dialout system: yes password_lock: yes home: /home/octoprint - name: install octoprint software become_user: octoprint shell: chdir: /home/octoprint cmd: | virtualenv –system-site-packages . source bin/activate pip install pip --upgrade pip install octoprint args: executable: /bin/bash - name: copy systemd service config copy: src: octoprint.service dest: /lib/systemd/system/octoprint.service - name: enable systemd service systemd: name: octoprint enabled: yes state: started - name: enable octoprint to restart itself copy: src: sudoers.conf dest: /etc/sudoers.d/octoprint mode: 0440