From nobody Sat Jul 5 16:18:47 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; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1521563055448757.3421575143; Tue, 20 Mar 2018 09:24:15 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B4B0726AC41; Tue, 20 Mar 2018 16:24:13 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8E6867AF68; Tue, 20 Mar 2018 16:24:12 +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 7FAD84CA9B; Tue, 20 Mar 2018 16:24:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2KGO74Q022635 for ; Tue, 20 Mar 2018 12:24:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id CC46510B0F3D; Tue, 20 Mar 2018 16:24:07 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7390510B0F2A for ; Tue, 20 Mar 2018 16:24:07 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 20 Mar 2018 17:23:58 +0100 Message-Id: <20180320162400.5084-2-abologna@redhat.com> In-Reply-To: <20180320162400.5084-1-abologna@redhat.com> References: <20180320162400.5084-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 1/3] guests: Configure Jenkins agent based on secret availability 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 20 Mar 2018 16:24:14 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We're going to remove the 'jenkins' pseudo-project from the list of per-guest projects soon, so we need another way of deciding whether to install and configure the Jenkins agent. The availability of the Jenkins secret in the vault is a perfect candidate, and using it improves things in general because we can now store the information about which guests are part of the Jenkins setup in a single place instead of duplicating it. Signed-off-by: Andrea Bolognani Reviewed-by: Pavel Hrdina --- guests/site.yml | 3 --- guests/tasks/jenkins.yml | 7 +++++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/guests/site.yml b/guests/site.yml index 5f69cfd..8d32561 100644 --- a/guests/site.yml +++ b/guests/site.yml @@ -32,6 +32,3 @@ - include: tasks/jenkins.yml when: - flavor =3D=3D 'jenkins' - - projects is defined - # jenkins is a pseudo-project - - ( 'jenkins' in projects ) diff --git a/guests/tasks/jenkins.yml b/guests/tasks/jenkins.yml index 94c2404..10aeec7 100644 --- a/guests/tasks/jenkins.yml +++ b/guests/tasks/jenkins.yml @@ -6,6 +6,8 @@ - name: Look up Jenkins secret set_fact: jenkins_secret: '{{ vault.jenkins_secrets[inventory_hostname] }}' + when: + - vault.jenkins_secrets[inventory_hostname] is defined =20 - name: Download Jenkins agent get_url: @@ -14,6 +16,8 @@ owner: jenkins group: jenkins force: yes + when: + - jenkins_secret is defined =20 - name: Configure and enable Jenkins agent lineinfile: @@ -24,6 +28,7 @@ line: "nohup {{ su }} - jenkins -c '{{ java }} -jar /home/jenkins/slav= e.jar -jnlpUrl \"{{ jenkins_url }}\" -secret \"{{ jenkins_secret }}\"' >/va= r/log/jenkins.log 2>&1 &" insertbefore: '^exit .*$' when: + - jenkins_secret is defined - ansible_service_mgr !=3D 'systemd' =20 - name: Configure Jenkins agent @@ -31,6 +36,7 @@ src: templates/jenkins.service.j2 dest: /etc/systemd/system/jenkins.service when: + - jenkins_secret is defined - ansible_service_mgr =3D=3D 'systemd' =20 - name: Enable Jenkins agent @@ -39,4 +45,5 @@ enabled: yes daemon_reload: yes when: + - jenkins_secret is defined - ansible_service_mgr =3D=3D 'systemd' --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list