From 7f6ed7c3b6bd2db677925d781e8c4215b9f6a138 Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Wed, 8 Nov 2023 10:31:05 +0100 Subject: [PATCH] backend: drop playbooks from copr-backend payload These playbooks are terribly outdated, and were probably never used in reality. We already reference the official playbooks for Fedora Copr (Fedora Infrastructure) so users can take a look there. --- backend/conf/playbooks/ansible.cfg | 93 ----------- backend/conf/playbooks/builderpb_nova.yml | 44 ----- .../playbooks/files/mock/site-defaults.cfg | 156 ------------------ .../conf/playbooks/filter_plugins/os_nova.py | 33 ---- backend/conf/playbooks/inventory | 1 - .../playbooks/nova_cloud_vars.yml.example | 15 -- .../conf/playbooks/older/builderpb-i386.yml | 1 - .../conf/playbooks/older/builderpb-x86_64.yml | 101 ------------ .../conf/playbooks/older/builderpb.yml.ec2 | 74 --------- backend/conf/playbooks/older/terminatepb.yml | 19 --- .../conf/playbooks/older/terminatepb.yml.ec2 | 16 -- .../prepare_builder_base_image_pb.yml | 16 -- .../playbooks/provision_builder_tasks.yml | 84 ---------- backend/conf/playbooks/spawn_local.yml | 12 -- backend/conf/playbooks/spinup_nova_task.yml | 25 --- backend/conf/playbooks/terminate_local.yml | 6 - backend/conf/playbooks/terminatepb_nova.yml | 17 -- backend/copr-backend.spec | 4 - backend/docs/source/INSTALL.rst | 26 +-- 19 files changed, 4 insertions(+), 739 deletions(-) delete mode 100644 backend/conf/playbooks/ansible.cfg delete mode 100644 backend/conf/playbooks/builderpb_nova.yml delete mode 100644 backend/conf/playbooks/files/mock/site-defaults.cfg delete mode 100644 backend/conf/playbooks/filter_plugins/os_nova.py delete mode 100644 backend/conf/playbooks/inventory delete mode 100644 backend/conf/playbooks/nova_cloud_vars.yml.example delete mode 120000 backend/conf/playbooks/older/builderpb-i386.yml delete mode 100644 backend/conf/playbooks/older/builderpb-x86_64.yml delete mode 100644 backend/conf/playbooks/older/builderpb.yml.ec2 delete mode 100644 backend/conf/playbooks/older/terminatepb.yml delete mode 100644 backend/conf/playbooks/older/terminatepb.yml.ec2 delete mode 100644 backend/conf/playbooks/prepare_builder_base_image_pb.yml delete mode 100644 backend/conf/playbooks/provision_builder_tasks.yml delete mode 100644 backend/conf/playbooks/spawn_local.yml delete mode 100644 backend/conf/playbooks/spinup_nova_task.yml delete mode 100644 backend/conf/playbooks/terminate_local.yml delete mode 100644 backend/conf/playbooks/terminatepb_nova.yml diff --git a/backend/conf/playbooks/ansible.cfg b/backend/conf/playbooks/ansible.cfg deleted file mode 100644 index 6b8c6b8f5..000000000 --- a/backend/conf/playbooks/ansible.cfg +++ /dev/null @@ -1,93 +0,0 @@ -# config file for ansible -- http://ansible.github.com -# nearly all parameters can be overridden in ansible-playbook or with command line flags -# ansible will read ~/.ansible.cfg or /etc/ansible/ansible.cfg, whichever it finds first - -[defaults] - -# location of inventory file, eliminates need to specify -i - -hostfile = /home/copr/provision/inventory - -# location of ansible library, eliminates need to specify --module-path - -library = /home/copr/provision/library:/usr/share/ansible - -# default module name used in /usr/bin/ansible when -m is not specified - -module_name = command - -# home directory where temp files are stored on remote systems. Should -# almost always contain $HOME or be a directory writeable by all users - -remote_tmp = $HOME/.ansible/tmp - -# the default pattern for ansible-playbooks ("hosts:") - -pattern = * - -# the default number of forks (parallelism) to be used. Usually you -# can crank this up. - -forks=25 - -# the timeout used by various connection types. Usually this corresponds -# to an SSH timeout - -timeout=10 - -# when using --poll or "poll:" in an ansible playbook, and not specifying -# an explicit poll interval, use this interval - -poll_interval=15 - -# when specifying --sudo to /usr/bin/ansible or "sudo:" in a playbook, -# and not specifying "--sudo-user" or "sudo_user" respectively, sudo -# to this user account - -sudo_user=root - -# connection to use when -c is not specified - -#transport=paramiko -transport=ssh - -# this is needed for paramiko, ssh already have this said in .ssh/config -host_key_checking = False - -# remote SSH port to be used when --port or "port:" or an equivalent inventory -# variable is not specified. - -remote_port=22 - -# if set, always run /usr/bin/ansible commands as this user, and assume this value -# if "user:" is not set in a playbook. If not set, use the current Unix user -# as the default - -remote_user=root - -# if set, always use this private key file for authentication, same as if passing -# --private-key-file to ansible or ansible-playbook - -#private_key_file=/path/to/file - - -# additional plugin paths for non-core plugins - -action_plugins = /usr/lib/python2.7/site-packages/ansible/runner/action_plugins:/home/copr/provision/action_plugins/ - -private_key_file=/home/copr/.ssh/id_rsa - -[paramiko_connection] -record_host_keys=False - -# nothing to configure yet - -[ssh_connection] - -# if uncommented, sets the ansible ssh arguments to the following. Leaving off ControlPersist -# will result in poor performance, so use transport=paramiko on older platforms rather than -# removing it - -ssh_args=-o PasswordAuthentication=no -o ControlMaster=auto -o ControlPersist=60s - - diff --git a/backend/conf/playbooks/builderpb_nova.yml b/backend/conf/playbooks/builderpb_nova.yml deleted file mode 100644 index eac4652fa..000000000 --- a/backend/conf/playbooks/builderpb_nova.yml +++ /dev/null @@ -1,44 +0,0 @@ -- name: check/create instance - hosts: 127.0.0.1 - gather_facts: False - - vars_files: - - nova_cloud_vars.yml - - vars: - # _OS_AUTH_OPTS: "--os-auth-url {{OS_AUTH_URL}} --os-username {{OS_USERNAME}} --os-password {{OS_PASSWORD}} --os-tenant-name {{OS_TENANT_NAME}} --os-tenant-id {{OS_TENANT_ID}} " - - keypair: buildsys - max_spawn_time: 600 - spawning_vm_user: "fedora" - - # pass this options if you need to create new base image from snapshot - #prepare_base_image: True - - tasks: - - name: generate builder name - local_action: set_fact vm_name="Copr_builder_{{ 999999999 | random }}" - - - debug: msg="vm_name={{ vm_name }}" - - include: "spinup_nova_task.yml" - - - debug: msg="VM_IP={{ builder_ip }}" - - - name: wait for he host to be hot - local_action: wait_for host={{ builder_ip }} port=22 delay=1 timeout=600 - - - name: wait until ssh is available - local_action: shell false; until [ "$?" -eq "0" ]; do sleep 2; ssh -o PasswordAuthentication=no {{ spawning_vm_user|default('fedora') }}@{{ builder_ip }} 'echo foobar' 2>/dev/null; done - async: 600 - poll: 2 - - -- name: provision builder - hosts: builder_temp_group - gather_facts: False - sudo: True - user: fedora - - tasks: - - include: "provision_builder_tasks.yml" - diff --git a/backend/conf/playbooks/files/mock/site-defaults.cfg b/backend/conf/playbooks/files/mock/site-defaults.cfg deleted file mode 100644 index 15ebd3692..000000000 --- a/backend/conf/playbooks/files/mock/site-defaults.cfg +++ /dev/null @@ -1,156 +0,0 @@ -# mock defaults -# vim:tw=0:ts=4:sw=4:et: -# -# This config file is for site-specific default values that apply across all -# configurations. Options specified in this config file can be overridden in -# the individual mock config files. -# -# The site-defaults.cfg delivered by default has NO options set. Only set -# options here if you want to override the defaults. -# -# Entries in this file follow the same format as other mock config files. -# config_opts['foo'] = bar - -############################################################################# -# -# Things that we recommend you set in site-defaults.cfg: -# -# config_opts['basedir'] = '/var/lib/mock/' -# config_opts['cache_topdir'] = '/var/cache/mock' -# Note: the path pointed to by basedir and cache_topdir must be owned -# by group 'mock' and must have mode: g+rws -# config_opts['rpmbuild_timeout'] = 0 -# config_opts['use_host_resolv'] = True - -# You can configure log format to pull from logging.ini formats of these names: -# config_opts['build_log_fmt_name'] = "unadorned" -# config_opts['root_log_fmt_name'] = "detailed" -# config_opts['state_log_fmt_name'] = "state" -# -# mock will normally set up a minimal chroot /dev. -# If you want to use a pre-configured /dev, disable this and use the bind-mount -# plugin to mount your special /dev -# config_opts['internal_dev_setup'] = True -# -# internal_setarch defaults to 'True' if the python 'ctypes' package is -# available. It is in the python std lib on >= python 2.5. On older versions, -# it is available as an addon. On systems w/o ctypes, it will default to 'False' -# config_opts['internal_setarch'] = False -# -# the cleanup_on_* options allow you to automatically clean and remove the -# mock build directory, but only take effect if --resultdir is used. -# config_opts provides fine-grained control. cmdline only has big hammer -# -# config_opts['cleanup_on_success'] = 1 -# config_opts['cleanup_on_failure'] = 1 - -# if you want mock to automatically run createrepo on the rpms in your -# resultdir. -# config_opts['createrepo_on_rpms'] = False -# config_opts['createrepo_command'] = '/usr/bin/createrepo -d -q -x *.src.rpm' - -############################################################################# -# -# plugin related. Below are the defaults. Change to suit your site -# policy. site-defaults.cfg is a good place to do this. -# -# NOTE: Some of the caching options can theoretically affect build -# reproducability. Change with care. -# -config_opts['plugin_conf']['package_state_enable'] = False -config_opts['plugin_conf']['ccache_enable'] = False -# config_opts['plugin_conf']['ccache_opts']['max_cache_size'] = '4G' -# config_opts['plugin_conf']['ccache_opts']['compress'] = None -# config_opts['plugin_conf']['ccache_opts']['dir'] = "%(cache_topdir)s/%(root)s/ccache/" -config_opts['plugin_conf']['yum_cache_enable'] = False -# config_opts['plugin_conf']['yum_cache_opts']['max_age_days'] = 30 -# config_opts['plugin_conf']['yum_cache_opts']['dir'] = "%(cache_topdir)s/%(root)s/yum_cache/" -config_opts['plugin_conf']['root_cache_enable'] = False -# config_opts['plugin_conf']['root_cache_opts']['max_age_days'] = 15 -# config_opts['plugin_conf']['root_cache_opts']['dir'] = "%(cache_topdir)s/%(root)s/root_cache/" -# config_opts['plugin_conf']['root_cache_opts']['compress_program'] = "pigz" -# config_opts['plugin_conf']['root_cache_opts']['extension'] = ".gz" -# config_opts['plugin_conf']['root_cache_opts']['exclude_dirs'] = ["./proc", "./sys", "./dev", -# "./tmp/ccache", "./var/cache/yum" ] -# -# bind mount plugin is enabled by default but has no configured directories to -# mount -config_opts['plugin_conf']['bind_mount_enable'] = False -# config_opts['plugin_conf']['bind_mount_opts']['dirs'].append(('/host/path', '/bind/mount/path/in/chroot/' )) -# -# config_opts['plugin_conf']['tmpfs_enable'] = False -# config_opts['plugin_conf']['tmpfs_opts']['required_ram_mb'] = 1024 -# config_opts['plugin_conf']['tmpfs_opts']['max_fs_size'] = '512m' - -############################################################################# -# -# environment for chroot -# -# config_opts['environment']['TERM'] = 'vt100' -# config_opts['environment']['SHELL'] = '/bin/bash' -# config_opts['environment']['HOME'] = '/builddir' -# config_opts['environment']['HOSTNAME'] = 'mock' -# config_opts['environment']['PATH'] = '/usr/bin:/bin:/usr/sbin:/sbin' -# config_opts['environment']['PROMPT_COMMAND'] = 'echo -n ""' -# config_opts['environment']['LANG'] = os.environ.setdefault('LANG', 'en_US.UTF-8') -# config_opts['environment']['TZ'] = os.environ.setdefault('TZ', 'EST5EDT') - -############################################################################# -# -# Things that you can change, but we dont recommend it: -# config_opts['chroothome'] = '/builddir' -# config_opts['clean'] = True - -############################################################################# -# -# Things that must be adjusted if SCM integration is used: -# -# config_opts['scm'] = True -# config_opts['scm_opts']['method'] = 'git' -# config_opts['scm_opts']['cvs_get'] = 'cvs -d /srv/cvs co SCM_BRN SCM_PKG' -# config_opts['scm_opts']['git_get'] = 'git clone SCM_BRN git://localhost/SCM_PKG.git SCM_PKG' -# config_opts['scm_opts']['svn_get'] = 'svn co file:///srv/svn/SCM_PKG/SCM_BRN SCM_PKG' -# config_opts['scm_opts']['spec'] = 'SCM_PKG.spec' -# config_opts['scm_opts']['ext_src_dir'] = '/dev/null' -# config_opts['scm_opts']['write_tar'] = True -# config_opts['scm_opts']['git_timestamps'] = True - -# These options are also recognized but usually defined in cmd line -# with --scm-option package= --scm-option branch= -# config_opts['scm_opts']['package'] = 'mypkg' -# config_opts['scm_opts']['branch'] = 'master' - -############################################################################# -# -# Things that are best suited for individual chroot config files: -# -# MUST SET (in individual chroot cfg file): -# config_opts['root'] = 'name-of-yum-build-dir' -# config_opts['target_arch'] = 'i386' -# config_opts['yum.conf'] = '' -# config_opts['yum_common_opts'] = [] -# -# CAN SET, defaults usually work ok: -# config_opts['chroot_setup_cmd'] = 'install buildsys-build' -# config_opts['log_config_file'] = 'logging.ini' -# config_opts['more_buildreqs']['srpm_name-version-release'] = 'dependencies' -# config_opts['macros']['%Add_your_macro_name_here'] = "add macro value here" -# config_opts['files']['path/name/no/leading/slash'] = "put file contents here." -# config_opts['chrootuid'] = os.getuid() - -# If you change chrootgid, you must also change "mock" to the correct group -# name in this line of the mock PAM config: -# auth sufficient pam_succeed_if.so user ingroup mock use_uid quiet -# config_opts['chrootgid'] = grp.getgrnam("mock")[2] - -# config_opts['useradd'] = '/usr/sbin/useradd -m -u %(uid)s -g %(gid)s -d %(home)s -n %(user)s' # Fedora/RedHat -# -# Security related -# config_opts['no_root_shells'] = False -# -# Proxy settings (https_proxy, ftp_proxy, and no_proxy can also be set) -# config_opts['http_proxy'] = 'http://localhost:3128' - -config_opts['plugin_conf']['compress_logs_enable'] = True -config_opts['plugin_conf']['compress_logs_opts'] = {} -config_opts['plugin_conf']['compress_logs_opts']['command'] = "/usr/bin/gzip -9" diff --git a/backend/conf/playbooks/filter_plugins/os_nova.py b/backend/conf/playbooks/filter_plugins/os_nova.py deleted file mode 100644 index 4b28d6c02..000000000 --- a/backend/conf/playbooks/filter_plugins/os_nova.py +++ /dev/null @@ -1,33 +0,0 @@ -from novaclient.client import Client - -def nova_result_to_builder_ip(nova_result, network_name): - return nova_result["addresses"][network_name][0]["addr"] - - -def network_name_to_id(network_name, username, password, tenant_name, auth_url): - nt = Client('2', username, password, tenant_name, auth_url) - return nt.networks.find(label=network_name).id - - -def image_name_to_id(image_name, username, password, tenant_name, auth_url): - nt = Client('2', username, password, tenant_name, auth_url) - return nt.images.find(name=image_name).id - - -def flavor_name_to_id(flavor_name, username, password, tenant_name, auth_url): - nt = Client('2', username, password, tenant_name, auth_url) - return nt.flavors.find(name=flavor_name).id - - -class FilterModule(object): - def filters(self): - return { - "nova_result_to_builder_ip": nova_result_to_builder_ip, - # "flavor_id_to_name": flavor_id_to_name, - "flavor_name_to_id": flavor_name_to_id, - # "image_id_to_name": image_id_to_name, - "image_name_to_id": image_name_to_id, - "network_name_to_id": network_name_to_id, - # "network_id_to_name": network_id_to_name, - } - diff --git a/backend/conf/playbooks/inventory b/backend/conf/playbooks/inventory deleted file mode 100644 index 2fbb50c4a..000000000 --- a/backend/conf/playbooks/inventory +++ /dev/null @@ -1 +0,0 @@ -localhost diff --git a/backend/conf/playbooks/nova_cloud_vars.yml.example b/backend/conf/playbooks/nova_cloud_vars.yml.example deleted file mode 100644 index 843e0073b..000000000 --- a/backend/conf/playbooks/nova_cloud_vars.yml.example +++ /dev/null @@ -1,15 +0,0 @@ ---- -# fill with actual values or use as ansible template -OS_AUTH_URL: "{{ copr_nova_auth_url }}" - -OS_TENANT_ID: "{{ copr_nova_tenant_id }}" -OS_TENANT_NAME: "{{ copr_nova_tenant_name }}" - -OS_USERNAME: "{{ copr_nova_username }}" -OS_PASSWORD: "{{ copr_password }}" - - -image_name: "{{ copr_builder_image_name }}" -flavor_name: "{{ copr_builder_flavor_name }}" -network_name: "{{ copr_builder_network_name }}" -key_name: "{{ copr_builder_key_name }}" diff --git a/backend/conf/playbooks/older/builderpb-i386.yml b/backend/conf/playbooks/older/builderpb-i386.yml deleted file mode 120000 index b2162bd20..000000000 --- a/backend/conf/playbooks/older/builderpb-i386.yml +++ /dev/null @@ -1 +0,0 @@ -builderpb-x86_64.yml \ No newline at end of file diff --git a/backend/conf/playbooks/older/builderpb-x86_64.yml b/backend/conf/playbooks/older/builderpb-x86_64.yml deleted file mode 100644 index e9c69541b..000000000 --- a/backend/conf/playbooks/older/builderpb-x86_64.yml +++ /dev/null @@ -1,101 +0,0 @@ ---- -- name: check/create instance - hosts: localhost - user: copr - gather_facts: False - - vars: - - keypair: buildsys - - image: ami-0000000e - - instance_type: m1.builder - - security_group: builder - - OS_AUTH_URL: http://172.23.0.2:5000/v2.0 - - OS_TENANT_NAME: copr - - OS_TENANT_ID: {{ copr_tenant_id }} - - OS_USERNAME: msuchy - - OS_PASSWORD: {{ copr_nova_password }} - # rhel 6.4 2013-02-21 x86_64 - ami - - image_id: cba0c766-84ac-4048-b0f5-6d4000af62f8 - - tasks: - - - name: generate builder name - local_action: command echo "Copr builder {{ 999999999 | random }}" - register: vm_name - - - name: spin it up - local_action: nova_compute auth_url={{OS_AUTH_URL}} flavor_id=6 image_id={{ image_id }} key_name=buildsys login_password={{OS_PASSWORD}} login_tenant_name={{OS_TENANT_NAME}} login_username={{OS_USERNAME}} security_groups={{security_group}} wait=yes name="{{vm_name.stdout}}" - register: nova - - # should be able to use nova.private_ip, but it does not work with Fedora Cloud. - - debug: msg="IP={{ nova.info.addresses.vlannet_3[0].addr }}" - - - debug: msg="vm_name={{vm_name.stdout}}" - - - name: add it to the special group - local_action: add_host hostname={{ nova.info.addresses.vlannet_3[0].addr }} groupname=builder_temp_group - - - name: wait for the host to be hot - local_action: wait_for host={{ nova.info.addresses.vlannet_3[0].addr }} port=22 delay=5 timeout=600 - -- hosts: builder_temp_group - user: root - gather_facts: False - vars: - - files: files/ - - tasks: - - name: edit hostname to be instance name - action: shell hostname `curl -s http://169.254.169.254/2009-04-04/meta-data/instance-id` - - - name: install pkgs - action: yum state=present pkg={{ item }} - with_items: - - rsync - - openssh-clients - - libselinux-python - - libsemanage-python - - - name: add repos - action: copy src={{ files }}/{{ item }} dest=/etc/yum.repos.d/{{ item }} - with_items: - - builder.repo - - epel6.repo - - - name: install additional pkgs - action: yum state=present pkg={{ item }} - with_items: - - mock - - createrepo - - yum-utils - - pyliblzma - - - name: make sure newest rpm - action: yum name={{ item }} state=latest - with_items: - - rpm - - glib2 - - - yum: name=mock enablerepo=epel-testing state=latest - - - name: mockbuilder user - action: user name=mockbuilder groups=mock - - - name: mockbuilder .ssh - action: file state=directory path=/home/mockbuilder/.ssh mode=0700 owner=mockbuilder group=mockbuilder - - - name: mockbuilder authorized_keys - action: authorized_key user=mockbuilder key='{{ lookup('file', '/home/copr/provision/files/buildsys.pub') }}' - - - name: put updated mock configs into /etc/mock - action: copy src={{ files }}/mock/{{ item }} dest=/etc/mock - with_items: - - site-defaults.cfg - - epel-5-x86_64.cfg - - epel-5-i386.cfg - - fedora-20-x86_64.cfg - - fedora-20-i386.cfg - - epel-7-x86_64.cfg - - - lineinfile: dest=/etc/security/limits.conf line="* soft nofile 10240" insertafter=EOF - - lineinfile: dest=/etc/security/limits.conf line="* hard nofile 10240" insertafter=EOF diff --git a/backend/conf/playbooks/older/builderpb.yml.ec2 b/backend/conf/playbooks/older/builderpb.yml.ec2 deleted file mode 100644 index 72fa12f88..000000000 --- a/backend/conf/playbooks/older/builderpb.yml.ec2 +++ /dev/null @@ -1,74 +0,0 @@ ---- -- name: check/create instance - hosts: localhost - user: copr - gather_facts: False - - vars: - - keypair: buildsys - - image: ami-0000000e - - instance_type: m1.builder - - security_group: builder - - tasks: - - name: spin it up - local_action: ec2 keypair={{ keypair }} image={{ image }} type={{ instance_type }} wait=true group={{ security_group }} - register: inst_res - - - name: get its internal ip b/c openstack is sometimes stupid - local_action: shell euca-describe-instances {{ inst_res.instances[0].id }} | grep INSTANCE | cut -f 18 - register: int_ip - - - name: add it to the special group - local_action: add_host hostname={{ int_ip.stdout }} groupname=builder_temp_group - - - name: wait for the host to be hot - local_action: wait_for host={{ int_ip.stdout }} port=22 delay=5 timeout=600 - - - debug: msg="IP={{ int_ip.stdout }}" - - -- hosts: builder_temp_group - user: root - vars: - - files: files/ - - tasks: - - name: edit hostname to be instance name - action: shell hostname `curl -s http://169.254.169.254/2009-04-04/meta-data/instance-id` - - - name: add repos - action: copy src={{ files }}/{{ item }} dest=/etc/yum.repos.d/{{ item }} - with_items: - - builder.repo - - epel6.repo - - - name: install pkgs - action: yum state=present pkg={{ item }} - with_items: - - mock - - createrepo - - yum-utils - - rsync - - openssh-clients - - - name: make sure newest rpm - action: yum name=rpm state=latest - - - name: mockbuilder user - action: user name=mockbuilder groups=mock - - - name: mockbuilder .ssh - action: file state=directory path=/home/mockbuilder/.ssh mode=0700 owner=mockbuilder group=mockbuilder - - - name: mockbuilder authorized_keys - action: authorized_key user=mockbuilder key='$FILE({{ files }}/buildsys.pub)' - - - name: put updated mock configs into /etc/mock - action: copy src={{ files }}/mock/{{ item }} dest=/etc/mock - with_items: - - site-defaults.cfg - - epel-5-x86_64.cfg - - epel-5-i386.cfg - -- lineinfile: dest=/root/.bashrc line="ulimit -n 10240" insertafter=EOF diff --git a/backend/conf/playbooks/older/terminatepb.yml b/backend/conf/playbooks/older/terminatepb.yml deleted file mode 100644 index 155779bc6..000000000 --- a/backend/conf/playbooks/older/terminatepb.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -- name: terminate instance - hosts: all - user: root - gather_facts: False - - vars: - - OS_AUTH_URL: http://172.23.0.2:5000/v2.0 - - OS_TENANT_NAME: copr - - OS_USERNAME: msuchy - - OS_PASSWORD: {{ copr_nova_password }} - - tasks: - - name: terminate it - local_action: nova_compute auth_url={{OS_AUTH_URL}} login_password={{OS_PASSWORD}} login_tenant_name={{OS_TENANT_NAME}} login_username={{OS_USERNAME}} name="{{vm_name}}" state=absent - - - - diff --git a/backend/conf/playbooks/older/terminatepb.yml.ec2 b/backend/conf/playbooks/older/terminatepb.yml.ec2 deleted file mode 100644 index ea61bad00..000000000 --- a/backend/conf/playbooks/older/terminatepb.yml.ec2 +++ /dev/null @@ -1,16 +0,0 @@ ---- -- name: terminate instance - hosts: all - user: root - gather_facts: False - - tasks: - - name: find the instance id from the builder - action: command curl -s http://169.254.169.254/latest/meta-data/instance-id - register: instanceid - - - name: terminate it - local_action: command euca-terminate-instances {{ instanceid.stdout }} - - - diff --git a/backend/conf/playbooks/prepare_builder_base_image_pb.yml b/backend/conf/playbooks/prepare_builder_base_image_pb.yml deleted file mode 100644 index c5cc9754f..000000000 --- a/backend/conf/playbooks/prepare_builder_base_image_pb.yml +++ /dev/null @@ -1,16 +0,0 @@ -- hosts: localhost - gather_facts: False - tasks: - - local_action: add_host hostname={{ vm_ip }} groupname=builder_temp_group - -- hosts: builder_temp_group - user: fedora - sudo: true - gather_facts: True - vars: - - files: files/ - - prepare_base_image: True - - tasks: - - include: "provision_builder_tasks.yml" - diff --git a/backend/conf/playbooks/provision_builder_tasks.yml b/backend/conf/playbooks/provision_builder_tasks.yml deleted file mode 100644 index e115b01e3..000000000 --- a/backend/conf/playbooks/provision_builder_tasks.yml +++ /dev/null @@ -1,84 +0,0 @@ -- name: install pkgs - yum: state=present pkg={{ item }} - with_items: - - dnf - - mock - - mock-lvm - - createrepo - - yum-utils - - pyliblzma - - rsync - - openssh-clients - - rsync - - libselinux-python - - libsemanage-python - -- name: make sure newest rpm - # todo: replace with dnf after ansible 1.9 is available - yum: name={{ item }} state=latest - with_items: - - rpm - - glib2 - - ca-certificates - -- name: put updated mock configs into /etc/mock - copy: src=files/mock/{{ item }} dest=/etc/mock - with_items: - - site-defaults.cfg - -# ansible doesn't support simultaneously usage of async and with_* options -# it's not even planned for implementation, see https://github.com/ansible/ansible/issues/5841 -#- name: prepare caches -# when: prepare_base_image is defined -# async: 3600 -# command: mock -r {{ item }} --init -# with_items: -# - epel-5-i386 -# - epel-5-x86_64 -# - epel-6-i386 -# - epel-6-x86_64 -# - epel-7-x86_64 -# - fedora-20-i386 -# - fedora-20-x86_64 -# - fedora-21-i386 -# - fedora-21-x86_64 -# - fedora-22-i386 -# - fedora-22-x86_64 -# - fedora-rawhide-i386 -# - fedora-rawhide-x86_64 - - -- name: prepare cache - when: prepare_base_image is defined and prepare_base_image - async: 3600 - shell: "for i in epel-5-i386 epel-5-x86_64 epel-6-i386 epel-6-x86_64 epel-7-x86_64 fedora-20-i386 fedora-20-x86_64 fedora-21-i386 fedora-21-x86_64 fedora-22-i386 fedora-22-x86_64 fedora-rawhide-i386 fedora-rawhide-x86_64; do mock --init -r $i; done" - -- name: mockbuilder user - user: name=mockbuilder groups=mock - -- name: mockbuilder .ssh - file: state=directory path=/home/mockbuilder/.ssh mode=0700 owner=mockbuilder group=mockbuilder - -- name: mockbuilder authorized_keys - authorized_key: user=mockbuilder key='{{ lookup('file', '/home/copr/provision/files/buildsys.pub') }}' - -- name: root authorized_keys - authorized_key: user=root key='{{ lookup('file', '/home/copr/provision/files/buildsys.pub') }}' - -- lineinfile: dest=/etc/mock/fedora-rawhide-x86_64.cfg line="config_opts['package_manager'] = 'dnf'" state=absent -- lineinfile: dest=/etc/mock/fedora-rawhide-i386.cfg line="config_opts['package_manager'] = 'dnf'" state=absent - -- lineinfile: dest=/etc/security/limits.conf line="* soft nofile 10240" insertafter=EOF -- lineinfile: dest=/etc/security/limits.conf line="* hard nofile 10240" insertafter=EOF - -- name: Disable DNF makecache timer - systemd: - name: dnf-makecache.timer - state: stopped - enabled: no - -- name: Disable DNF makecache service - systemd: - name: dnf-makecache.service - state: stopped - enabled: no diff --git a/backend/conf/playbooks/spawn_local.yml b/backend/conf/playbooks/spawn_local.yml deleted file mode 100644 index 6bf2926ad..000000000 --- a/backend/conf/playbooks/spawn_local.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -- name: create instance - hosts: localhost - remote_user: root - gather_facts: False - tasks: - - name: generate builder name - local_action: command echo "Copr builder {{ 999999999 | random }}" - register: vm_name - - - debug: msg="IP=127.0.0.{{7 | random}}" - - debug: msg="vm_name={{vm_name.stdout}}" diff --git a/backend/conf/playbooks/spinup_nova_task.yml b/backend/conf/playbooks/spinup_nova_task.yml deleted file mode 100644 index dc4c1bda5..000000000 --- a/backend/conf/playbooks/spinup_nova_task.yml +++ /dev/null @@ -1,25 +0,0 @@ -- name: spin/ensure vm with nova_compute - local_action: - module: nova_compute - auth_url: "{{OS_AUTH_URL}}" - login_username: "{{OS_USERNAME}}" - login_password: "{{OS_PASSWORD}}" - login_tenant_name: "{{OS_TENANT_NAME}}" - name: "{{ vm_name }}" - image_id: "{{ image_name|image_name_to_id(OS_USERNAME, OS_PASSWORD, OS_TENANT_NAME, OS_AUTH_URL) }}" - wait_for: "{{ max_spawn_time }}" - flavor_id: "{{ flavor_name|flavor_name_to_id(OS_USERNAME, OS_PASSWORD, OS_TENANT_NAME, OS_AUTH_URL) }}" - security_groups: ssh-anywhere-coprdev,default,ssh-from-persistent-coprdev #,ssh-internal-persistent - key_name: "{{ key_name }}" - nics: - - net-id: "{{ network_name|network_name_to_id(OS_USERNAME, OS_PASSWORD, OS_TENANT_NAME, OS_AUTH_URL) }}" - register: nova - -# - debug: msg="{{ nova.info }}" - -- set_fact: builder_ip="{{ nova.info|nova_result_to_builder_ip(network_name) }}" - -- name: add builder ip to the special group - local_action: add_host hostname={{ builder_ip }} groupname=builder_temp_group - - diff --git a/backend/conf/playbooks/terminate_local.yml b/backend/conf/playbooks/terminate_local.yml deleted file mode 100644 index b5507b5f6..000000000 --- a/backend/conf/playbooks/terminate_local.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -- name: terminate instance - hosts: localhost - remote_user: root - gather_facts: False - # do nothing diff --git a/backend/conf/playbooks/terminatepb_nova.yml b/backend/conf/playbooks/terminatepb_nova.yml deleted file mode 100644 index 80794dec8..000000000 --- a/backend/conf/playbooks/terminatepb_nova.yml +++ /dev/null @@ -1,17 +0,0 @@ -- name: terminate instance - hosts: 127.0.0.1 - gather_facts: False - - vars_files: - - nova_cloud_vars.yml - - tasks: - - name: terminate nova_compute - local_action: - module: nova_compute - auth_url: "{{OS_AUTH_URL}}" - login_username: "{{OS_USERNAME}}" - login_password: "{{OS_PASSWORD}}" - login_tenant_name: "{{OS_TENANT_NAME}}" - name: "{{ copr_task.vm_name }}" - state: absent diff --git a/backend/copr-backend.spec b/backend/copr-backend.spec index 6ed98c9a5..452affd7c 100644 --- a/backend/copr-backend.spec +++ b/backend/copr-backend.spec @@ -174,8 +174,6 @@ install -d %{buildroot}%{_sysconfdir}/logstash.d install -d %{buildroot}%{_datadir}/logstash/patterns/ cp -a conf/logstash/lighttpd.pattern %{buildroot}%{_datadir}/logstash/patterns/lighttpd.pattern -cp -a conf/playbooks %{buildroot}%{_pkgdocdir}/ - install -d %{buildroot}%{_pkgdocdir}/examples/%{_sysconfdir}/logstash.d cp -a conf/logstash/copr_backend.conf %{buildroot}%{_pkgdocdir}/examples/%{_sysconfdir}/logstash.d/copr_backend.conf @@ -218,7 +216,6 @@ useradd -r -g copr -G lighttpd -s /bin/bash -c "COPR user" copr %config(noreplace) %{_sysconfdir}/logrotate.d/copr-backend %dir %{_pkgdocdir} %doc %{_pkgdocdir}/lighttpd -%doc %{_pkgdocdir}/playbooks %dir %{_sysconfdir}/copr %config(noreplace) %attr(0640, root, copr) %{_sysconfdir}/copr/copr-be.conf %{_unitdir}/*.service @@ -239,7 +236,6 @@ useradd -r -g copr -G lighttpd -s /bin/bash -c "COPR user" copr %doc %{_pkgdocdir}/ %exclude %{_pkgdocdir}/lighttpd -%exclude %{_pkgdocdir}/playbooks %changelog * Tue Aug 15 2023 Pavel Raiskup 1.172-1 diff --git a/backend/docs/source/INSTALL.rst b/backend/docs/source/INSTALL.rst index 06d84b5db..da7970b29 100644 --- a/backend/docs/source/INSTALL.rst +++ b/backend/docs/source/INSTALL.rst @@ -8,30 +8,12 @@ Get rpm either from upstream copr: https://copr.fedorainfracloud.org/coprs/g/cop dnf copr enable @copr/copr dnf install -y copr-backend copr-selinux -or checkout git repo and build with rpkg:: +2. Configure Resalloc server for automatic VM allocation (either on the same + machine, or other) :: - dnf install rpkg + dnf install resalloc-server - git clone https://github.com/fedora-copr/copr.git - cd copr - - rpkg --path backend spec --outdir /tmp/rpkg - rpkg --path selinux spec --outdir /tmp/rpkg - rpkg --path python spec --outdir /tmp/rpkg - - dnf builddep /tmp/rpkg/copr-backend.spec - dnf builddep /tmp/rpkg/copr-selinux.spec - dnf builddep /tmp/rpkg/python-copr.spec - - cd backend && rpkg local && cd .. - cd selinux && rpkg local && cd .. - cd python && rpkg local && cd .. - - dnf install -C - - -2. Prepare ansible playbooks to spawn and terminate VM builders using your VM provider. - You could find some inspiration in ``backend/conf/playbooks/``. + Edit ``/etc/resallocserver/*.yaml`` files to configure. 3. Edit ``/etc/copr/copr-be.conf`` to reflect your setup. Look at example ``backend/conf/copr-be.conf.example``.