From 7bf2d2c10bc7793dcced8b9f77b6375148116e9d Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Mon, 25 Nov 2024 17:26:13 +0100 Subject: [PATCH 1/4] WIP --- .github/workflows/ci.yml | 1 + README.md | 4 ++++ tasks/repository.yml | 28 +++++++++++++++++++--------- vars/main.yml | 11 ++++++++++- 4 files changed, 34 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 70e6297..d204d7b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,6 +45,7 @@ jobs: matrix: include: - distro: debian10 + ansible-version: '>=9, <10' - distro: debian11 - distro: debian12 - distro: ubuntu1804 diff --git a/README.md b/README.md index 67d10c0..71d3223 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,10 @@ Set up [Insync](https://www.insynchq.com) in Debian-like systems. * `software-properties-common` (will be installed) * `dirmngr` (will be installed) +* `apt-transport-https` (will be installed) +* `wget` (will be installed) +* `coreutils` (will be installed) + * `apt-utils` (will be installed) * `procps` (will be installed) diff --git a/tasks/repository.yml b/tasks/repository.yml index 5f1567e..b77c4ef 100644 --- a/tasks/repository.yml +++ b/tasks/repository.yml @@ -1,26 +1,36 @@ # tasks file --- -- name: repository | dependencies +- name: repository | install dependencies (pre) ansible.builtin.apt: name: "{{ insync_dependencies_pre }}" state: "{{ apt_install_state | default('latest') }}" update_cache: true cache_valid_time: "{{ apt_update_cache_valid_time | default(3600) }}" tags: - - insync-repository-dependencies + - insync-repository-install-dependencies -- name: repository | add public key - ansible.builtin.apt_key: - id: A684470CACCAF35C - keyserver: "{{ apt_key_keyserver | default('keyserver.ubuntu.com') }}" - state: present +- name: repository | (keyrings) directory | create + ansible.builtin.file: + path: "{{ insync_keyring_dst | dirname }}" + state: directory + owner: root + group: root + mode: 0755 tags: - - insync-repository-public-key + - insync-repository-keyrings-directory-create + +- name: repository | (keyring) file | download # noqa command-instead-of-module risky-shell-pipe + ansible.builtin.shell: > + wget -O- {{ insync_keyring_src }} | gpg --dearmor | tee {{ insync_keyring_dst }} > /dev/null + args: + creates: "{{ insync_keyring_dst }}" + tags: + - insync-repository-keyring-file-download - name: repository | add ansible.builtin.apt_repository: repo: "{{ item.type }} {{ item.url }} {{ item.component }}" - state: present + state: "{{ item.state | default('present') }}" update_cache: true mode: 0644 with_items: "{{ insync_repositories }}" diff --git a/vars/main.yml b/vars/main.yml index 6c85932..d005411 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,14 +1,23 @@ # vars file --- +insync_keyring_src: https://packagecloud.io/github/git-lfs/gpgkey +insync_keyring_dst: /usr/share/keyrings/insync.gpg insync_repositories: + - type: "deb [signed-by={{ insync_keyring_dst }}]" + url: "http://apt.insync.io/{{ ansible_distribution | lower }} {{ ansible_distribution_release }}" + component: 'non-free contrib' + # TODO: Remove in next major release - type: deb url: "http://apt.insync.io/{{ ansible_distribution | lower }} {{ ansible_distribution_release }}" component: 'non-free contrib' + state: absent insync_dependencies_pre: - software-properties-common - dirmngr - - gpg-agent + - apt-transport-https + - wget + - coreutils - apt-utils - procps From e6bb2cce0475329c1d92b2291d50e4a754d49dd6 Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Tue, 26 Nov 2024 13:04:43 +0100 Subject: [PATCH 2/4] Make use of keyring option --- tasks/repository.yml | 11 ++++++----- vars/main.yml | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/tasks/repository.yml b/tasks/repository.yml index b77c4ef..82176f5 100644 --- a/tasks/repository.yml +++ b/tasks/repository.yml @@ -19,11 +19,12 @@ tags: - insync-repository-keyrings-directory-create -- name: repository | (keyring) file | download # noqa command-instead-of-module risky-shell-pipe - ansible.builtin.shell: > - wget -O- {{ insync_keyring_src }} | gpg --dearmor | tee {{ insync_keyring_dst }} > /dev/null - args: - creates: "{{ insync_keyring_dst }}" +- name: repository | (keyring) file | download + ansible.builtin.apt_key: + id: "{{ insync_keyring_id }}" + keyserver: "{{ apt_key_keyserver | default('keyserver.ubuntu.com') }}" + keyring: "{{ insync_keyring_dst}}" + state: present tags: - insync-repository-keyring-file-download diff --git a/vars/main.yml b/vars/main.yml index d005411..f9f374e 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,6 +1,6 @@ # vars file --- -insync_keyring_src: https://packagecloud.io/github/git-lfs/gpgkey +insync_keyring_id: A684470CACCAF35C insync_keyring_dst: /usr/share/keyrings/insync.gpg insync_repositories: - type: "deb [signed-by={{ insync_keyring_dst }}]" From 127049375a00695b7814d05a083152e9b1f395d5 Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Tue, 26 Nov 2024 13:08:21 +0100 Subject: [PATCH 3/4] Cs fix --- tasks/repository.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/repository.yml b/tasks/repository.yml index 82176f5..fbe7c8c 100644 --- a/tasks/repository.yml +++ b/tasks/repository.yml @@ -23,7 +23,7 @@ ansible.builtin.apt_key: id: "{{ insync_keyring_id }}" keyserver: "{{ apt_key_keyserver | default('keyserver.ubuntu.com') }}" - keyring: "{{ insync_keyring_dst}}" + keyring: "{{ insync_keyring_dst }}" state: present tags: - insync-repository-keyring-file-download From a023f5092a45efdf724bb48fa2337e303a578231 Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Tue, 26 Nov 2024 13:12:52 +0100 Subject: [PATCH 4/4] Cleanup --- README.md | 2 -- vars/main.yml | 2 -- 2 files changed, 4 deletions(-) diff --git a/README.md b/README.md index 71d3223..9607256 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,6 @@ Set up [Insync](https://www.insynchq.com) in Debian-like systems. * `software-properties-common` (will be installed) * `dirmngr` (will be installed) * `apt-transport-https` (will be installed) -* `wget` (will be installed) -* `coreutils` (will be installed) * `apt-utils` (will be installed) * `procps` (will be installed) diff --git a/vars/main.yml b/vars/main.yml index f9f374e..18a0e0d 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -16,8 +16,6 @@ insync_dependencies_pre: - software-properties-common - dirmngr - apt-transport-https - - wget - - coreutils - apt-utils - procps