ansible-gnome-extensions/tasks/main.yml

78 lines
2.6 KiB
YAML
Raw Permalink Normal View History

2018-04-13 14:17:01 +01:00
---
- name: Parse Gnome Shell version
shell: gnome-shell --version | sed 's/[^0-9.]*\([0-9.]*\).*/\1/'
register: parse_gnome_shell_version
changed_when: no
- set_fact:
gnome_shell_version: '{{ parse_gnome_shell_version.stdout }}'
- name: Get Gnome Shell extension info
uri:
url: https://extensions.gnome.org/extension-info/?pk={{ item }}&shell_version={{ gnome_shell_version }}
return_content: yes
2019-01-27 10:28:14 +00:00
loop: '{{ gnome_extension_ids }}'
2018-04-13 14:17:01 +01:00
register: gnome_shell_extension_info
- name: Create temporary download directory
tempfile:
state: directory
suffix: ".gnome_extension_download"
register: gnome_extension_download_dir
changed_when: no
- block:
- name: Check for Gnome Shell extensions already installed
stat:
path: ~/.local/share/gnome-shell/extensions/{{ item.json.uuid }}
register: st_existing_extensions
2019-01-27 10:28:14 +00:00
loop: "{{ gnome_shell_extension_info.results }}"
loop_control:
label: "{{ item.json.name }}"
2018-04-13 14:17:01 +01:00
- name: Download Gnome Shell extensions
get_url:
url: https://extensions.gnome.org{{ item.item.json.download_url }}
dest: "{{ gnome_extension_download_dir.path }}/{{ item.item.json.uuid }}.zip"
2019-01-27 10:28:14 +00:00
loop: "{{ st_existing_extensions.results }}"
loop_control:
label: "{{ item.item.json.name }}"
2018-04-13 14:17:01 +01:00
when: item.stat.exists == False
register: download_gnome_shell_extensions
- name: Create install directories
file:
path: ~/.local/share/gnome-shell/extensions/{{ item.item.item.json.uuid }}
state: directory
owner: "{{ ansible_user_uid }}"
group: "{{ ansible_user_gid }}"
mode: 0775
2019-01-27 10:28:14 +00:00
loop: "{{ download_gnome_shell_extensions.results }}"
loop_control:
label: "{{ item.item.item.json.name }}"
2018-04-13 14:17:01 +01:00
when: not item|skipped
- name: Install Gnome Shell extensions
unarchive:
src: "{{ item.dest }}"
dest: ~/.local/share/gnome-shell/extensions/{{ item.item.item.json.uuid }}
2019-01-27 10:28:14 +00:00
loop: "{{ download_gnome_shell_extensions.results }}"
loop_control:
label: "{{ item.item.item.json.name }}"
2018-04-13 14:17:01 +01:00
when: not item|skipped
- name: Enable Gnome Shell extensions
command: gnome-shell-extension-tool --enable-extension {{ item.item.item.json.uuid }}
register: enable_gnome_shell_extensions
2019-01-27 10:28:14 +00:00
loop: "{{ download_gnome_shell_extensions.results }}"
loop_control:
label: "{{ item.item.item.json.name }}"
2018-04-13 14:17:01 +01:00
when: not item|skipped
always:
- name: Delete temporary download directory
file:
path: "{{ gnome_extension_download_dir.path }}"
state: absent
changed_when: no