-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dfc0297
commit 1c49e54
Showing
2 changed files
with
174 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,176 +1,184 @@ | ||
--- | ||
- name: Install the GPG key for repo.percona.com | ||
rpm_key: | ||
state: present | ||
key: https://downloads.percona.com/downloads/RPM-GPG-KEY-percona | ||
|
||
- name: Packages | Add PMM2 Server YUM repository for EL7 | ||
yum_repository: | ||
name: pmm2-server | ||
description: PMM Server YUM repository - x86_64 | ||
baseurl: https://repo.percona.com/pmm2-components/yum/{{ pmm2_server_repo }}/7/RPMS/x86_64/ | ||
gpgcheck: yes | ||
enabled: yes | ||
gpgkey: file:///etc/pki/rpm-gpg/PERCONA-PACKAGING-KEY | ||
|
||
- name: Packages | Add PMM2 Server YUM repository for EL9 | ||
when: | ||
- ansible_distribution == "OracleLinux" | ||
- ansible_distribution_major_version == "9" | ||
yum_repository: | ||
name: pmm2-server | ||
description: PMM Server YUM repository - x86_64 | ||
baseurl: https://repo.percona.com/pmm2-components/yum/{{ pmm2_server_repo }}/9/RPMS/x86_64/ | ||
gpgcheck: yes | ||
enabled: yes | ||
gpgkey: file:///etc/pki/rpm-gpg/PERCONA-PACKAGING-KEY | ||
|
||
# local yum repo for building of pmm server docker image in autobuild jobs | ||
- name: PMM | Add local YUM repository | ||
when: ansible_virtualization_type == "docker" | ||
yum_repository: | ||
name: local | ||
description: Local YUM repository - x86_64 | ||
baseurl: file:///tmp/RPMS | ||
gpgcheck: no | ||
enabled: no | ||
|
||
# we use it for pmm-client (TODO we'll need switch to pmm-client client repo) | ||
- name: Packages | Install percona-release rpm | ||
yum: | ||
name: https://repo.percona.com/yum/percona-release-latest.noarch.rpm | ||
state: installed | ||
ignore_errors: True | ||
|
||
- name: Packages | Update OS | ||
yum: | ||
name: '*' | ||
state: latest | ||
exclude: 'ansible' | ||
disablerepo: percona-release-x86_64 | ||
|
||
- name: Packages | Install OS tools for EL7 | ||
when: | ||
- ansible_distribution == "CentOS" | ||
- ansible_distribution_major_version == "7" | ||
yum: | ||
name: | ||
- python2-pip | ||
- rsync | ||
|
||
- name: Packages | Install OS tools for EL9 | ||
when: | ||
- ansible_distribution == "OracleLinux" | ||
- ansible_distribution_major_version == "9" | ||
yum: | ||
name: | ||
- python3-pip | ||
- rsync | ||
- libsqlite3x-devel # package does not come pre-installed on EL9 | ||
|
||
- name: Create users for non-docker images | Create users | ||
user: | ||
name: "pmm" | ||
when: ansible_virtualization_type != "docker" | ||
|
||
- name: Create users for non-docker images | Create users | ||
user: | ||
name: "pmm" | ||
when: ansible_virtualization_type != "docker" | ||
|
||
- name: Create users and groups in docker container | ||
block: | ||
- name: Ensure groups exist with correct gid | ||
group: | ||
name: "{{ item.name }}" | ||
gid: "{{ item.gid }}" | ||
loop: | ||
- { name: pmm, gid: 1000 } | ||
- { name: nginx, gid: 998 } | ||
- { name: grafana, gid: 996 } | ||
- { name: clickhouse, gid: 995 } | ||
- { name: pmm-agent, gid: 994 } | ||
|
||
- name: Create users | Create users | ||
user: | ||
name: "{{ item.name }}" | ||
uid: "{{ item.uid }}" | ||
home: "{{ item.home }}" | ||
comment: "{{ item.comment }}" | ||
shell: "{{ item.shell }}" | ||
group: "{{ item.group }}" | ||
loop: | ||
- { name: pmm, uid: 1000, comment: "PMM Server", shell: "/bin/false", home: "/home/pmm", group: pmm } | ||
- { name: nginx, uid: 999, comment: "nginx user", shell: "/sbin/nologin", home: "/var/cache/nginx", group: nginx } | ||
- { name: grafana, uid: 998, comment: "Grafana Dashboard", shell: "/sbin/nologin", home: "/etc/grafana", group: grafana } | ||
- { name: clickhouse, uid: 997, comment: "Clickhouse server", shell: "/sbin/nologin", home: "/var/lib/clickhouse", group: clickhouse } | ||
- { name: pmm-agent, uid: 996, comment: "pmm-agent", shell: "/bin/false", home: "/usr/local/percona/", group: pmm-agent } | ||
when: ansible_virtualization_type == "docker" | ||
|
||
- name: Create directories | Create dirs | ||
file: path={{ item }} state=directory owner=pmm group=pmm | ||
with_items: | ||
- /srv/prometheus/data | ||
- /srv/prometheus/rules | ||
- /srv/alertmanager/data | ||
|
||
- name: Install the GPG key for repo.percona.com | ||
rpm_key: | ||
state: present | ||
key: 'https://downloads.percona.com/downloads/RPM-GPG-KEY-percona' | ||
- name: Packages | Add PMM2 Server YUM repository for EL7 | ||
when: | ||
- ansible_distribution == "CentOS" | ||
- ansible_distribution_major_version == "7" | ||
yum_repository: | ||
name: pmm2-server | ||
description: PMM Server YUM repository - x86_64 | ||
baseurl: >- | ||
https://repo.percona.com/pmm2-components/yum/{{ pmm2_server_repo | ||
}}/7/RPMS/x86_64/ | ||
gpgcheck: 'yes' | ||
enabled: 'yes' | ||
gpgkey: 'file:///etc/pki/rpm-gpg/PERCONA-PACKAGING-KEY' | ||
- name: Packages | Add PMM2 Server YUM repository for EL9 | ||
when: | ||
- ansible_distribution == "OracleLinux" | ||
- ansible_distribution_major_version == "9" | ||
yum_repository: | ||
name: pmm2-server | ||
description: PMM Server YUM repository - x86_64 | ||
baseurl: >- | ||
https://repo.percona.com/pmm2-components/yum/{{ pmm2_server_repo | ||
}}/9/RPMS/x86_64/ | ||
gpgcheck: 'yes' | ||
enabled: 'yes' | ||
gpgkey: 'file:///etc/pki/rpm-gpg/PERCONA-PACKAGING-KEY' | ||
- name: PMM | Add local YUM repository | ||
when: ansible_virtualization_type == "docker" | ||
yum_repository: | ||
name: local | ||
description: Local YUM repository - x86_64 | ||
baseurl: 'file:///tmp/RPMS' | ||
gpgcheck: 'no' | ||
enabled: 'no' | ||
- name: Packages | Install percona-release rpm | ||
yum: | ||
name: 'https://repo.percona.com/yum/percona-release-latest.noarch.rpm' | ||
state: installed | ||
ignore_errors: true | ||
- name: Packages | Update OS | ||
yum: | ||
name: '*' | ||
state: latest | ||
exclude: ansible* | ||
disablerepo: percona-release-x86_64 | ||
- name: Packages | Install OS tools for EL7 | ||
when: | ||
- ansible_distribution == "CentOS" | ||
- ansible_distribution_major_version == "7" | ||
yum: | ||
name: | ||
- python2-pip | ||
- rsync | ||
- name: Packages | Install OS tools for EL9 | ||
when: | ||
- ansible_distribution == "OracleLinux" | ||
- ansible_distribution_major_version == "9" | ||
yum: | ||
name: | ||
- python3-pip | ||
- rsync | ||
- libsqlite3x-devel | ||
- name: Create users for non-docker images | Create users | ||
user: | ||
name: pmm | ||
when: ansible_virtualization_type != "docker" | ||
- name: Create users and groups in docker container | ||
block: | ||
- name: Ensure groups exist with correct gid | ||
group: | ||
name: '{{ item.name }}' | ||
gid: '{{ item.gid }}' | ||
loop: | ||
- name: pmm | ||
gid: 1000 | ||
- name: nginx | ||
gid: 998 | ||
- name: grafana | ||
gid: 996 | ||
- name: clickhouse | ||
gid: 995 | ||
- name: pmm-agent | ||
gid: 994 | ||
- name: Create users | Create users | ||
user: | ||
name: '{{ item.name }}' | ||
uid: '{{ item.uid }}' | ||
home: '{{ item.home }}' | ||
comment: '{{ item.comment }}' | ||
shell: '{{ item.shell }}' | ||
group: '{{ item.group }}' | ||
loop: | ||
- name: pmm | ||
uid: 1000 | ||
comment: PMM Server | ||
shell: /bin/false | ||
home: /home/pmm | ||
group: pmm | ||
- name: nginx | ||
uid: 999 | ||
comment: nginx user | ||
shell: /sbin/nologin | ||
home: /var/cache/nginx | ||
group: nginx | ||
- name: grafana | ||
uid: 998 | ||
comment: Grafana Dashboard | ||
shell: /sbin/nologin | ||
home: /etc/grafana | ||
group: grafana | ||
- name: clickhouse | ||
uid: 997 | ||
comment: Clickhouse server | ||
shell: /sbin/nologin | ||
home: /var/lib/clickhouse | ||
group: clickhouse | ||
- name: pmm-agent | ||
uid: 996 | ||
comment: pmm-agent | ||
shell: /bin/false | ||
home: /usr/local/percona/ | ||
group: pmm-agent | ||
when: ansible_virtualization_type == "docker" | ||
- name: Create directories | Create dirs | ||
file: 'path={{ item }} state=directory owner=pmm group=pmm' | ||
with_items: | ||
- /srv/prometheus/data | ||
- /srv/prometheus/rules | ||
- /srv/alertmanager/data | ||
- name: Create directories | Create dirs | ||
file: | ||
path: /srv/logs | ||
state: directory | ||
owner: pmm | ||
group: pmm | ||
mode: '0775' | ||
|
||
- name: Create dirs | Create dirs | ||
when: ansible_virtualization_type == "docker" | ||
file: path={{ item }} state=directory | ||
with_items: | ||
- /var/lib/cloud/scripts/per-once | ||
- /var/lib/cloud/scripts/per-boot | ||
|
||
- name: Create dirs | Create dirs | ||
when: ansible_virtualization_type == "docker" | ||
file: 'path={{ item }} state=directory' | ||
with_items: | ||
- /var/lib/cloud/scripts/per-once | ||
- /var/lib/cloud/scripts/per-boot | ||
- name: Install supervisord | ||
include_role: | ||
name: supervisord-init | ||
|
||
- name: Install RPMs | Install RPMs for PMM2 server | ||
yum: | ||
name: | ||
- percona-grafana | ||
- percona-victoriametrics | ||
- percona-qan-api2 | ||
- percona-dashboards | ||
- percona-alertmanager | ||
- pmm-managed | ||
- pmm-update | ||
- dbaas-controller | ||
- dbaas-tools | ||
- pmm-dump | ||
- vmproxy | ||
state: installed | ||
# line below is sed'ed by build-server-docker script | ||
enablerepo: "pmm2-server" | ||
|
||
- name: PMM | Enable repo for pmm2-client | ||
command: percona-release enable {{ pmm_client_repos }} | ||
|
||
- name: Install RPMs | Install pmm2-client rpm | ||
yum: | ||
name: | ||
- pmm2-client | ||
state: installed | ||
enablerepo: "{{ pmm_client_repo_name }}" | ||
|
||
- name: Disable pmm-agent service | Disable pmm-agent | ||
when: ansible_virtualization_type != "docker" | ||
service: name=pmm-agent state=stopped enabled=no | ||
|
||
- name: Create tmp dirs | Create tmp dirs | ||
when: ansible_virtualization_type != "docker" | ||
command: /usr/bin/systemd-tmpfiles --create --remove --boot --exclude-prefix=/dev | ||
|
||
- name: Copy grafana.ini file for the first run | ||
copy: | ||
src: grafana.ini | ||
dest: /etc/supervisord.d/grafana.ini | ||
mode: '0644' | ||
- name: Install RPMs | Install RPMs for PMM2 server | ||
yum: | ||
name: | ||
- percona-grafana | ||
- percona-victoriametrics | ||
- percona-qan-api2 | ||
- percona-dashboards | ||
- percona-alertmanager | ||
- pmm-managed | ||
- pmm-update | ||
- dbaas-controller | ||
- dbaas-tools | ||
- pmm-dump | ||
- vmproxy | ||
state: installed | ||
enablerepo: pmm2-server | ||
- name: PMM | Enable repo for pmm2-client | ||
command: 'percona-release enable {{ pmm_client_repos }}' | ||
- name: Install RPMs | Install pmm2-client rpm | ||
yum: | ||
name: | ||
- pmm2-client | ||
state: installed | ||
enablerepo: '{{ pmm_client_repo_name }}' | ||
- name: Disable pmm-agent service | Disable pmm-agent | ||
when: ansible_virtualization_type != "docker" | ||
service: name=pmm-agent state=stopped enabled=no | ||
- name: Create tmp dirs | Create tmp dirs | ||
when: ansible_virtualization_type != "docker" | ||
command: /usr/bin/systemd-tmpfiles --create --remove --boot --exclude-prefix=/dev | ||
- name: Copy grafana.ini file for the first run | ||
copy: | ||
src: grafana.ini | ||
dest: /etc/supervisord.d/grafana.ini | ||
mode: '0644' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters