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

feat: sync with latest ansible-pcp #178

Merged
merged 1 commit into from
Nov 28, 2023
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
28 changes: 28 additions & 0 deletions tests/check_pmie_webhook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# SPDX-License-Identifier: MIT
---
- name: Check if primary pmie is running
changed_when: false
shell: |
set -eu
if set -o | grep -q pipefail; then
set -o pipefail # no pipefail on debian, some ubuntu
fi
pmprobe -I pmcd.pmie.pmcd_host | grep '"primary"'
when: (ansible_facts['distribution'] in ['RedHat', 'CentOS'] and
ansible_facts['distribution_major_version'] | int > 6) or
ansible_facts['distribution'] not in ['Fedora', 'RedHat', 'CentOS']

# yamllint disable rule:line-length
- name: Check if primary pmie uses webhook
changed_when: false
shell: |
set -eu
if set -o | grep -q pipefail; then
set -o pipefail # no pipefail on debian, some ubuntu
fi
pmieconf -f /var/lib/pcp/config/pmie/config.default list global webhook_endpoint | grep '"example"'
pmieconf -f /var/lib/pcp/config/pmie/config.default list global webhook_action | grep '"yes"'
when: (ansible_distribution in ['RedHat', 'CentOS'] and
(ansible_facts['distribution_version'] is version('9.3', '<'))) or
ansible_distribution not in ['Fedora', 'RedHat', 'CentOS']
# yamllint enable rule:line-length
20 changes: 8 additions & 12 deletions tests/tests_verify_mssql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,24 @@
- name: Save state of services
import_tasks: get_services_state.yml

- name: Ensure correct package manager for ostree systems
vars:
ostree_pkg_mgr: ansible.posix.rhel_rpm_ostree
ostree_booted_file: /run/ostree-booted
when: ansible_facts.pkg_mgr | d("") != ostree_pkg_mgr
- name: Determine if system is ostree and set flag
when: not __ansible_pcp_is_ostree is defined
block:
- name: Check if system is ostree
stat:
path: "{{ ostree_booted_file }}"
path: /run/ostree-booted
register: __ostree_booted_stat

- name: Set package manager to use for ostree
ansible.utils.update_fact:
updates:
- path: ansible_facts.pkg_mgr
value: "{{ ostree_pkg_mgr }}"
when: __ostree_booted_stat.stat.exists
- name: Set flag to indicate system is ostree
set_fact:
__ansible_pcp_is_ostree: "{{ __ostree_booted_stat.stat.exists }}"

- name: Ensure python3-pyodbc is installed
package:
name: python3-pyodbc
state: present
use: "{{ (__ansible_pcp_is_ostree | d(false)) |
ternary('ansible.posix.rhel_rpm_ostree', omit) }}"

tasks:
- name: Check MSSQL functionality
Expand Down
27 changes: 27 additions & 0 deletions tests/tests_verify_pmie_webhook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# SPDX-License-Identifier: MIT
---
- name: Test pmie webhook configuration
hosts: all

roles:
- role: performancecopilot.metrics.pcp
vars:
pcp_pmie_endpoint: https://example.com:12345/webhook

pre_tasks:
- name: Skip test if not supported by platform
meta: end_host
when: (ansible_distribution in ['RedHat', 'CentOS'] and
(ansible_facts['distribution_version'] is version('9.3', '<'))) or
ansible_distribution not in ['Fedora', 'RedHat', 'CentOS']

- name: Save state of services
import_tasks: get_services_state.yml

tasks:
- name: Check if configuring pmie webhook works
include_tasks: check_pmie_webhook.yml

post_tasks:
- name: Restore state of services
import_tasks: restore_services_state.yml
22 changes: 9 additions & 13 deletions tests/tests_verify_postfix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,26 @@
- name: Save state of services
import_tasks: get_services_state.yml

- name: Ensure correct package manager for ostree systems
vars:
ostree_pkg_mgr: ansible.posix.rhel_rpm_ostree
ostree_booted_file: /run/ostree-booted
when: ansible_facts.pkg_mgr | d("") != ostree_pkg_mgr
- name: Determine if system is ostree and set flag
when: not __ansible_pcp_is_ostree is defined
block:
- name: Check if system is ostree
stat:
path: "{{ ostree_booted_file }}"
path: /run/ostree-booted
register: __ostree_booted_stat

- name: Set package manager to use for ostree
ansible.utils.update_fact:
updates:
- path: ansible_facts.pkg_mgr
value: "{{ ostree_pkg_mgr }}"
when: __ostree_booted_stat.stat.exists
- name: Set flag to indicate system is ostree
set_fact:
__ansible_pcp_is_ostree: "{{ __ostree_booted_stat.stat.exists }}"

- name: Ensure postfix is installed
- name: Ensure Postfix is installed
package:
name:
- postfix
- postfix-perl-scripts
state: present
use: "{{ (__ansible_pcp_is_ostree | d(false)) |
ternary('ansible.posix.rhel_rpm_ostree', omit) }}"

# needed for older versions of PCP which mandated a log file
# exists in order that the PMDA would start up at all.
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions vendor/github.com/performancecopilot/ansible-pcp/galaxy.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading