ansible-roles/filebeat/tasks/apt_sources.yml

45 lines
1.3 KiB
YAML
Raw Normal View History

2023-03-19 11:44:53 +01:00
---
- name: APT https transport is enabled (Debian <10)
ansible.builtin.apt:
name: apt-transport-https
state: present
when: ansible_distribution_major_version is version('10', '<')
- name: "Ensure {{ apt_keyring_dir }} directory exists"
file:
path: "{{ apt_keyring_dir }}"
state: directory
mode: "755"
owner: root
group: root
2023-03-19 11:44:53 +01:00
- name: Elastic GPG key is installed
ansible.builtin.copy:
src: elastic.asc
dest: "{{ apt_keyring_dir }}/elastic.asc"
2023-06-28 13:22:59 +02:00
force: true
2023-03-19 11:44:53 +01:00
mode: "0644"
owner: root
group: root
- name: Add Elastic repository (Debian <12)
ansible.builtin.apt_repository:
repo: "deb [signed-by={{ apt_keyring_dir }}/elastic.asc] https://artifacts.elastic.co/packages/{{ elastic_stack_version | mandatory }}/apt stable main"
filename: elastic
state: present
update_cache: yes
when: ansible_distribution_major_version is version('12', '<')
- name: Add Elastic repository (Debian >=12)
ansible.builtin.template:
src: elastic.sources.j2
dest: /etc/apt/sources.list.d/elastic.sources
state: present
register: elastic_sources
when: ansible_distribution_major_version is version('12', '>=')
- name: Update APT cache
ansible.builtin.apt:
2023-03-19 11:44:53 +01:00
update_cache: yes
when: elastic_sources is changed