- name: validate requirements for fluentbit gather_facts: no hosts: "{{target}}" become: "{{become}}" tasks: #- name: assert non-isolated # assert: # that: isolated is not defined # # mandatory checks - will stop tasks if fails # - name: time-series server is reachable ansible.builtin.wait_for: host={{tsdb_host}} port={{tsdb_port}} timeout=1 - name: log server is reachable ansible.builtin.wait_for: host={{log_host}} port={{log_port}} timeout=1 - name: fluentbit is installed ansible.builtin.shell: executable: /bin/bash cmd: "[[ -x /opt/fluent-bit/bin/fluent-bit || -x /usr/local/bin/fluent-bit ]] && [[ -d /etc/fluent-bit/ ]]" changed_when: false check_mode: false # now grabbed at setup-time # those are grabbed at install-time, see tasks-flb-install.yml #- name: mmdb files are there # ansible.builtin.shell: # executable: /bin/bash # cmd: "ls -lhF /etc/fluent-bit/*.mmdb" # changed_when: false # check_mode: false - name: define distro ansible.builtin.shell: executable: /bin/bash cmd: "lsb_release -is 2>/dev/null | tr A-Z a-z || echo unknown" register: distro changed_when: false check_mode: false - debug: var=distro.stdout - name: define auth_log_file for debian/ubuntu systems ansible.builtin.set_fact: auth_log_file: "/var/log/auth.log" when: distro.stdout == 'debian' or distro.stdout == 'ubuntu' - name: define auth_log_file for non-debian systems ansible.builtin.set_fact: auth_log_file: "/var/log/secure" when: distro.stdout != 'debian' and distro.stdout != 'ubuntu' - name: auth log is there ansible.builtin.shell: executable: /bin/bash cmd: "[[ -f {{auth_log_file}} ]]" changed_when: false check_mode: false # https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_tests.html#type-tests - name: assert variables ansible.builtin.assert: that: > ( addons is defined ) and ( addons is not string ) and ( addons is not mapping ) and ( addons is iterable ) and ( addons is sequence )