Ansible : What is the result of kickstart.sh (platform independent)

Problem/Question

I want to write a simple ansible role to install netdata on my linux boxes with kickstart.sh

The Simplest way to call it in ansible is as a ansible.builtin.command like this

# in a ansible task file
- name: Install Netdata
  ansible.builtin.command: ~/kickstart.sh --dont-wait

Current ansible linters recommend - correctly - that commands should specify a certain file which is created by the command. This is required so that ansible can decide that the step is already run.

In my environment (debian 11) this file sems to be /usr/sbin/netdata.

Just out of curiosity: Is there a platform independent way to check if netdata is installed (not necessarily running ?)

Relevant docs you followed/actions you took to solve the issue

This is rather olf-fashioned and gives a lot of problems when linting

Environment/Browser/Agent’s version etc

Debian 11, nightly

/usr/sbin/netdata is what I use as well.

I suppose if you use --native-only you could use the package module.

- name: "Check if netdata is installed"
      ansible.builtin.package:
        name: netdata
        state: present
      check_mode: true
      register: package_check

- name: "Install Netdata"
  ansible.builtin.command: ~/kickstart.sh --dont-wait
  when: package_check is false
1 Like