- name: ensure fluent-bit is installed package: name: fluent-bit state: present tags: - install - name: ensure fluent-bit is configured copy: dest: /etc/fluent-bit/fluent-bit.yml content: '{{ fluent_bit_config | to_nice_yaml(indent=2) }}' owner: root group: root mode: u=rw,go= notify: - restart fluent-bit tags: - config # The default unit configuration for fluent-bit.service sucks. It runs # as root without any kind of restrictions or sandboxing, forces the # "classic" configuration format (which is deprecated in favor of # YAML), and does not support hot reload. It's very simple, so we can # replace it completely without too much worry about upstream changes. - name: ensure custom fluent-bit systemd service unit file is installed copy: src: fluent-bit.service dest: /etc/systemd/system/fluent-bit.service owner: root group: root mode: u=rw,go=r notify: - reload systemd - restart fluent-bit tags: - systemd - name: ensure fluent-bit starts at boot service: name: fluent-bit enabled: true tags: - service - name: flush handlers meta: flush_handlers - name: ensure fluent-bit is running service: name: fluent-bit state: started tags: - service