Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various small changes for molecule #97

Merged
merged 1 commit into from
Apr 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
telegraf_agent_version: 1.10.0
telegraf_agent_version_patch: 1
telegraf_agent_package: telegraf
telegraf_agent_package_file_deb: telegraf_{{ telegraf_agent_version }}-{{ telegraf_agent_version_patch }}_{{ telegraf_agent_package_arch }}.deb
telegraf_agent_package_file_rpm: telegraf-{{ telegraf_agent_version }}-{{ telegraf_agent_version_patch }}.{{ ansible_architecture }}.rpm
telegraf_agent_package_path: /tmp
telegraf_agent_package_method: repo
telegraf_agent_package_state: present
Expand Down
22 changes: 11 additions & 11 deletions molecule/default/tests/test_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('telegraf')


def test_telegraf_running_and_enabled(Service, SystemInfo):
telegraf = Service("telegraf")
if SystemInfo.distribution not in ['opensuse-leap']:
def test_telegraf_running_and_enabled(host):
telegraf = host.service("telegraf")
if host.system_info.distribution not in ['opensuse-leap']:
assert telegraf.is_enabled
assert telegraf.is_running


def test_telegraf_dot_conf(File):
telegraf = File("/etc/telegraf/telegraf.conf")
def test_telegraf_dot_conf(host):
telegraf = host.file("/etc/telegraf/telegraf.conf")
assert telegraf.user == "telegraf"
assert telegraf.group == "telegraf"
assert telegraf.mode == 0o640
Expand All @@ -26,23 +26,23 @@ def test_telegraf_dot_conf(File):
assert telegraf.contains('[[inputs.net]]')


def test_telegraf_dot_d_dir(File):
telegraf = File("/etc/telegraf/telegraf.d")
def test_telegraf_dot_d_dir(host):
telegraf = host.file("/etc/telegraf/telegraf.d")
assert telegraf.user == "root"
assert telegraf.group == "root"
assert telegraf.mode == 0o755
assert telegraf.is_directory


def test_telegraf_dot_d(File):
telegraf = File("/etc/telegraf/telegraf.d/percpu-usage.conf")
def test_telegraf_dot_d(host):
telegraf = host.file("/etc/telegraf/telegraf.d/percpu-usage.conf")
assert telegraf.user == "telegraf"
assert telegraf.group == "telegraf"
assert telegraf.mode == 0o640
assert telegraf.contains('[[inputs.cpu]]')
assert telegraf.contains('totalcpu = false')


def test_telegraf_package(Package):
telegraf = Package('telegraf')
def test_telegraf_package(host):
telegraf = host.package('telegraf')
assert telegraf.is_installed
Binary file removed molecule/default/tests/test_default.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion tasks/Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

- name: "Debian | Download Telegraf package (online)"
get_url:
url: https://dl.influxdata.com/telegraf/releases/telegraf_{{ telegraf_agent_version }}-{{ telegraf_agent_version_patch }}_{{ telegraf_agent_package_arch }}.deb
url: https://dl.influxdata.com/telegraf/releases/{{ telegraf_agent_package_file_deb }}
dest: "{{ telegraf_agent_package }}"
when:
- telegraf_agent_package_method == "online"
Expand Down
5 changes: 3 additions & 2 deletions tasks/RedHat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
- name: Use RHEL 7 packages for Fedora
set_fact:
telegraf_redhat_releasever: 7
when: ansible_distribution == "Fedora"
when:
- ansible_distribution == "Fedora"

- name: "RedHat | Add yum repository"
yum_repository:
Expand All @@ -24,7 +25,7 @@

- name: "RedHat | Download Telegraf package (online)"
get_url:
url: https://dl.influxdata.com/telegraf/releases/telegraf-{{ telegraf_agent_version }}-{{ telegraf_agent_version_patch }}.{{ ansible_architecture }}.rpm
url: https://dl.influxdata.com/telegraf/releases/{{ telegraf_agent_package_file_rpm }}
dest: "{{ telegraf_agent_package }}"
when:
- telegraf_agent_package_method == "online"
Expand Down