Skip to content

Commit

Permalink
Merge pull request #1 from pvdh/master
Browse files Browse the repository at this point in the history
apt_key deprecated
  • Loading branch information
nilshee authored Dec 31, 2024
2 parents 7757154 + 15c23a9 commit 19439df
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
4 changes: 4 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ filebeat_elastic_cloud_enabled: false
filebeat_elastic_cloud_id: ""
filebeat_elastic_cloud_username: ""
filebeat_elastic_cloud_password: ""

filebeat_elastic_apt_gpg_key: https://artifacts.elastic.co/GPG-KEY-elasticsearch
filebeat_add_repo: true
filebeat_apt_ignore_key_error: true
25 changes: 20 additions & 5 deletions tasks/setup-Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,28 @@
state: present

- name: Add Elasticsearch apt key.
apt_key:
url: https://artifacts.elastic.co/GPG-KEY-elasticsearch
id: 46095ACC8548582C1A2699A9D27D666CD88E42B4
state: present
ansible.builtin.get_url:
url: "{{ filebeat_elastic_apt_gpg_key }}"
dest: /etc/apt/trusted.gpg.d/filebeat.asc
mode: '0644'
force: true
register: add_repository_key
ignore_errors: "{{ filebeat_apt_ignore_key_error }}"
when: filebeat_add_repo | bool

- name: Ensure curl is present (on older systems without SNI).
package: name=curl state=present
when: add_repository_key is failed and filebeat_add_repo | bool

- name: Add Elasticsearch apt key (alternative for older systems without SNI).
shell: >
curl -sSL {{ filebeat_elastic_apt_gpg_key }} | apt-key add -
when: add_repository_key is failed and filebeat_add_repo | bool


- name: Add Filebeat repository.
apt_repository:
repo: 'deb https://artifacts.elastic.co/packages/{{ filebeat_version }}/apt stable main'
repo: 'deb [signed-by=/etc/apt/trusted.gpg.d/filebeat.asc] https://artifacts.elastic.co/packages/{{ filebeat_version }}/apt stable main'
state: present
update_cache: true

0 comments on commit 19439df

Please sign in to comment.