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

blacklist only the current beat #12

Open
github-actions bot opened this issue Apr 8, 2021 · 0 comments
Open

blacklist only the current beat #12

github-actions bot opened this issue Apr 8, 2021 · 0 comments

Comments

@github-actions
Copy link

github-actions bot commented Apr 8, 2021

blacklist only the current beat
beat executable even to create the keystore will fail.

# TODO blacklist only the current beat

---

- name: "{{ beats_flavor }}: Install dependencies"
  apt:
    name: "{{ _beats_packages['all']
              | union(_beats_packages[beats_flavor]
                      | default([])
                     )
           }}"

- name: "{{ beats_flavor }}: Install https apt transport"
  apt:
    name: apt-transport-https

- name: "{{ beats_flavor }}: Install using elastic repository"
  block:
    - name: "{{ beats_flavor }}: Add upstream repo key"
      apt_key:
        url: https://artifacts.elastic.co/GPG-KEY-elasticsearch
        id: 46095ACC8548582C1A2699A9D27D666CD88E42B4
        # validate_certs: false

    - name: "{{ beats_flavor }}: Add upstream beats repository"
      apt_repository:
        repo: "deb https://artifacts.elastic.co/packages/{{
                beats_major_version }}.x/apt stable main"

    - name: "{{ beats_flavor }}: Install {{ beats_flavor }}"
      apt:
        name: "{{ beats_flavor
                  if beats_flavor != 'heartbeat'
                  else 'heartbeat-elastic'
                }}={{ beats_major_version }}.{{
                      beats_minor_version | string }}{{
                      '' if beats_minor_version == '*' else '.' + beats_patch_version | string
                }}"
        update_cache: true
      notify: beats-restart-service

    # TODO blacklist only the current beat
    - name: "{{ beats_flavor }}: Disable automatic updates"
      copy:
        content: |
          Unattended-Upgrade::Package-Blacklist {
            "auditbeat";
            "heartbeat";
            "filebeat";
            "journalbeat";
            "metricbeat";
            "packetbeat";
          };
        dest: /etc/apt/apt.conf.d/55beats-disable
        mode: 0o644
      when: beats_disable_auto_update | bool
  when:
    - beats_flavor != 'winlogbeat'
    - beats_full_version is version(beats_user_version, '<')

# These two are needed because if the config file does not exist, running the
# beat executable even to create the keystore will fail.
- name: "{{ beats_flavor }}: Create config dir"
  file:
    path: "{{ beats_path_config }}"
    mode: 0o755
    state: directory

- name: "{{ beats_flavor }}: Check if config file exists"
  stat:
    path: "{{ beats_path_config }}/{{ beats_flavor }}.yml"
  register: _beats_config_file_exists

- name: "{{ beats_flavor }}: Touch config file"
  file:
    path: "{{ beats_path_config }}/{{ beats_flavor }}.yml"
    mode: 0o644
    state: touch
  when: not _beats_config_file_exists.stat.exists | bool
        or _beats_config_file_exists.stat.mode != "0644"

- name: Load winlogbeat install tasks for Linux
  include_tasks: "Debian-winlogbeat.yml"
  when:
    - beats_full_version is version(beats_user_version, '<')

d6db78c5d0a746c668a1277010f2ae2d30dff564

@github-actions github-actions bot added the todo label Apr 8, 2021
@nkakouros nkakouros added the tests label Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant