Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apt_key deprecated #69

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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