From nobody Thu May 15 12:22:23 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 150842741263511.049445645920173; Thu, 19 Oct 2017 08:36:52 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8C5FE82106; Thu, 19 Oct 2017 15:36:51 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E7A6CD63CA; Thu, 19 Oct 2017 15:36:50 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9F0D1180BACF; Thu, 19 Oct 2017 15:36:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9JFanP2013822 for ; Thu, 19 Oct 2017 11:36:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2C817BA213; Thu, 19 Oct 2017 15:36:49 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-95.brq.redhat.com [10.40.204.95]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8A0D4BA233 for ; Thu, 19 Oct 2017 15:36:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8C5FE82106 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Andrea Bolognani To: libvir-list@redhat.com Date: Thu, 19 Oct 2017 17:36:30 +0200 Message-Id: <20171019153632.15016-5-abologna@redhat.com> In-Reply-To: <20171019153632.15016-1-abologna@redhat.com> References: <20171019153632.15016-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [libvirt-jenkins-ci PATCH 4/6] guests: Implement developer flavor X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 19 Oct 2017 15:36:52 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The developer is given key-based SSH access to the guest and granted passwordless sudo privilege for maximum convenience. Signed-off-by: Andrea Bolognani --- guests/group_vars/all/main.yml | 4 +++- guests/host_vars/libvirt-freebsd-10/main.yml | 1 + guests/host_vars/libvirt-freebsd-11/main.yml | 1 + guests/lcitool | 9 ++++++++- guests/site.yml | 5 +++++ guests/tasks/developer.yml | 21 +++++++++++++++++++++ 6 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 guests/tasks/developer.yml diff --git a/guests/group_vars/all/main.yml b/guests/group_vars/all/main.yml index d24af59..410077f 100644 --- a/guests/group_vars/all/main.yml +++ b/guests/group_vars/all/main.yml @@ -8,8 +8,10 @@ ansible_ssh_pass: root =20 jenkins_url: https://ci.centos.org/computer/{{ inventory_hostname }}/slave= -agent.jnlp =20 -# Paths to various command. Can be overridden on a per-host basis +# Paths to various commands and files that might be OS-dependent. Can +# be overridden on a per-host basis bash: /bin/bash java: /usr/bin/java make: /usr/bin/make sudo: /usr/bin/sudo +sudoers: /etc/sudoers diff --git a/guests/host_vars/libvirt-freebsd-10/main.yml b/guests/host_var= s/libvirt-freebsd-10/main.yml index 80d16d6..4f33c53 100644 --- a/guests/host_vars/libvirt-freebsd-10/main.yml +++ b/guests/host_vars/libvirt-freebsd-10/main.yml @@ -5,6 +5,7 @@ bash: /usr/local/bin/bash java: /usr/local/bin/java make: /usr/local/bin/gmake sudo: /usr/local/bin/sudo +sudoers: /usr/local/etc/sudoers =20 projects: - base diff --git a/guests/host_vars/libvirt-freebsd-11/main.yml b/guests/host_var= s/libvirt-freebsd-11/main.yml index 80d16d6..4f33c53 100644 --- a/guests/host_vars/libvirt-freebsd-11/main.yml +++ b/guests/host_vars/libvirt-freebsd-11/main.yml @@ -5,6 +5,7 @@ bash: /usr/local/bin/bash java: /usr/local/bin/java make: /usr/local/bin/gmake sudo: /usr/local/bin/sudo +sudoers: /usr/local/etc/sudoers =20 projects: - base diff --git a/guests/lcitool b/guests/lcitool index bf270f1..018640b 100755 --- a/guests/lcitool +++ b/guests/lcitool @@ -141,6 +141,8 @@ do_install() die "$PROGRAM_NAME: $GUEST: Missing configuration, guest must be i= nstalled manually" } =20 + load_config + # Load configuration files. Values don't get overwritten after being # set the first time, so loading the host-specific configuration before # the group configuration ensures overrides work as expected @@ -158,6 +160,11 @@ do_install() *kickstart*|*ks*) EXTRA_ARGS=3D"ks=3Dfile:/${INSTALL_CONFIG##*/}" = ;; esac =20 + # Only configure autostart for the guest for the ci flavor + test "$FLAVOR" =3D ci && { + AUTOSTART=3D"--autostart" + } + virt-install \ --name "$GUEST" \ --location "$INSTALL_URL" \ @@ -174,7 +181,7 @@ do_install() --sound none \ --initrd-inject "$INSTALL_CONFIG" \ --extra-args "console=3DttyS0 $EXTRA_ARGS" \ - --autostart \ + $AUTOSTART \ --wait 0 } =20 diff --git a/guests/site.yml b/guests/site.yml index 35e3220..76437bb 100644 --- a/guests/site.yml +++ b/guests/site.yml @@ -34,3 +34,8 @@ - projects is defined # jenkins is a pseudo-project - ( 'jenkins' in projects ) + + # Configure the developer account + - include: tasks/developer.yml + when: + - flavor =3D=3D 'developer' diff --git a/guests/tasks/developer.yml b/guests/tasks/developer.yml new file mode 100644 index 0000000..1dad8fc --- /dev/null +++ b/guests/tasks/developer.yml @@ -0,0 +1,21 @@ +--- +- name: Create developer user account + user: + name: developer + comment: Developer + password: $6$YEzeb0A3t7jn/IwW$oMPH0mpKPPeuABH3gKDom08rLccOKBm6CrXT/deB= sdP77MjBHxwHQ5EJM0MAc/sOsGKCNX0zjYYjlXP.KNUmP0 + shell: '{{ bash }}' + +- name: Configure ssh access for the developer + authorized_key: + user: developer + key: '{{ lookup("file", lookup("env", "HOME") + "/.ssh/id_rsa.pub") }}' + state: present + +- name: Grant passwordless sudo access to the developer + lineinfile: + path: '{{ sudoers }}' + line: 'developer ALL=3D(ALL) NOPASSWD: ALL' + state: present + backup: yes + validate: 'visudo -cf %s' --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list