From c990af46a97d08bbb25c1d99c572eb0e08ef9b87 Mon Sep 17 00:00:00 2001 From: Przemek Grondek Date: Thu, 14 Jul 2022 21:20:37 +0200 Subject: [PATCH] Add checkout config repository to prusa-slicer --- roles/prusa-slicer/tasks/checkout-git.yml | 6 +++ roles/prusa-slicer/tasks/install-program.yml | 38 +++++++++++++++++++ roles/prusa-slicer/tasks/main.yml | 39 +------------------- roles/prusa-slicer/vars/main.yml | 2 + 4 files changed, 48 insertions(+), 37 deletions(-) create mode 100644 roles/prusa-slicer/tasks/checkout-git.yml create mode 100644 roles/prusa-slicer/tasks/install-program.yml create mode 100644 roles/prusa-slicer/vars/main.yml diff --git a/roles/prusa-slicer/tasks/checkout-git.yml b/roles/prusa-slicer/tasks/checkout-git.yml new file mode 100644 index 0000000..e23e5aa --- /dev/null +++ b/roles/prusa-slicer/tasks/checkout-git.yml @@ -0,0 +1,6 @@ +- name: checkout dwmstatus + git: + repo: "{{ prusa_slicer.repo }}" + dest: "{{ ansible_user_dir }}/.config/PrusaSlicer" + clone: yes + update: yes diff --git a/roles/prusa-slicer/tasks/install-program.yml b/roles/prusa-slicer/tasks/install-program.yml new file mode 100644 index 0000000..37784af --- /dev/null +++ b/roles/prusa-slicer/tasks/install-program.yml @@ -0,0 +1,38 @@ +- name: install jmespath for json_query + become: yes + apt: + update_cache: yes + pkg: + - python3-jmespath + +- name: "Get PrusaSlicer version" + uri: + url: https://api.github.com/repos/prusa3d/PrusaSlicer/releases/latest + body_format: json + register: git_info + +- name: "Download URL" + debug: + msg: "{{ (git_info.json | json_query('assets[*].browser_download_url') | select('match', '.*x64-GTK3.*AppImage'))[0] }}" + when: ansible_architecture == "x86_64" + +- name: Install on amd64 + become: yes + when: ansible_architecture == "x86_64" + get_url: + url: "{{ (git_info.json | json_query('assets[*].browser_download_url') | select('match', '.*x64-GTK3.*AppImage'))[0] }}" + dest: /usr/local/bin/prusa-slicer + mode: 0755 + +- name: "Download URL" + debug: + msg: "{{ (git_info.json | json_query('assets[*].browser_download_url') | select('match', '.*armv7l-GTK2.*AppImage'))[0] }}" + when: ansible_architecture == "arm64" + +- name: Install on arm64 + when: ansible_architecture == "arm64" + become: yes + get_url: + url: "{{ (git_info.json | json_query('assets[*].browser_download_url') | select('match', '.*armv7l-GTK2.*AppImage'))[0] }}" + dest: /usr/local/bin/prusa-slicer + mode: 0755 diff --git a/roles/prusa-slicer/tasks/main.yml b/roles/prusa-slicer/tasks/main.yml index 37784af..f47ffca 100644 --- a/roles/prusa-slicer/tasks/main.yml +++ b/roles/prusa-slicer/tasks/main.yml @@ -1,38 +1,3 @@ -- name: install jmespath for json_query - become: yes - apt: - update_cache: yes - pkg: - - python3-jmespath +- include: install-program.yml -- name: "Get PrusaSlicer version" - uri: - url: https://api.github.com/repos/prusa3d/PrusaSlicer/releases/latest - body_format: json - register: git_info - -- name: "Download URL" - debug: - msg: "{{ (git_info.json | json_query('assets[*].browser_download_url') | select('match', '.*x64-GTK3.*AppImage'))[0] }}" - when: ansible_architecture == "x86_64" - -- name: Install on amd64 - become: yes - when: ansible_architecture == "x86_64" - get_url: - url: "{{ (git_info.json | json_query('assets[*].browser_download_url') | select('match', '.*x64-GTK3.*AppImage'))[0] }}" - dest: /usr/local/bin/prusa-slicer - mode: 0755 - -- name: "Download URL" - debug: - msg: "{{ (git_info.json | json_query('assets[*].browser_download_url') | select('match', '.*armv7l-GTK2.*AppImage'))[0] }}" - when: ansible_architecture == "arm64" - -- name: Install on arm64 - when: ansible_architecture == "arm64" - become: yes - get_url: - url: "{{ (git_info.json | json_query('assets[*].browser_download_url') | select('match', '.*armv7l-GTK2.*AppImage'))[0] }}" - dest: /usr/local/bin/prusa-slicer - mode: 0755 +- include: checkout-git.yml diff --git a/roles/prusa-slicer/vars/main.yml b/roles/prusa-slicer/vars/main.yml new file mode 100644 index 0000000..e6acb57 --- /dev/null +++ b/roles/prusa-slicer/vars/main.yml @@ -0,0 +1,2 @@ +prusa_slicer: + repo: git@github.com:pgrondek/prusa-slicer-profiles.git \ No newline at end of file