diff --git a/molecule/default/create.yml b/molecule/default/create.yml index 3e356ea..eca41c5 100644 --- a/molecule/default/create.yml +++ b/molecule/default/create.yml @@ -3,7 +3,7 @@ hosts: localhost connection: local gather_facts: False -# no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" vars: molecule_file: "{{ lookup('env', 'MOLECULE_FILE') }}" molecule_ephemeral_directory: "{{ lookup('env', 'MOLECULE_EPHEMERAL_DIRECTORY') }}" diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index f09ba13..1ae3e20 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -13,8 +13,13 @@ platforms: image: milcom/centos7-systemd privileged: True - name: telegraf-debian - image: maint/debian-systemd + image: minimum2scp/systemd-stretch privileged: True + command: /sbin/init + - name: telegraf-ubuntu + image: solita/ubuntu-systemd:bionic + privileged: True + command: /sbin/init provisioner: name: ansible diff --git a/molecule/default/playbook.yml b/molecule/default/playbook.yml index fad773b..dd38a77 100644 --- a/molecule/default/playbook.yml +++ b/molecule/default/playbook.yml @@ -4,12 +4,19 @@ - name: "Installing which on CentOS" yum: name: which - state: installed - when: ansible_distribution == 'CentOS' + state: present + when: + - ansible_os_family == 'RedHat' + - name: "Installing wget on Debian" apt: - name: wget - state: installed - when: ansible_distribution == 'Debian' + name: "{{ item }}" + state: present + when: + - ansible_os_family == 'Debian' + with_items: + - wget + - gpg + roles: - role: ansible-telegraf diff --git a/tasks/Debian.yml b/tasks/Debian.yml index c74bb3c..d07077d 100644 --- a/tasks/Debian.yml +++ b/tasks/Debian.yml @@ -37,6 +37,6 @@ - name: "Install telegraf package | Debian" apt: name: "telegraf" - state: installed + state: present notify: "Restart Telegraf" become: yes diff --git a/tasks/configure.yml b/tasks/configure.yml index 8a77035..103565d 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -21,7 +21,7 @@ group: telegraf mode: 0640 become: yes - when: telegraf_agent_version|version_compare('0.10.0', '<') + when: telegraf_agent_version is version_compare('0.10.0', '<') notify: "Restart Telegraf" - name: "Copy the template for versions >= 0.10.0" @@ -32,7 +32,7 @@ group: telegraf mode: 0640 become: yes - when: telegraf_agent_version|version_compare('0.10.0', '>=') + when: telegraf_agent_version is version_compare('0.10.0', '>=') notify: "Restart Telegraf" - name: "Copy telegraf extra plugins" diff --git a/templates/telegraf.conf.j2 b/templates/telegraf.conf.j2 index 170848c..98dd721 100644 --- a/templates/telegraf.conf.j2 +++ b/templates/telegraf.conf.j2 @@ -21,13 +21,13 @@ round_interval = {{ telegraf_agent_round_interval | lower }} flush_interval = "{{ telegraf_agent_flush_interval }}s" flush_jitter = "{{ telegraf_agent_flush_jitter }}s" -{% if telegraf_agent_version|version_compare('0.13', '>=') %} +{% if telegraf_agent_version is version_compare('0.13', '>=') %} collection_jitter = "{{ telegraf_agent_collection_jitter }}s" metric_batch_size = {{ telegraf_agent_metric_batch_size }} metric_buffer_limit = {{ telegraf_agent_metric_buffer_limit }} quiet = {{ telegraf_agent_quiet | lower }} {% endif %} -{% if telegraf_agent_version|version_compare('1.1', '>=') %} +{% if telegraf_agent_version is version_compare('1.1', '>=') %} logfile = "{{ telegraf_agent_logfile }}" omit_hostname = {{ telegraf_agent_omit_hostname | lower }} {% endif %}