91 lines
1.9 KiB
YAML
91 lines
1.9 KiB
YAML
---
|
|
|
|
- name: Create group
|
|
group:
|
|
name: "{{ klipper_group }}"
|
|
|
|
- name: Create user
|
|
user:
|
|
name: "{{ klipper_user }}"
|
|
home: "/home/{{ klipper_user }}"
|
|
group: "{{ klipper_group }}"
|
|
append: yes
|
|
groups:
|
|
- tty
|
|
- dialout
|
|
- video
|
|
|
|
- name: Add klipper user to additional groups
|
|
user:
|
|
name: "{{ klipper_user }}"
|
|
append: yes
|
|
groups: "{{ klipper_groups }}"
|
|
when: klipper_groups is defined
|
|
|
|
- name: Create config directory
|
|
file:
|
|
path: "{{ klipper_conf_dir }}"
|
|
owner: "{{ klipper_user }}"
|
|
group: "{{ klipper_group }}"
|
|
recurse: true
|
|
state: directory
|
|
|
|
- name: Install requirements
|
|
apt:
|
|
name:
|
|
- python3-pip
|
|
- python3-virtualenv
|
|
- virtualenv
|
|
- python-dev
|
|
- libffi-dev
|
|
- build-essential
|
|
- libncurses-dev
|
|
- libusb-dev
|
|
- avrdude
|
|
- gcc-avr
|
|
- binutils-avr
|
|
- avr-libc
|
|
- stm32flash
|
|
- dfu-util
|
|
- libnewlib-arm-none-eabi
|
|
- gcc-arm-none-eabi
|
|
- binutils-arm-none-eabi
|
|
- libusb-1.0-0
|
|
- git
|
|
|
|
- name: Clone klipper
|
|
git:
|
|
repo: https://github.com/Klipper3d/klipper.git
|
|
dest: "{{ klipper_dir }}"
|
|
|
|
- name: Set user and group for klipper src
|
|
file:
|
|
path: "{{ klipper_dir }}"
|
|
owner: "{{ klipper_user }}"
|
|
group: "{{ klipper_group }}"
|
|
recurse: true
|
|
state: directory
|
|
|
|
- name: Create virtual env and install python dependencies
|
|
pip:
|
|
requirements: /opt/klipper/scripts/klippy-requirements.txt
|
|
virtualenv: /opt/klipper/venv
|
|
virtualenv_python: python2.7
|
|
|
|
- name: Install klipper config
|
|
git:
|
|
repo: https://git.binary-kitchen.de/3D-Printers/Voron2_Config.git
|
|
dest: "{{ klipper_conf_dir }}"
|
|
umask: "002"
|
|
become: yes
|
|
become_user: "{{ klipper_user }}"
|
|
|
|
- name: Install service file
|
|
template:
|
|
src: klipper.service.j2
|
|
dest: /usr/lib/systemd/system/klipper.service
|
|
|
|
- name: Enable klipper
|
|
service: name=klipper enabled=yes
|
|
|