diff --git a/tasks/install.yml b/tasks/install.yml index fb32fcc..14ad7e1 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -10,7 +10,6 @@ - ansible_distribution_major_version is version('20', '>=') tags: - insync-install-dependencies - - name: install | dependencies ansible.builtin.apt: name: "{{ insync_dependencies }}" diff --git a/tasks/main.yml b/tasks/main.yml index e1b6adf..7b219e2 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,5 +1,19 @@ # tasks file --- +- name: "Loading Debian variables" + ansible.builtin.include_vars: + file: 'Debian.yml' + when: ansible_distribution == "Debian" +- name: "Loading Ubuntu variables" + ansible.builtin.include_vars: + file: 'Ubuntu.yml' + when: ansible_distribution == "Ubuntu" +- name: "Loading Linux Mint variables" + ansible.builtin.include_vars: + file: "LinuxMint.yml" + when: ansible_distribution == "Linux Mint" + + - name: repository ansible.builtin.import_tasks: repository.yml tags: diff --git a/tasks/repository.yml b/tasks/repository.yml index 5f1567e..16625b0 100644 --- a/tasks/repository.yml +++ b/tasks/repository.yml @@ -1,5 +1,10 @@ # tasks file --- +- name: "Creating keyring directory" + ansible.builtin.file: + path: "{{ apt_key_dir }}" + state: "directory" + mode: '755' - name: repository | dependencies ansible.builtin.apt: name: "{{ insync_dependencies_pre }}" @@ -13,13 +18,14 @@ ansible.builtin.apt_key: id: A684470CACCAF35C keyserver: "{{ apt_key_keyserver | default('keyserver.ubuntu.com') }}" + keyring: "{{ apt_key_dir}}/insync.gpg" state: present tags: - insync-repository-public-key - name: repository | add ansible.builtin.apt_repository: - repo: "{{ item.type }} {{ item.url }} {{ item.component }}" + repo: "{{ item.type }} [signed-by={{ apt_key_dir }}/insync.gpg] {{ item.url }} {{ item.component }}" state: present update_cache: true mode: 0644 diff --git a/vars/Debian.yml b/vars/Debian.yml new file mode 100644 index 0000000..1c1be16 --- /dev/null +++ b/vars/Debian.yml @@ -0,0 +1,5 @@ +--- +insync_repositories: + - type: deb + url: "http://apt.insync.io/debian {{ ansible_distribution_release }}" + component: 'non-free contrib' diff --git a/vars/LinuxMint.yml b/vars/LinuxMint.yml new file mode 100644 index 0000000..088d560 --- /dev/null +++ b/vars/LinuxMint.yml @@ -0,0 +1,5 @@ +--- +insync_repositories: + - type: deb + url: "http://apt.insync.io/mint {{ ansible_distribution_release }}" + component: 'non-free contrib' diff --git a/vars/Ubuntu.yml b/vars/Ubuntu.yml new file mode 100644 index 0000000..4ca145d --- /dev/null +++ b/vars/Ubuntu.yml @@ -0,0 +1,5 @@ +--- +insync_repositories: + - type: deb + url: "http://apt.insync.io/ubuntu {{ ansible_distribution_release }}" + component: 'non-free contrib' diff --git a/vars/main.yml b/vars/main.yml index 21c8c91..78ec291 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,10 +1,5 @@ # vars file --- -insync_repositories: - - type: deb - url: "http://apt.insync.io/{{ ansible_distribution | lower }} {{ ansible_distribution_release }}" - component: 'non-free contrib' - insync_dependencies_pre: - software-properties-common - dirmngr @@ -13,3 +8,4 @@ insync_dependencies_pre: insync_dependencies: - insync +apt_key_dir: '/etc/apt/keyrings'