NETWAYS / ansible-collection-elasticstack

A collection to install and manage the Elastic Stack
GNU General Public License v3.0
9 stars 8 forks source link

Suspected bug: "Enable Ingest Pipelines" task not working due to impossible redirect #198

Closed Donien closed 11 months ago

Donien commented 1 year ago

Within roles/beats/tasks/filebeat.yml there is the following task:

    - name: Enable Ingest Pipelines
      command: >
        /usr/bin/filebeat setup --pipelines &&
        /usr/bin/filebeat version > /etc/filebeat/{{ item }}_pipeline_created
      args:
        creates: "/etc/filebeat/{{ item }}_pipeline_created"
      with_items: "{{ beats_filebeat_modules }}"
      notify:
        - Restart Filebeat
      changed_when: false

It uses the command module. Within its shell command a redirect is used (>). This leads to a problem: The redirect into the file does not work using the command module since no actual shell is used.
It does however work using the shell module. We can even keep the creates argument, making this a pretty simple fix.