From: Zack Cerza Date: Fri, 15 Apr 2016 22:58:39 +0000 (-0600) Subject: pcp: Optionally use upstream package repos X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F226%2Fhead;p=ceph-cm-ansible.git pcp: Optionally use upstream package repos Signed-off-by: Zack Cerza --- diff --git a/roles/pcp/README.rst b/roles/pcp/README.rst index cafd2c97..fff2e498 100644 --- a/roles/pcp/README.rst +++ b/roles/pcp/README.rst @@ -26,6 +26,10 @@ Variables Defaults for these variables are defined in ``roles/pcp/defaults/main.yml``. +To use upstream-provided packages instead of the distro's packages, set:: + + upstream_repo: true + To tell a given host to collect performance data using ``pmcd``, and to run ``pmlogger`` to create archive logs:: diff --git a/roles/pcp/defaults/main.yml b/roles/pcp/defaults/main.yml index ae1ad08f..aff86a31 100644 --- a/roles/pcp/defaults/main.yml +++ b/roles/pcp/defaults/main.yml @@ -1,4 +1,7 @@ --- +# Whether or not to use upstream repos +upstream_repo: false + ## PCP Collector options # Set the host up to collect data pcp_collector: true diff --git a/roles/pcp/tasks/main.yml b/roles/pcp/tasks/main.yml index d7078a13..39b2fee3 100644 --- a/roles/pcp/tasks/main.yml +++ b/roles/pcp/tasks/main.yml @@ -4,6 +4,13 @@ tags: - always +- name: Set up upstream repo + include: repo.yml + when: + upstream_repo|bool == true + tags: + - repo + - name: Miscellaneous preparation include: prep.yml tags: diff --git a/roles/pcp/tasks/repo.yml b/roles/pcp/tasks/repo.yml new file mode 100644 index 00000000..924979e1 --- /dev/null +++ b/roles/pcp/tasks/repo.yml @@ -0,0 +1,32 @@ +--- +- name: Add upstream apt repo + copy: + content: "{{ upstream_repo_source }}" + dest: /etc/apt/sources.list.d/pcp.list + when: + ansible_pkg_mgr == "apt" + +- name: Add upstream GPG key to apt + apt_key: + url: https://bintray.com/user/downloadSubjectPublicKey?username=pcp + keyring: /etc/apt/trusted.gpg.d/pcp.gpg + state: present + validate_certs: true + when: + ansible_pkg_mgr == "apt" + +- name: Add upstream yum repo + get_url: + url: "{{ upstream_repo_url }}" + dest: /etc/apt/sources.list.d/pcp.list + dest: /etc/yum.repos.d/pcp.repo + when: + ansible_pkg_mgr == "yum" + +- name: Add upstream GPG key to rpm + rpm_key: + key: https://bintray.com/user/downloadSubjectPublicKey?username=pcp + state: present + validate_certs: true + when: + ansible_pkg_mgr == "yum" diff --git a/roles/pcp/vars/apt_systems.yml b/roles/pcp/vars/apt_systems.yml index dc30777e..d4789c47 100644 --- a/roles/pcp/vars/apt_systems.yml +++ b/roles/pcp/vars/apt_systems.yml @@ -1,4 +1,5 @@ --- +upstream_repo_source: "deb https://dl.bintray.com/pcp/trusty {{ ansible_distribution_release }} main" pcp_user: pcp pcp_package: pcp pmcd_service: pmcd diff --git a/roles/pcp/vars/yum_systems.yml b/roles/pcp/vars/yum_systems.yml index b47ba6fe..14ba8cf4 100644 --- a/roles/pcp/vars/yum_systems.yml +++ b/roles/pcp/vars/yum_systems.yml @@ -1,4 +1,5 @@ --- +upstream_repo_url: "https://bintray.com/pcp/{{ {'Fedora': 'f', 'CentOS': 'el', 'RedHat': 'el'}[ansible_distribution] }}{{ ansible_distribution_major_version }}/rpm" pcp_user: pcp pcp_package: pcp pmcd_service: pmcd