From 093a651fa2fd5f6a84caea7875fe49654d2404fd Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Tue, 12 Oct 2021 16:01:17 +0200 Subject: [PATCH] copr-backend: use copr-resalloc-aws-new wrapper We use this to create the AWS images, so why not to use this to start the VMs. This reverts commit 8f87caf6bb801ab6e82ce3efc232554b1958be0b. --- roles/copr/backend/tasks/resalloc.yml | 11 +++++ .../provision/copr-resalloc-aws-new.j2 | 27 +++++++++++++ .../backend/templates/resalloc/pools.yaml | 40 +------------------ 3 files changed, 40 insertions(+), 38 deletions(-) create mode 100644 roles/copr/backend/templates/provision/copr-resalloc-aws-new.j2 diff --git a/roles/copr/backend/tasks/resalloc.yml b/roles/copr/backend/tasks/resalloc.yml index 3a2dd05a95..e2e3a367e3 100644 --- a/roles/copr/backend/tasks/resalloc.yml +++ b/roles/copr/backend/tasks/resalloc.yml @@ -124,6 +124,17 @@ - provision_config - provision_config_resalloc_aws +- name: shortcuts around resalloc-aws-start + template: src="{{ roles_path }}/copr/backend/templates/provision/copr-resalloc-aws-new.j2" + dest="/usr/local/bin/copr-resalloc-aws-new-{{ item }}" + mode=0755 + with_items: + - aarch64 + - x86_64 + tags: + - provision_config + - provision_config_resalloc_aws + - name: f33 has outdated ansible community general plugins, use copr community.general.copr: state: enabled diff --git a/roles/copr/backend/templates/provision/copr-resalloc-aws-new.j2 b/roles/copr/backend/templates/provision/copr-resalloc-aws-new.j2 new file mode 100644 index 0000000000..ad5aa3ca89 --- /dev/null +++ b/roles/copr/backend/templates/provision/copr-resalloc-aws-new.j2 @@ -0,0 +1,27 @@ +#! /bin/sh + +cmd=( + /usr/bin/resalloc-aws-new + --aws-profile default + --ami {{ copr_builder_images.aws[item] }} + --ssh-key-name copr-builder + --security-group-id sg-0c3efdb681ced5d4f + --debug +{% for subnet in aws_arch_subnets[item] %} + --possible-subnet {{ subnet }} +{% endfor %} +{% if item == 'x86_64' %} + --instance-type i3.large +{% else %} + --instance-type a1.xlarge +{% endif %} + --tag FedoraGroup=copr + --tag CoprPurpose=builder + --tag CoprInstance={% if devel %}devel{% else %}production{% endif %} + --tag arch={{ item }} + --playbook /var/lib/resallocserver/provision/builderpb-aws.yml +) + +set -x +# execute the command + additional arguments +exec "${cmd[@]}" "$@" diff --git a/roles/copr/backend/templates/resalloc/pools.yaml b/roles/copr/backend/templates/resalloc/pools.yaml index 8c1512ff6a..058b54b3db 100644 --- a/roles/copr/backend/templates/resalloc/pools.yaml +++ b/roles/copr/backend/templates/resalloc/pools.yaml @@ -24,25 +24,7 @@ aws_x86_64_{% if spot %}spot{% else %}normal{% endif %}_{% if devel %}dev{% else - arch_s390x_emulated - arch_noarch - aws - cmd_new: > - /usr/bin/resalloc-aws-new -{% if spot %} - --spot-price 0.156 -{% endif %} - --aws-profile default - --ami {{ copr_builder_images.aws["x86_64"] }} - --ssh-key-name copr-builder - --security-group-id sg-0c3efdb681ced5d4f - --debug -{% for subnet in aws_arch_subnets["x86_64"] %} - --possible-subnet {{ subnet }} -{% endfor %} - --instance-type i3.large - --tag FedoraGroup=copr - --tag CoprPurpose=builder - --tag CoprInstance={% if devel %}devel{% else %}production{% endif %} - --tag arch=x86_64 - --playbook /var/lib/resallocserver/provision/builderpb-aws.yml + cmd_new: copr-resalloc-aws-new-x86_64{% if spot %} --spot-price 0.156{% endif %} cmd_delete: /usr/bin/resalloc-aws-delete --aws-profile default cmd_livecheck: "resalloc-check-vm-ip" cmd_release: "/var/lib/resallocserver/resalloc_provision/vm-release" @@ -62,25 +44,7 @@ aws_aarch64_{% if spot %}spot{% else %}normal{% endif %}_{% if devel %}dev{% els - arch_aarch64 - arch_aarch64_native - aws - cmd_new: > - /usr/bin/resalloc-aws-new -{% if spot %} - --spot-price 0.102 -{% endif %} - --aws-profile default - --ami {{ copr_builder_images.aws["aarch64"] }} - --ssh-key-name copr-builder - --security-group-id sg-0c3efdb681ced5d4f - --debug -{% for subnet in aws_arch_subnets["aarch64"] %} - --possible-subnet {{ subnet }} -{% endfor %} - --instance-type a1.xlarge - --tag FedoraGroup=copr - --tag CoprPurpose=builder - --tag CoprInstance={% if devel %}devel{% else %}production{% endif %} - --tag arch=aarch64 - --playbook /var/lib/resallocserver/provision/builderpb-aws.yml + cmd_new: copr-resalloc-aws-new-aarch64{% if spot %} --spot-price 0.102{% endif %} cmd_delete: /usr/bin/resalloc-aws-delete --aws-profile default cmd_livecheck: "resalloc-check-vm-ip" cmd_release: "/var/lib/resallocserver/resalloc_provision/vm-release"