diff --git a/crowdsec/tasks/main.yml b/crowdsec/tasks/main.yml index 9137863..69db02a 100644 --- a/crowdsec/tasks/main.yml +++ b/crowdsec/tasks/main.yml @@ -19,6 +19,14 @@ dest: /etc/apt/keyrings/crowdsec.asc mode: "0644" +# A deb822 crowdsec.sources (written by the package or by hand) already +# defines the repository; a second crowdsec.list makes apt warn about +# duplicate targets. +- name: Check for an existing deb822 CrowdSec apt source + ansible.builtin.stat: + path: /etc/apt/sources.list.d/crowdsec.sources + register: crowdsec_sources + - name: Add the CrowdSec apt repository ansible.builtin.copy: dest: /etc/apt/sources.list.d/crowdsec.list @@ -28,6 +36,7 @@ https://packagecloud.io/crowdsec/crowdsec/{{ ansible_distribution | lower }}/ {{ crowdsec.apt_suite_map[ansible_distribution_release] | default(ansible_distribution_release) }} main register: crowdsec_repo + when: not crowdsec_sources.stat.exists # The postinst asks these; without them it registers a local machine for a # local LAPI and enrols in the central CAPI.