diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 1ce0d02..a23c065 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -22,12 +22,12 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 3b9cd60..afe67f7 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -12,14 +12,14 @@ jobs: runs-on: ubuntu-latest if: github.repository == 'RedHatSatellite/satellite-operations-collection' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: configure git run: | git config user.name "${GITHUB_ACTOR}" git config user.email "${GITHUB_ACTOR}@bots.github.com" git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.11" - name: Install dependencies diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 683cc34..2d118b7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,24 +18,21 @@ jobs: fail-fast: false matrix: python: - - "3.10" + - "3.11" ansible: - - stable-2.12 - - stable-2.13 - stable-2.14 - stable-2.15 + - stable-2.16 - devel include: - - python: "3.8" - ansible: "stable-2.12" - - python: "3.9" - ansible: "stable-2.13" - - python: "3.11" + - python: "3.10" + ansible: "stable-2.14" + - python: "3.12" ansible: "devel" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} cache: 'pip' @@ -52,9 +49,9 @@ jobs: docs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.11" cache: 'pip' @@ -64,7 +61,7 @@ jobs: - name: Build docs run: make doc - name: Upload docs artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: docs-html path: docs/_build/html/ @@ -72,9 +69,9 @@ jobs: galaxy-importer: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.11" cache: 'pip' @@ -87,9 +84,9 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.11" cache: 'pip' @@ -103,7 +100,7 @@ jobs: - name: Run lint run: make lint - name: Upload collection artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: collection path: redhat-satellite_operations-*.tar.gz @@ -114,33 +111,21 @@ jobs: fail-fast: false matrix: python: - - "3.10" + - "3.11" ansible: - - stable-2.12 - - stable-2.13 - stable-2.14 - stable-2.15 - - devel - include: - - python: "3.8" - ansible: "stable-2.9" - - python: "3.8" - ansible: "stable-2.10" - - python: "3.9" - ansible: "stable-2.11" + - stable-2.16 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} - name: Install Ansible run: pip install --upgrade https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz - name: Install dependencies run: make test-setup - - name: Install Ansible 2.9 compatible molecule - run: pip install --upgrade 'molecule[docker,lint]<4.0' - if: matrix.ansible == 'stable-2.9' - name: Run tests env: DRIVER_NAME: docker @@ -149,9 +134,9 @@ jobs: execution_environment: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.11" cache: 'pip' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index afe70b2..ac8eff0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,14 +10,16 @@ jobs: runs-on: ubuntu-latest if: github.repository == 'RedHatSatellite/satellite-operations-collection' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.11" - name: Install Ansible run: pip install --upgrade ansible - name: Build Ansible Collection run: make dist - - name: Deploy Ansible Collection - run: make publish GALAXY_API_KEY=${{ secrets.GALAXY_API_KEY }} + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + files: redhat-satellite_operations-*.tar.gz diff --git a/CHANGELOG.rst b/CHANGELOG.rst index fe2bbf3..009286d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,15 @@ redhat.satellite_operations Release Notes .. contents:: Topics +v3.0.0 +====== + +Minor Changes +------------- + +- cloud_connector role - Remove receptor cleanup steps in configure cloud connector +- cloud_connector role - Restart rhcd after writing out config file +- metrics role - new role to setup PCP integration with Foreman 3.9 and newer v2.1.0 ====== diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index 3fccb6f..4c7358f 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -75,3 +75,17 @@ releases: release_date: '2023-05-08' 2.1.0: release_date: '2023-09-01' + 3.0.0: + changes: + minor_changes: + - cloud_connector role - Remove receptor cleanup steps in configure cloud connector + - cloud_connector role - Restart rhcd after writing out config file + - metrics role - new role to setup PCP integration with Foreman 3.9 and newer + fragments: + - add-metrics-role.yml + - drop-default-repo.yml + - drop-el7.yml + - drop-foreman-pre-3.2.yml + - drop-postgresql_upgrade-role.yml + - pulpcore-module-only-up-to-410.yml + release_date: '2024-04-08' diff --git a/galaxy.yml b/galaxy.yml index d19da69..ba71f7b 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -3,16 +3,18 @@ name: "satellite_operations" description: Satellite operations tasks such as install, upgrade and maintenance authors: - "Baptiste Agasse " + - "Chris Roberts " - "Eric D. Helms " - "Evgeni Golov " - "Ewoud Kohl van Wijngaarden " + - "Griffin Sullivan " - "Jeffrey van Pelt " - "Jeremy Audet " - "Kyle Williams " - "Matthias Dellweg <2500@gmx.de>" - "Robert Rettig " - "willtome " -version: "2.1.0" +version: "3.0.0" license: - "GPL-3.0-or-later" tags: diff --git a/meta/runtime.yml b/meta/runtime.yml index 43bbe45..be99ccf 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -1,2 +1,2 @@ --- -requires_ansible: '>=2.9' +requires_ansible: '>=2.14.0' diff --git a/roles/backup/molecule/satellite/prepare.yml b/roles/backup/molecule/satellite/prepare.yml index d37863f..5568d8f 100644 --- a/roles/backup/molecule/satellite/prepare.yml +++ b/roles/backup/molecule/satellite/prepare.yml @@ -2,9 +2,7 @@ - name: Prepare hosts: all gather_facts: true - pre_tasks: + tasks: - name: Install crontabs ansible.builtin.package: name: crontabs - roles: - - backup diff --git a/roles/capsule_certs_generate/molecule/satellite/prepare.yml b/roles/capsule_certs_generate/molecule/satellite/prepare.yml index e6ed64c..9b14897 100644 --- a/roles/capsule_certs_generate/molecule/satellite/prepare.yml +++ b/roles/capsule_certs_generate/molecule/satellite/prepare.yml @@ -3,14 +3,19 @@ hosts: all gather_facts: true become: true - roles: - - role: theforeman.operations.foreman_repositories + tasks: + - name: Configure Puppet repositories + ansible.builtin.include_role: + name: theforeman.operations.puppet_repositories + - name: Configure Foreman repositories # noqa: var-naming[pattern] + ansible.builtin.include_role: + name: theforeman.operations.foreman_repositories vars: - foreman_repositories_version: "3.1" - foreman_repositories_katello_version: "4.3" - - theforeman.operations.puppet_repositories - - fake_installer_rpm - post_tasks: + foreman_repositories_version: "3.8" + foreman_repositories_katello_version: "4.10" + - name: Setup fake installer + ansible.builtin.include_role: + name: fake_installer_rpm - name: Ensure langpacks on EL8 ansible.builtin.dnf: name: glibc-langpack-en @@ -22,5 +27,4 @@ vars: satellite_installer_scenario: satellite satellite_installer_options: - - '--disable-system-checks' - - '--verbose-log-level debug' + - '--tuning development' diff --git a/roles/cloud_connector/tasks/cleanup_receptor.yml b/roles/cloud_connector/tasks/cleanup_receptor.yml deleted file mode 100644 index d85d1af..0000000 --- a/roles/cloud_connector/tasks/cleanup_receptor.yml +++ /dev/null @@ -1,49 +0,0 @@ ---- -- name: Identify Satellite ID from Satellite - ansible.builtin.uri: - url: "{{ satellite_cloud_connector_url }}/api/settings?search=name%20%3D%20instance_id" - user: "{{ satellite_cloud_connector_user }}" - password: "{{ satellite_cloud_connector_password }}" - return_content: true - validate_certs: true - force_basic_auth: true - register: satellite_uuid_json - -- name: Find receptor configs - ansible.builtin.find: - paths: /etc/receptor - file_type: directory - register: __satellite_receptor_configs - -- name: Delete sources - ansible.builtin.include_tasks: delete_source.yml - loop: "{{ __satellite_receptor_configs['files'] }}" - -- name: Collect service facts - ansible.builtin.service_facts: - -- name: Stop any receptor services - ansible.builtin.service: - state: stopped - enabled: false - name: "{{ item.name }}" - loop: "{{ ansible_facts.services.values() | selectattr('name', 'regex', 'receptor\\@.+.service') | list }}" - -- name: Remove receptor packages - ansible.builtin.yum: - state: absent - name: - - receptor - - python3-receptor-satellite - - ansiblerole-satellite-receptor-installer - disable_plugin: foreman-protector - -- name: Cleanup receptor config - ansible.builtin.file: - state: absent - path: /etc/receptor - -- name: Remove receptor service file - ansible.builtin.file: - state: absent - path: /etc/systemd/system/receptor@.service diff --git a/roles/cloud_connector/tasks/main.yml b/roles/cloud_connector/tasks/main.yml index 39d9a35..7709606 100644 --- a/roles/cloud_connector/tasks/main.yml +++ b/roles/cloud_connector/tasks/main.yml @@ -21,6 +21,8 @@ owner: root group: root mode: '0640' + notify: + - Restart rhcd - name: Create rhcd worker ansible.builtin.copy: @@ -63,6 +65,3 @@ - name: Configure HTTP proxy ansible.builtin.include_tasks: http_proxy.yml when: satellite_cloud_connector_http_proxy is defined - -- name: Cleanup receptor - ansible.builtin.include_tasks: cleanup_receptor.yml diff --git a/roles/fake_installer_rpm/molecule/satellite/prepare.yml b/roles/fake_installer_rpm/molecule/satellite/prepare.yml index e0c1445..e6e29a5 100644 --- a/roles/fake_installer_rpm/molecule/satellite/prepare.yml +++ b/roles/fake_installer_rpm/molecule/satellite/prepare.yml @@ -7,5 +7,5 @@ - theforeman.operations.puppet_repositories - role: theforeman.operations.foreman_repositories vars: - foreman_repositories_version: "2.4" - foreman_repositories_katello_version: "4.0" + foreman_repositories_version: "3.2" # noqa: var-naming[pattern] + foreman_repositories_katello_version: "4.4" # noqa: var-naming[pattern] diff --git a/roles/installer/molecule/satellite/prepare.yml b/roles/installer/molecule/satellite/prepare.yml index 53e916a..09f2b9d 100644 --- a/roles/installer/molecule/satellite/prepare.yml +++ b/roles/installer/molecule/satellite/prepare.yml @@ -3,14 +3,19 @@ hosts: all gather_facts: true become: true - roles: - - theforeman.operations.puppet_repositories - - role: theforeman.operations.foreman_repositories + tasks: + - name: Configure Puppet repositories + ansible.builtin.include_role: + name: theforeman.operations.puppet_repositories + - name: Configure Foreman repositories # noqa: var-naming[pattern] + ansible.builtin.include_role: + name: theforeman.operations.foreman_repositories vars: foreman_repositories_version: "3.2" foreman_repositories_katello_version: "4.4" - - fake_installer_rpm - tasks: + - name: Setup fake installer + ansible.builtin.include_role: + name: fake_installer_rpm - name: Ensure langpacks on EL8 ansible.builtin.dnf: name: glibc-langpack-en diff --git a/roles/metrics/README.md b/roles/metrics/README.md new file mode 100644 index 0000000..0c1e4ff --- /dev/null +++ b/roles/metrics/README.md @@ -0,0 +1,25 @@ +redhat.satellite_operations.metrics +============================= + +Setup Performance Co-Pilot and Grafana to gather metrics of a Satellite installation. + +This role is heavily based on the [performancecopilot.metrics](https://github.com/performancecopilot/ansible-pcp) collection. + +Role Variables +-------------- + +* `satellite_metrics_url`: The URL of the OpenMetrics endpoint of Satellite, defaults to `https://{{ ansible_fqdn | default('localhost') }}/metrics`. +* `satellite_metrics_pcp_optional_agents`: The optional PCP agents to enable, defaults to `[apache, openmetrics, postgresql, redis]`. +* `satellite_metrics_grafana_enabled`: Whether or not Grafana should be installed and configured on the system, defaults to `true` on Red Hat family systems, and to `false` otherwise. +* `satellite_metrics_grafana_pmproxy_url`: The URL of the `pmproxy` service to be used as the Grafana datasource, defaults to `http://{{ ansible_fqdn | default('localhost') }}:44322`. + +Example Playbooks +----------------- + +```yaml +--- +- hosts: all + gather_facts: true + roles: + - metrics +``` diff --git a/roles/metrics/defaults/main.yml b/roles/metrics/defaults/main.yml new file mode 100644 index 0000000..2b49688 --- /dev/null +++ b/roles/metrics/defaults/main.yml @@ -0,0 +1,12 @@ +--- +satellite_metrics_url: "https://{{ ansible_fqdn | default('localhost') }}/metrics" +satellite_metrics_pcp_additional_packages: "{{ ['pcp-system-tools'] if ansible_os_family == 'RedHat' else ['python3-psycopg2', 'python3-requests'] }}" +satellite_metrics_pcp_optional_agents: + - apache + - openmetrics + - postgresql + - redis +satellite_metrics_pcp_optional_agent_packages_redhat: "{{ satellite_metrics_pcp_optional_agents | map('regex_replace', '^', 'pcp-pmda-') }}" +satellite_metrics_pcp_optional_agent_packages: "{{ satellite_metrics_pcp_optional_agent_packages_redhat if ansible_os_family == 'RedHat' else [] }}" +satellite_metrics_grafana_enabled: "{{ ansible_os_family == 'RedHat' }}" +satellite_metrics_grafana_pmproxy_url: "http://{{ ansible_fqdn | default('localhost') }}:44322" diff --git a/roles/metrics/files/grafana-pcp-provisioning.yaml b/roles/metrics/files/grafana-pcp-provisioning.yaml new file mode 100644 index 0000000..fbf7d39 --- /dev/null +++ b/roles/metrics/files/grafana-pcp-provisioning.yaml @@ -0,0 +1,10 @@ +--- +apiVersion: 1 + +apps: + - type: performancecopilot-pcp-app + org_id: 1 + org_name: Performance Co-Pilot + disabled: false + jsonData: + secureJsonData: diff --git a/roles/metrics/handlers/main.yml b/roles/metrics/handlers/main.yml new file mode 100644 index 0000000..9b3b6ec --- /dev/null +++ b/roles/metrics/handlers/main.yml @@ -0,0 +1,20 @@ +--- +- name: Restart pmcd + ansible.builtin.service: + name: pmcd + state: restarted + +- name: Restart pmproxy + ansible.builtin.service: + name: pmproxy + state: restarted + +- name: Restart pmlogger + ansible.builtin.service: + name: pmlogger + state: restarted + +- name: Restart grafana-server + ansible.builtin.service: + name: grafana-server + state: restarted diff --git a/roles/metrics/molecule/satellite/collections.yml b/roles/metrics/molecule/satellite/collections.yml new file mode 100644 index 0000000..a2b40f2 --- /dev/null +++ b/roles/metrics/molecule/satellite/collections.yml @@ -0,0 +1,6 @@ +collections: + - name: community.docker + version: ">=3,<4" + - name: community.general + version: ">=2,<3" + - name: theforeman.operations diff --git a/roles/metrics/molecule/satellite/converge.yml b/roles/metrics/molecule/satellite/converge.yml new file mode 100644 index 0000000..f9ccb1a --- /dev/null +++ b/roles/metrics/molecule/satellite/converge.yml @@ -0,0 +1,6 @@ +--- +- name: Converge + hosts: all + gather_facts: true + roles: + - metrics diff --git a/roles/metrics/molecule/satellite/molecule.yml b/roles/metrics/molecule/satellite/molecule.yml new file mode 100644 index 0000000..57f4ad6 --- /dev/null +++ b/roles/metrics/molecule/satellite/molecule.yml @@ -0,0 +1,22 @@ +--- +dependency: + name: galaxy +driver: + name: ${DRIVER_NAME:-podman} +platforms: + - name: satellite.example.com + image: quay.io/centos/centos:stream8 + command: /sbin/init + tmpfs: + - /run + - /tmp:exec,mode=777 + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:ro +provisioner: + name: ansible +verifier: + name: ansible +lint: | + set -e + yamllint -c ../../.yamllint . + YAMLLINT_CONFIG_FILE=../../.yamllint ansible-lint . diff --git a/roles/metrics/molecule/satellite/prepare.yml b/roles/metrics/molecule/satellite/prepare.yml new file mode 100644 index 0000000..64744e7 --- /dev/null +++ b/roles/metrics/molecule/satellite/prepare.yml @@ -0,0 +1,30 @@ +--- +- name: Prepare + hosts: all + gather_facts: true + tasks: + - name: Configure Foreman rpeositories # noqa: var-naming[pattern] + ansible.builtin.include_role: + name: theforeman.operations.foreman_repositories + vars: + foreman_repositories_version: 'nightly' + + - name: Ensure langpacks on EL8 + ansible.builtin.package: + name: glibc-langpack-en + state: present + + - name: Install PostgreSQL + ansible.builtin.package: + name: postgresql-server + state: present + + - name: Init PostgreSQL data + ansible.builtin.command: postgresql-setup --initdb + args: + creates: /var/lib/pgsql/data/PG_VERSION + + - name: Start PostgreSQL + ansible.builtin.service: + name: postgresql + state: started diff --git a/roles/metrics/molecule/satellite/verify.yml b/roles/metrics/molecule/satellite/verify.yml new file mode 100644 index 0000000..b97e28f --- /dev/null +++ b/roles/metrics/molecule/satellite/verify.yml @@ -0,0 +1,46 @@ +--- +- name: Verify + hosts: all + gather_facts: false + tasks: + - name: Ensure PCP is installed + ansible.builtin.package: + name: pcp + state: present + + - name: Read pmcd.conf + ansible.builtin.slurp: + src: /etc/pcp/pmcd/pmcd.conf + register: __satellite_pmcd_conf + + - name: Ensure optional metric collection agents are enabled + ansible.builtin.assert: + that: + - item in __satellite_pmcd_enabled_pmdas + loop: + - apache + - openmetrics + - postgresql + - redis + vars: + __satellite_pmcd_enabled_pmdas: "{{ __satellite_pmcd_conf['content'] | b64decode | split('\n') | select('contains', 'pcp/pmdas') | map('split') | map('first') }}" + + - name: Ensure Grafana is installed + ansible.builtin.package: + name: grafana + state: present + + - name: Ensure grafana-server is running + ansible.builtin.service: + name: grafana-server + state: started + + - name: List installed Grafana plugins + ansible.builtin.command: grafana-cli plugins ls + changed_when: false + register: __satellite_grafana_plugins + + - name: Ensure PCP plugin is installed + ansible.builtin.assert: + that: + - "'performancecopilot-pcp-app' in __satellite_grafana_plugins.stdout" diff --git a/roles/metrics/tasks/grafana.yml b/roles/metrics/tasks/grafana.yml new file mode 100644 index 0000000..23e82e3 --- /dev/null +++ b/roles/metrics/tasks/grafana.yml @@ -0,0 +1,30 @@ +--- +- name: Install Grafana packages + ansible.builtin.package: + name: + - grafana + - grafana-pcp + state: present + disable_plugin: foreman-protector + +- name: Add PCP plugin to Grafana + ansible.builtin.copy: + src: files/grafana-pcp-provisioning.yaml + dest: "/etc/grafana/provisioning/plugins/grafana-pcp.yaml" + owner: root + group: grafana + mode: '0640' + notify: Restart grafana-server + +- name: Configure PCP datasources in Grafana + ansible.builtin.template: + src: grafana-pcp-datasources.yaml.j2 + dest: "/etc/grafana/provisioning/datasources/grafana-pcp.yaml" + mode: '0644' + notify: Restart grafana-server + +- name: Start grafana-server + ansible.builtin.service: + name: grafana-server + state: started + enabled: true diff --git a/roles/metrics/tasks/main.yml b/roles/metrics/tasks/main.yml new file mode 100644 index 0000000..f00e5e1 --- /dev/null +++ b/roles/metrics/tasks/main.yml @@ -0,0 +1,74 @@ +--- +- name: Install PCP and optional PMDAs + ansible.builtin.package: + name: "{{ ['foreman-pcp', 'pcp'] + satellite_metrics_pcp_additional_packages + satellite_metrics_pcp_optional_agent_packages }}" + state: present + disable_plugin: "{{ 'foreman-protector' if ansible_os_family == 'RedHat' else omit }}" + +- name: Read pmcd.conf + ansible.builtin.slurp: + src: /etc/pcp/pmcd/pmcd.conf + register: __satellite_pmcd_conf + +# see https://pcp.readthedocs.io/en/latest/UAG/InstallingAndConfiguringPcp.html#managing-optional-pmdas +- name: Ensure optional metric collection agents are enabled + ansible.builtin.file: + path: "/var/lib/pcp/pmdas/{{ item }}/.NeedInstall" + mode: u=rw,g=r,o=r + state: touch + vars: + __satellite_pmcd_enabled_pmdas: "{{ __satellite_pmcd_conf['content'] | b64decode | split('\n') | select('contains', 'pcp/pmdas') | map('split') | map('first') }}" + loop: "{{ satellite_metrics_pcp_optional_agents }}" + when: item not in __satellite_pmcd_enabled_pmdas + notify: + - Restart pmcd + - Restart pmproxy + - Restart pmlogger + +- name: Configure OpenMetrics PMDA to read Satellite metrics + ansible.builtin.copy: + dest: /var/lib/pcp/pmdas/openmetrics/config.d/foreman.url + content: "{{ satellite_metrics_url }}" + mode: '0644' + notify: + - Restart pmcd + - Restart pmproxy + - Restart pmlogger + +- name: Configure hotproc PMDA to monitor Satellite processes + ansible.builtin.file: + path: /var/lib/pcp/pmdas/proc/hotproc.conf + src: /etc/pcp/proc/foreman-hotproc.conf + state: link + notify: + - Restart pmcd + - Restart pmproxy + - Restart pmlogger + +- name: Enable pmcd + ansible.builtin.service: + name: pmcd + state: started + enabled: true + +- name: Enable pmproxy + ansible.builtin.service: + name: pmproxy + state: started + enabled: true + +- name: Enable pmlogger + ansible.builtin.service: + name: pmlogger + state: started + enabled: true + +- name: Enable pmie + ansible.builtin.service: + name: pmie + state: started + enabled: true + +- name: Include Grafana tasks + ansible.builtin.include_tasks: grafana.yml + when: satellite_metrics_grafana_enabled diff --git a/roles/metrics/templates/grafana-pcp-datasources.yaml.j2 b/roles/metrics/templates/grafana-pcp-datasources.yaml.j2 new file mode 100644 index 0000000..5307d3f --- /dev/null +++ b/roles/metrics/templates/grafana-pcp-datasources.yaml.j2 @@ -0,0 +1,23 @@ +--- +apiVersion: 1 + +datasources: +- name: PCP Vector + type: pcp-vector-datasource + access: proxy + orgId: 1 + url: {{ satellite_metrics_grafana_pmproxy_url }} + editable: true + isDefault: true +- name: PCP Redis + type: pcp-redis-datasource + access: proxy + orgId: 1 + url: {{ satellite_metrics_grafana_pmproxy_url }} + editable: true +- name: PCP bpftrace + type: pcp-bpftrace-datasource + access: proxy + orgId: 1 + url: {{ satellite_metrics_grafana_pmproxy_url }} + editable: true