2014-10-10 12:35:14 +02:00
|
|
|
---
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Mount fs
|
2017-10-17 17:37:03 +00:00
|
|
|
import_tasks: "mount_fs.yml"
|
2014-10-10 12:35:14 +02:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Setup networking
|
2017-10-17 17:37:03 +00:00
|
|
|
import_tasks: "network.yml"
|
2020-02-19 23:08:24 +01:00
|
|
|
when: datacenter != 'aws'
|
2015-04-01 13:32:45 +00:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Create obsrun group for `sign' command
|
2019-07-11 16:15:32 +02:00
|
|
|
group: name=obsrun
|
|
|
|
|
2017-01-21 17:48:06 +01:00
|
|
|
# pre-create copr user and group with predefined uid and gid
|
|
|
|
- group: name=copr gid=986
|
2019-04-04 13:50:23 +02:00
|
|
|
- user: name=copr group=copr uid=989 groups=obsrun
|
2017-01-21 17:48:06 +01:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Install copr-backend and copr-selinux
|
2019-04-02 10:27:12 +02:00
|
|
|
dnf:
|
2019-04-23 12:05:49 +02:00
|
|
|
state: present
|
2019-04-02 10:27:12 +02:00
|
|
|
name: copr-backend
|
2017-01-19 14:39:48 +01:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Add additional packages for copr-backend
|
2019-04-02 10:27:12 +02:00
|
|
|
dnf:
|
|
|
|
state: present
|
|
|
|
name:
|
2020-11-11 15:28:34 +01:00
|
|
|
- python3-boto # for aws ansible plugin
|
2019-07-29 13:10:46 +02:00
|
|
|
- python3-copr-messaging
|
2019-07-11 16:27:56 +02:00
|
|
|
- python3-glanceclient
|
|
|
|
- python3-neutronclient
|
|
|
|
- python3-keystoneclient
|
2020-05-25 11:03:58 +02:00
|
|
|
- python3-dateutil
|
2019-04-02 10:27:12 +02:00
|
|
|
- php-cli
|
2020-02-04 02:04:30 +01:00
|
|
|
- nfs-utils
|
2021-12-20 11:02:25 +01:00
|
|
|
- nagios-plugins-http
|
2022-01-20 13:37:56 +01:00
|
|
|
tags:
|
|
|
|
- packages
|
2017-02-25 20:18:48 +01:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
# - name: Patch for prunerepo, issue 1090
|
2020-01-14 11:32:01 +01:00
|
|
|
# patch: src=patches/prunerepo-dataloss.patch
|
|
|
|
# dest=/usr/bin/prunerepo
|
|
|
|
# tags: patches
|
2020-01-02 19:49:29 +01:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Install openstackclient for image preparation
|
2019-08-14 12:57:58 +02:00
|
|
|
dnf: state=present name=python3-openstackclient
|
|
|
|
when: devel|bool
|
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Make copr dirs
|
2024-12-17 15:31:55 +10:00
|
|
|
ansible.builtin.file: state=directory path={{ item }}
|
2014-10-10 12:35:14 +02:00
|
|
|
with_items:
|
|
|
|
- /var/lib/copr/jobs
|
|
|
|
- /var/lib/copr/public_html/results
|
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Setup dirs there
|
2024-12-17 15:31:55 +10:00
|
|
|
ansible.builtin.file: state=directory path="/home/copr/{{ item }}" owner=copr group=copr mode=0700
|
2014-10-10 12:35:14 +02:00
|
|
|
with_items:
|
|
|
|
- cloud
|
|
|
|
- .ssh
|
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Setup privkey for copr user
|
2024-12-18 08:23:28 +10:00
|
|
|
ansible.builtin.copy: src="{{ private }}/files/copr/buildsys.priv" dest=/home/copr/.ssh/id_rsa owner=copr group=copr mode=600
|
2014-10-10 12:35:14 +02:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Setup copr user ssh config file
|
2025-01-13 12:24:19 +10:00
|
|
|
ansible.builtin.template:
|
2023-03-30 10:44:40 +02:00
|
|
|
src: "ssh_config.j2"
|
2023-03-30 10:56:53 +02:00
|
|
|
dest: /home/copr/.ssh/config
|
2023-03-30 10:57:55 +02:00
|
|
|
owner: copr
|
|
|
|
group: copr
|
2024-11-27 13:48:08 +10:00
|
|
|
mode: "0600"
|
2023-03-30 10:37:03 +02:00
|
|
|
tags:
|
2023-03-30 10:44:40 +02:00
|
|
|
- backend_to_hv_ssh_config
|
|
|
|
- provision_config
|
2014-10-10 12:35:14 +02:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Check known_hosts file
|
2024-12-19 11:22:24 +10:00
|
|
|
ansible.builtin.command: stat /home/copr/.ssh/known_hosts
|
2015-02-23 16:47:35 +00:00
|
|
|
register: hostsstat
|
2016-11-01 16:29:49 +00:00
|
|
|
check_mode: no
|
2015-02-23 16:47:35 +00:00
|
|
|
changed_when: "1 != 1"
|
2015-03-18 14:04:33 +01:00
|
|
|
ignore_errors: yes
|
2015-02-23 16:47:35 +00:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Create empty known_hosts
|
2024-12-17 15:31:55 +10:00
|
|
|
ansible.builtin.file: state=touch dest=/home/copr/.ssh/known_hosts owner=copr group=copr mode=600
|
2015-02-23 16:47:35 +00:00
|
|
|
when: hostsstat.rc == 1
|
2014-10-10 12:35:14 +02:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Replace bashrc for copr user
|
2024-12-18 08:23:28 +10:00
|
|
|
ansible.builtin.copy: src="copr_bashrc" dest=/home/copr/.bashrc owner=copr group=copr mode=600
|
2014-10-10 12:35:14 +02:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Auth_key so we can login to localhost as the copr user from the copr user
|
2014-10-10 12:35:14 +02:00
|
|
|
authorized_key: user=copr key="{{ item }}"
|
2024-11-27 13:48:08 +10:00
|
|
|
no_log: true
|
2014-10-10 12:35:14 +02:00
|
|
|
with_file:
|
|
|
|
- "provision/files/buildsys.pub"
|
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Copy .boto file
|
2024-12-18 08:23:28 +10:00
|
|
|
ansible.builtin.copy: src="boto" dest=/home/copr/.boto owner=copr group=copr
|
2014-10-10 12:35:14 +02:00
|
|
|
|
|
|
|
# setup webserver
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Install lighttpd.conf
|
2025-01-13 12:24:19 +10:00
|
|
|
ansible.builtin.template: src="lighttpd/lighttpd.conf" dest=/etc/lighttpd/lighttpd.conf owner=root group=root mode=0644
|
2014-10-10 12:35:14 +02:00
|
|
|
notify:
|
2025-02-07 13:51:07 +01:00
|
|
|
- Restart lighttpd
|
2020-02-04 12:50:19 +01:00
|
|
|
tags:
|
|
|
|
- config
|
2021-02-02 19:54:18 +01:00
|
|
|
- lighttpd_config
|
2014-10-10 12:35:14 +02:00
|
|
|
|
2025-01-18 15:27:44 +01:00
|
|
|
- name: Create a txt file with Pulp redirects
|
2025-01-30 15:12:35 +01:00
|
|
|
file: state=touch dest=/var/lib/copr/pulp-redirect.txt owner=copr group=copr mode=644
|
2025-01-18 15:27:44 +01:00
|
|
|
|
|
|
|
- name: Add custom lighttpd lua scripts
|
|
|
|
ansible.builtin.template: src="lighttpd/{{ item }}.j2" dest="/etc/lighttpd/{{ item }}" owner=root group=root mode=644
|
|
|
|
with_items:
|
|
|
|
- content-encoding-gzip-if-exists.lua
|
|
|
|
- pulp-redirect.lua
|
2021-01-11 19:51:01 +01:00
|
|
|
notify:
|
2025-02-07 13:51:07 +01:00
|
|
|
- Restart lighttpd
|
2021-01-11 19:51:01 +01:00
|
|
|
tags:
|
|
|
|
- config
|
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Letsencrypt cert
|
2019-07-19 11:01:40 +02:00
|
|
|
include_role: name=copr/certbot
|
2018-11-13 00:30:00 +01:00
|
|
|
tags:
|
|
|
|
- config
|
2022-01-30 18:58:20 +01:00
|
|
|
- certbot
|
2018-11-13 00:30:00 +01:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Allow lighttpd set fds limit
|
2015-05-19 15:28:33 +02:00
|
|
|
seboolean: name=httpd_setrlimit state=yes persistent=yes
|
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Create directory for compress module of lighttpd
|
2024-12-17 15:31:55 +10:00
|
|
|
ansible.builtin.file: path=/var/cache/lighttpd/compress owner=lighttpd group=lighttpd mode=0644 state=directory
|
2015-05-19 15:28:33 +02:00
|
|
|
|
2014-10-10 12:35:14 +02:00
|
|
|
# mime default to text/plain and enable dirlisting for indexes
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Update lighttpd configs
|
2024-12-18 08:23:28 +10:00
|
|
|
ansible.builtin.copy: src="lighttpd/{{ item }}" dest="/etc/lighttpd/conf.d/{{ item }}" owner=root group=root mode=0644
|
2014-10-10 12:35:14 +02:00
|
|
|
with_items:
|
|
|
|
- dirlisting.conf
|
|
|
|
- mime.conf
|
|
|
|
notify:
|
2025-02-07 13:51:07 +01:00
|
|
|
- Restart lighttpd
|
2020-02-04 12:50:19 +01:00
|
|
|
tags:
|
|
|
|
- config
|
2014-10-10 12:35:14 +02:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Install custom lighttpd template for directory listings
|
2025-01-13 12:24:19 +10:00
|
|
|
ansible.builtin.template: src="lighttpd/dir-generator.php.j2" dest="/var/lib/copr/public_html/dir-generator.php" owner=copr group=copr mode=0755
|
2017-09-21 01:39:37 +02:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Install resalloc CGI script
|
2024-12-18 08:23:28 +10:00
|
|
|
ansible.builtin.copy:
|
2022-06-22 15:36:52 -04:00
|
|
|
src: cgi-resalloc
|
|
|
|
dest: /var/www/
|
|
|
|
setype: httpd_sys_script_exec_t
|
2024-11-27 13:48:08 +10:00
|
|
|
mode: "0755"
|
2022-05-20 16:31:54 -04:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Install the helper scripts for lighttpd log rotation
|
2024-12-18 08:23:28 +10:00
|
|
|
ansible.builtin.copy:
|
2021-12-08 16:14:29 +01:00
|
|
|
src: "{{ item }}"
|
|
|
|
dest: /usr/local/bin/{{ item }}
|
2024-11-27 13:48:08 +10:00
|
|
|
mode: "0755"
|
2021-12-08 16:14:29 +01:00
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
with_items:
|
|
|
|
- copr-lighty-logger
|
|
|
|
- copr-lighty-reopen-logs
|
|
|
|
register: logrotate_scripts
|
|
|
|
tags: logrotate
|
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Fix selinux context on helper scripts
|
2024-12-19 11:22:24 +10:00
|
|
|
ansible.builtin.command: restorecon -irv /usr/local/bin/copr-lighty*
|
2021-12-08 16:14:29 +01:00
|
|
|
when: logrotate_scripts.changed
|
|
|
|
tags: logrotate
|
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Install custom logrotate config for lighttpd
|
2025-01-13 12:24:19 +10:00
|
|
|
ansible.builtin.template: src="logrotate/lighttpd.j2" dest=/etc/logrotate.d/lighttpd owner=root group=root mode=644
|
2021-12-08 16:14:29 +01:00
|
|
|
tags: logrotate
|
2017-12-18 13:02:40 +01:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Start webserver
|
2017-04-13 01:37:21 +00:00
|
|
|
service: state=started enabled=yes name=lighttpd
|
2014-10-10 12:35:14 +02:00
|
|
|
|
|
|
|
# setup dirs for the ansible execution off of provisioning
|
2025-01-14 20:18:57 +10:00
|
|
|
# - name: Dirs from provision
|
2024-12-17 15:31:55 +10:00
|
|
|
# ansible.builtin.file: state=directory path="/home/copr/provision/{{ item }}" owner=copr group=copr
|
2015-04-02 12:59:59 +02:00
|
|
|
# with_items:
|
|
|
|
# - action_plugins
|
|
|
|
# - library
|
|
|
|
# tags:
|
|
|
|
# - provision_config
|
2021-05-23 22:05:03 +02:00
|
|
|
#
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Calculate the maximum resalloc workers per architecture
|
2023-05-24 13:06:04 +02:00
|
|
|
set_fact: "max_{{ item }}_workers={{ builders | community.general.json_query('*.'+item+'[0]') | sum() }}"
|
|
|
|
with_items:
|
|
|
|
- aarch64
|
|
|
|
- ppc64le
|
|
|
|
- x86_64
|
|
|
|
- s390x
|
|
|
|
tags:
|
|
|
|
- provision_config
|
2021-05-23 22:05:03 +02:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Calculate max number of workers
|
2023-05-24 13:06:04 +02:00
|
|
|
set_fact: "max_workers={{ max_x86_64_workers|int + max_aarch64_workers|int + max_ppc64le_workers|int + max_s390x_workers|int }}"
|
|
|
|
tags:
|
|
|
|
- provision_config
|
2021-05-23 22:05:03 +02:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Print max arch workers
|
2023-05-24 13:06:04 +02:00
|
|
|
debug: "var=max_{{ item }}_workers"
|
|
|
|
with_items:
|
|
|
|
- x86_64
|
|
|
|
- aarch64
|
2025-01-10 20:25:49 +01:00
|
|
|
- s390x
|
|
|
|
- ppc64le
|
2023-05-24 13:06:04 +02:00
|
|
|
tags:
|
|
|
|
- provision_config
|
2014-10-10 12:35:14 +02:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Resalloc
|
2019-05-13 11:01:39 +02:00
|
|
|
import_tasks: resalloc.yml
|
|
|
|
tags:
|
|
|
|
- resalloc
|
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Put ansible.cfg for all this into /etc/ansible/ on the system
|
2024-12-18 08:23:28 +10:00
|
|
|
ansible.builtin.copy: src="provision/ansible.cfg" dest=/etc/ansible/ansible.cfg
|
2014-10-10 12:35:14 +02:00
|
|
|
tags:
|
|
|
|
- provision_config
|
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Install .ansible.cfg for copr user
|
2024-12-18 08:23:28 +10:00
|
|
|
ansible.builtin.copy: src=ansible.cfg dest=/home/copr/.ansible.cfg
|
2019-08-14 17:00:18 +02:00
|
|
|
owner=copr group=copr mode=600
|
|
|
|
tags:
|
|
|
|
- provision_config
|
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Setup provision directory
|
2021-05-10 00:14:28 +02:00
|
|
|
include_tasks: setup_provisioning_environment.yml
|
|
|
|
vars:
|
|
|
|
cloud_vars: true
|
|
|
|
provision_directory: /home/copr/provision
|
2022-01-12 15:29:34 +01:00
|
|
|
provision_user: copr
|
2018-04-26 14:50:45 +02:00
|
|
|
tags:
|
2021-10-08 13:10:44 +02:00
|
|
|
- always
|
2016-08-01 03:29:13 +02:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Copy image preparation scripts
|
2024-12-18 08:23:28 +10:00
|
|
|
ansible.builtin.copy: src="{{ item }}" dest=/usr/local/bin/
|
2019-08-14 12:57:58 +02:00
|
|
|
owner=root mode=755
|
|
|
|
with_fileglob:
|
2024-11-27 13:48:08 +10:00
|
|
|
- copr-builder-image-*.sh
|
2019-08-14 12:57:58 +02:00
|
|
|
when: devel|bool
|
2019-12-03 11:49:02 +01:00
|
|
|
tags:
|
|
|
|
- provision_config
|
2019-08-14 12:57:58 +02:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Testing fixture
|
2024-12-18 08:23:28 +10:00
|
|
|
ansible.builtin.copy: dest="/home/copr/cloud/ec2rc.variable" content=""
|
2019-08-05 19:16:50 +02:00
|
|
|
when: devel|bool
|
2014-10-10 12:35:14 +02:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Copy copr-be.conf
|
2025-01-13 12:24:19 +10:00
|
|
|
ansible.builtin.template: src="copr-be.conf.j2" dest=/etc/copr/copr-be.conf owner=root group=copr mode=640
|
2023-05-24 13:06:04 +02:00
|
|
|
notify:
|
2025-02-07 13:51:07 +01:00
|
|
|
- Restart copr-backend
|
2023-05-24 13:06:04 +02:00
|
|
|
tags:
|
|
|
|
- config
|
|
|
|
- copr_infrastructure_password
|
|
|
|
- provision_config
|
2014-10-10 12:35:14 +02:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Create messaging config directory
|
2024-12-17 15:31:55 +10:00
|
|
|
ansible.builtin.file: dest=/etc/copr/msgbuses state=directory owner=copr group=copr mode=0700
|
2020-08-11 07:59:55 +02:00
|
|
|
when: copr_messaging
|
2019-09-10 10:42:38 +02:00
|
|
|
tags:
|
|
|
|
- config
|
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Install messaging config
|
2025-01-13 12:24:19 +10:00
|
|
|
ansible.builtin.template: src="fedora-messaging.conf.j2"
|
2019-09-10 10:50:59 +02:00
|
|
|
dest=/etc/copr/msgbuses/fedora-messaging.conf
|
2019-09-10 10:42:38 +02:00
|
|
|
owner=copr group=copr mode=0600
|
2020-08-11 07:59:55 +02:00
|
|
|
when: copr_messaging
|
2019-09-10 10:42:38 +02:00
|
|
|
notify:
|
2025-02-07 13:51:07 +01:00
|
|
|
- Restart copr-backend
|
2019-09-10 10:42:38 +02:00
|
|
|
tags:
|
|
|
|
- config
|
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Copy sign.conf
|
2025-01-13 12:24:19 +10:00
|
|
|
ansible.builtin.template: src=sign.conf dest=/etc/sign.conf owner=root group=copr mode=640
|
2014-12-12 17:28:35 +01:00
|
|
|
tags:
|
|
|
|
- config
|
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Get owner for results dir
|
2015-05-19 11:50:03 +02:00
|
|
|
stat: path=/var/lib/copr/public_html
|
2017-11-21 21:38:54 +00:00
|
|
|
check_mode: no
|
2015-05-19 11:50:03 +02:00
|
|
|
register: copr_results_dir_st
|
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Change owner for results dir if it isn't copr
|
2024-12-19 16:42:30 +10:00
|
|
|
ansible.builtin.shell: "chown -R copr:copr /var/lib/copr/public_html"
|
2017-11-21 22:03:28 +00:00
|
|
|
when: '"copr" not in copr_results_dir_st.stat.pw_name'
|
2015-05-19 11:50:03 +02:00
|
|
|
|
2024-12-19 11:22:24 +10:00
|
|
|
- ansible.builtin.command: "ls -dZ /var/lib/copr/public_html/"
|
2015-05-19 11:50:03 +02:00
|
|
|
register: public_html_ls
|
2017-11-21 21:26:50 +00:00
|
|
|
check_mode: no
|
2024-11-27 13:48:08 +10:00
|
|
|
changed_when: false
|
2015-05-19 11:50:03 +02:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Update selinux context for results if root folder does not have proper type
|
2024-12-19 11:22:24 +10:00
|
|
|
ansible.builtin.command: "restorecon -vvRF /var/lib/copr/public_html/"
|
2017-11-21 21:21:25 +00:00
|
|
|
when: "public_html_ls is defined and 'copr_data_t' not in public_html_ls.stdout"
|
2015-05-19 11:50:03 +02:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
# - name: Install cert to access fed-cloud09
|
2020-03-02 21:26:42 +00:00
|
|
|
# # TODO: remove this when fed-cloud09 receives external cert
|
|
|
|
# import_tasks: install_cloud_cert.yml
|
2015-05-19 11:50:03 +02:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Enable and run copr-backend services
|
2017-04-13 01:37:21 +00:00
|
|
|
service: name="{{ item }}" enabled=yes state=started
|
2020-02-19 21:28:50 +01:00
|
|
|
when: not services_disabled|bool
|
2015-03-31 17:15:09 +02:00
|
|
|
with_items:
|
|
|
|
- redis # TODO: .service in copr-backend should depend on redis
|
2020-05-25 12:08:53 +02:00
|
|
|
- "{{ copr_backend_target }}"
|
2014-10-10 12:35:14 +02:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Access.redhat.com offline token file
|
2022-01-06 07:45:45 +01:00
|
|
|
set_fact: "rhn_offline_token_file=/var/lib/resallocserver/.access.redhat.com-copr-team"
|
|
|
|
tags:
|
|
|
|
- clean_rh_subscriptions
|
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Install offline token for copr-team in RHSM
|
2024-12-18 08:23:28 +10:00
|
|
|
ansible.builtin.copy:
|
2022-01-06 08:09:31 +01:00
|
|
|
content: "{{ copr_red_hat_subscription_offline_token }}"
|
2022-01-06 07:45:45 +01:00
|
|
|
dest: "{{ rhn_offline_token_file }}"
|
2024-11-27 13:48:08 +10:00
|
|
|
mode: "0600"
|
2022-01-06 07:45:45 +01:00
|
|
|
owner: resalloc
|
|
|
|
group: resalloc
|
|
|
|
tags:
|
|
|
|
- clean_rh_subscriptions
|
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Install cleanup-unused-vms script
|
2025-01-13 12:24:19 +10:00
|
|
|
ansible.builtin.template:
|
2022-01-06 07:45:45 +01:00
|
|
|
src: "{{ item }}"
|
|
|
|
dest: /usr/local/bin/{{ item }}
|
2024-11-27 13:48:08 +10:00
|
|
|
mode: "0755"
|
2022-01-06 08:04:17 +01:00
|
|
|
loop:
|
2022-01-06 07:45:45 +01:00
|
|
|
- cleanup-unused-vms-from-redis
|
|
|
|
- cleanup-unused-redhat-subscriptions
|
2019-12-13 14:44:10 +01:00
|
|
|
tags:
|
2022-01-06 07:45:45 +01:00
|
|
|
- clean_rh_subscriptions
|
2019-12-13 14:44:10 +01:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Setup crontab for VMs
|
2019-11-27 09:10:58 +01:00
|
|
|
cron: name="cleanup nova VMs periodically"
|
|
|
|
job="/usr/bin/cleanup_vm_nova.py"
|
|
|
|
minute="*/20"
|
|
|
|
user=copr
|
2022-01-05 18:13:57 +01:00
|
|
|
state=absent
|
2019-11-27 09:10:58 +01:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Setup crontab for cleaning up redis
|
2019-12-13 15:08:46 +01:00
|
|
|
cron: name="prune redis VM db periodically"
|
2019-12-13 15:38:07 +01:00
|
|
|
job="/usr/local/bin/cleanup-unused-vms-from-redis &>> /var/log/copr-backend/cleanup-redis-vms.log"
|
2019-12-13 15:08:46 +01:00
|
|
|
minute="50"
|
|
|
|
user=copr
|
2022-01-05 18:13:57 +01:00
|
|
|
state=absent
|
2019-12-13 15:08:46 +01:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Crontab for cleaning resalloc VMs
|
2020-05-25 11:03:58 +02:00
|
|
|
cron: name="cleanup nova VMs periodically"
|
2023-03-06 08:17:20 +01:00
|
|
|
job="true /usr/local/bin/cleanup-vms-aws-resalloc &>> /var/log/resallocserver/cron-cleanup-vms-aws.log"
|
2020-05-25 11:03:58 +02:00
|
|
|
minute="*/10"
|
|
|
|
user=resalloc
|
2023-03-06 08:17:20 +01:00
|
|
|
state=absent
|
2020-05-25 11:03:58 +02:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Crontab for cleaning-up unused subscriptions
|
2022-01-06 08:33:08 +01:00
|
|
|
cron: name="cleanup unused Red Hat subscribed systems"
|
|
|
|
job="/usr/local/bin/cleanup-unused-redhat-subscriptions &>> /var/log/resallocserver/cron-cleanup-rh-subscriptions.log"
|
|
|
|
minute="*/30"
|
2022-01-06 07:45:45 +01:00
|
|
|
user=resalloc
|
|
|
|
tags:
|
|
|
|
- clean_rh_subscriptions
|
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Setup monitoring
|
2017-10-17 17:37:03 +00:00
|
|
|
import_tasks: "monitoring.yml"
|
2018-03-02 09:54:22 +01:00
|
|
|
|
|
|
|
# Three tasks for handling our custom selinux module
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Ensure a directory exists for our custom selinux module
|
2024-12-17 15:31:55 +10:00
|
|
|
ansible.builtin.file: dest=/usr/local/share/copr state=directory
|
2018-03-02 09:54:22 +01:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Copy over our custom selinux module
|
2024-12-18 08:23:28 +10:00
|
|
|
ansible.builtin.copy: src=selinux/copr_rules.pp dest=/usr/local/share/copr/copr_rules.pp
|
2018-03-02 09:54:22 +01:00
|
|
|
register: selinux_module
|
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Install our custom selinux module
|
2024-12-19 11:22:24 +10:00
|
|
|
ansible.builtin.command: semodule -i /usr/local/share/copr/copr_rules.pp
|
2018-05-07 23:51:48 +00:00
|
|
|
when: selinux_module is changed
|
2018-12-27 15:28:07 +01:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Setup AWS access
|
2019-11-14 10:42:01 +01:00
|
|
|
import_tasks: "aws.yml"
|
|
|
|
tags:
|
|
|
|
- config
|
|
|
|
- aws_config
|
2021-08-05 14:47:27 +02:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Setup Pulp
|
2024-10-29 18:16:48 +01:00
|
|
|
import_tasks: "pulp.yml"
|
|
|
|
tags:
|
|
|
|
- config
|
|
|
|
- pulp
|
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Copr-ping-account
|
2021-08-05 14:47:27 +02:00
|
|
|
import_tasks: copr-ping.yml
|
|
|
|
tags: copr_ping
|
2022-05-20 16:31:54 -04:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Add lighttpd user to the resalloc group
|
2022-05-20 16:31:54 -04:00
|
|
|
user:
|
|
|
|
name: lighttpd
|
|
|
|
groups: resalloc
|
|
|
|
append: yes
|
2022-10-03 02:06:46 +02:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Install daily custom copr-backend crontab
|
2024-12-18 08:23:28 +10:00
|
|
|
ansible.builtin.copy: src=cron.daily/copr-backend dest=/etc/cron.daily/
|
2022-10-03 02:06:46 +02:00
|
|
|
mode=0755
|
|
|
|
tags: [cron_tasks]
|
2023-02-13 10:46:17 +01:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Configure options in node exporter
|
2023-02-13 10:46:17 +01:00
|
|
|
lineinfile:
|
|
|
|
path: /etc/default/prometheus-node-exporter
|
|
|
|
regexp: '^ARGS='
|
|
|
|
line: 'ARGS=--collector.systemd'
|
|
|
|
backrefs: yes
|
2025-02-07 13:51:07 +01:00
|
|
|
notify: Restart node_exporter
|
2023-02-13 10:46:17 +01:00
|
|
|
tags:
|
|
|
|
- prometheus_node_exporter
|