diff --git a/.later.yml b/.later.yml index 07e8dc4..7c7d191 100644 --- a/.later.yml +++ b/.later.yml @@ -4,4 +4,7 @@ rules: - molecule/ubuntu/tests - README.md + warning_filter: + - ANSIBLE0008 + ... diff --git a/defaults/main.yml b/defaults/main.yml index 2716fbc..b1acb40 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -50,4 +50,7 @@ journalbeat_logging_to_files: True # @var journalbeat_logging_selectors:description: Define logging selectors, like beat, publish, service journalbeat_logging_selectors: [] +# @var journalbeat_keyring:description: Path for the repository keyring +journalbeat_keyring: /usr/share/keyrings/elastic-archive-keyring.gpg + ... diff --git a/molecule/default/prepare.yml b/molecule/default/prepare.yml index 17c083a..b62373a 100644 --- a/molecule/default/prepare.yml +++ b/molecule/default/prepare.yml @@ -18,4 +18,9 @@ name: python3-gpg state: present + - name: Install curl dependency + apt: + name: curl + state: present + ... diff --git a/tasks/main.yml b/tasks/main.yml index eacc2c5..07f4790 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,17 +1,32 @@ # Standards: 1.2 --- -- name: Download repo key +- name: Remove legacy key apt_key: - url: https://artifacts.elastic.co/GPG-KEY-elasticsearch id: 46095ACC8548582C1A2699A9D27D666CD88E42B4 - state: present + state: absent tags: - journalbeat -- name: Add apt repository +- name: Remove legacy repo apt_repository: repo: "deb https://artifacts.elastic.co/packages/{{ journalbeat_major_version }}.x/apt stable main" filename: elastic + update_cache: False + state: absent + tags: + - journalbeat + +- name: Download repo key + shell: + cmd: "curl -sSL 'https://artifacts.elastic.co/GPG-KEY-elasticsearch' | gpg --dearmor --output {{ journalbeat_keyring }}" + creates: "{{ journalbeat_keyring }}" + tags: + - journalbeat + +- name: Add apt repository + apt_repository: + repo: "deb [signed-by={{ journalbeat_keyring }}] https://artifacts.elastic.co/packages/{{ journalbeat_major_version }}.x/apt stable main" + filename: elastic update_cache: True state: present tags: