101 lines
2.7 KiB
YAML
101 lines
2.7 KiB
YAML
---
|
|
|
|
- name: Debian - Ensure apt-transport-https is installed
|
|
become: yes
|
|
apt:
|
|
name: apt-transport-https
|
|
state: present
|
|
cache_valid_time: 86400
|
|
when: use_repository | bool
|
|
register: beat_install
|
|
until: beat_install is succeeded
|
|
notify: restart the service
|
|
|
|
- name: Debian - Ensure python-urllib3, python-openssl, python-pyasn1 & python-pip are installed
|
|
become: yes
|
|
apt:
|
|
name:
|
|
- python-urllib3
|
|
- python-openssl
|
|
- python-pyasn1
|
|
- python-pip
|
|
state: present
|
|
register: libs_install
|
|
until: libs_install is succeeded
|
|
when:
|
|
- use_repository | bool
|
|
- ansible_distribution_release == "trusty"
|
|
|
|
- name: Debian - ensure ndg-httpsclient pip is installed
|
|
become: yes
|
|
pip:
|
|
name: ndg-httpsclient
|
|
state: present
|
|
register: ndg_install
|
|
until: ndg_install is succeeded
|
|
when:
|
|
- use_repository | bool
|
|
- ansible_distribution_release == "trusty"
|
|
|
|
- name: Debian - Add Beats repository key
|
|
become: yes
|
|
apt_key:
|
|
url: '{{ elastic_repo_key }}'
|
|
state: present
|
|
register: apt_key_install
|
|
until: apt_key_install is succeeded
|
|
when: beats_add_repository | bool
|
|
|
|
- name: Debian - add beats repository
|
|
become: yes
|
|
apt_repository:
|
|
repo: 'deb {{ repo_url }} stable main'
|
|
state: present
|
|
register: repo_install
|
|
until: repo_install is succeeded
|
|
when: beats_add_repository | bool
|
|
|
|
- name: Debian - unhold {{ beat }} version for install
|
|
become: yes
|
|
command: apt-mark unhold {{ beat }}
|
|
changed_when: false
|
|
|
|
- name: Debian - Ensure {{ beat }} is installed
|
|
become: yes
|
|
apt:
|
|
name: >-
|
|
{{ beat }}{% if beats_version is defined and beats_version|length>0 %}={{ beats_version }}{% endif %}
|
|
state: present
|
|
cache_valid_time: 86400
|
|
register: beat_install
|
|
until: beat_install is succeeded
|
|
when: use_repository | bool
|
|
notify: restart the service
|
|
|
|
- name: Debian - hold {{ beat }} version
|
|
become: yes
|
|
command: apt-mark hold {{ beat }}
|
|
when: version_lock
|
|
changed_when: false
|
|
|
|
- name: Set os_arch
|
|
set_fact:
|
|
os_arch: >-
|
|
{{ ansible_architecture == 'x86_64' | ternary('amd64', 'i386') }}
|
|
|
|
- name: Debian - Download {{ beat }} from url
|
|
get_url:
|
|
url: >-
|
|
{% if custom_package_url is defined %}{{ custom_package_url }}{%
|
|
else %}{{ beats_package_url }}/{{ beat }}/{{ beat }}_{{ beats_version }}_{{ os_arch }}.deb{% endif %}
|
|
dest: '/tmp/{{ beat }}_{{ beats_version }}_{{ os_arch }}.deb'
|
|
validate_certs: false
|
|
when: not use_repository | bool
|
|
|
|
- name: Debian - Ensure {{ beat }} is installed from downloaded package
|
|
become: yes
|
|
apt:
|
|
deb: '/tmp/{{ beat }}_{{ beats_version }}_{{ os_arch }}.deb'
|
|
when: not use_repository | bool
|
|
notify: restart the service
|