Skip to content

Commit

Permalink
update distro check to allow bypass
Browse files Browse the repository at this point in the history
  • Loading branch information
dgibbs64 committed Jan 14, 2025
1 parent a580ccb commit ba7ea58
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 16 deletions.
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,19 @@ Requires a <a href="https://www.netdata.cloud">Netdata</a> account to use the cl

### Supported Distros

- AlmaLinux >= 8
- AlmaLinux >= 9
- AmazonLinux 2023
- CentOS >= 8
- Debian >= 10
- Fedora >= 29
- openSUSE >= 15.4
- Debian >= 12
- Fedora >= 41
- openSUSE >= 15.6
- OracleLinux >= 8
- Pop!\_OS >= 20.04
- Redhat Enterprise Linux >= 8
- Rocky Linux >= 8
- Redhat Enterprise Linux >= 9
- Rocky Linux >= 9
- Ubuntu >= 20.04

> Note: This role will check the distro and <a href="https://docs.ansible.com/ansible/latest/collections/ansible/builtin/meta_module.html#parameter-free_form">skip the role</a> if the distro is not supported. This can be bypassed by setting `netdata_distro_check_bypass` to `true`.
## Role Variables

By default this role will setup netdata agent with the standalone dashboard enabled.
Expand Down
6 changes: 5 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,8 @@ netdata_agent_web_allow_from:
netdata_disable_email_notifications: true

# Distro check bypass
netdata_bypass_distro_check: false
netdata_distro_check_bypass: false

# Distro check failstate end_role|end_play|end_host
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/meta_module.html#parameter-free_form
netdata_distro_check_fail_state: end_role
21 changes: 15 additions & 6 deletions tasks/assert.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
---
- name: "Test if netdata_bypass_distro_check is set correctly"
ansible.builtin.assert:
that:
- netdata_bypass_distro_check is defined
- netdata_bypass_distro_check is boolean
quiet: true

- name: "Test if netdata_cloud_enable is set correctly"
ansible.builtin.assert:
Expand Down Expand Up @@ -81,3 +75,18 @@
- netdata_disable_email_notifications is defined
- netdata_disable_email_notifications is boolean
quiet: true

- name: "Test if netdata_distro_check_bypass is set correctly"
ansible.builtin.assert:
that:
- netdata_distro_check_bypass is defined
- netdata_distro_check_bypass is boolean
quiet: true

- name: "Test if netdata_distro_check_fail_state is set correctly"
ansible.builtin.assert:
that:
- netdata_distro_check_fail_state is defined
- netdata_distro_check_fail_state is string
- netdata_distro_check_fail_state in ['end_role', 'end_play', 'end_host']
quiet: true
2 changes: 1 addition & 1 deletion tasks/distro-requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
when: distro_supported is false and "molecule-notest" in ansible_skip_tags

- name: "Skip role if distro or architecture is not supported"
ansible.builtin.meta: end_role
ansible.builtin.meta: "{{ netdata_distro_check_fail_state }}"
when: distro_supported is false
2 changes: 1 addition & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

- name: "Distro Requirements"
ansible.builtin.include_tasks: distro-requirements.yml
when: netdata_bypass_distro_check is not defined or netdata_bypass_distro_check is false
when: netdata_distro_check_bypass is not defined or netdata_distro_check_bypass is false

- name: "Become block"
become: true
Expand Down

0 comments on commit ba7ea58

Please sign in to comment.