From nobody Thu May 15 11:47:56 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 1508169748423797.6358921693868; Mon, 16 Oct 2017 09:02:28 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C8E7168B5; Mon, 16 Oct 2017 16:02:26 +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 81C5E18034; Mon, 16 Oct 2017 16:02:26 +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 473DA62CF0; Mon, 16 Oct 2017 16:02:26 +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 v9GG2JMU026419 for ; Mon, 16 Oct 2017 12:02:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id BB4B45D6A9; Mon, 16 Oct 2017 16:02:19 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.219]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 435FD6292A for ; Mon, 16 Oct 2017 16:02:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C8E7168B5 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Andrea Bolognani To: libvir-list@redhat.com Date: Mon, 16 Oct 2017 18:02:05 +0200 Message-Id: <20171016160208.20112-3-abologna@redhat.com> In-Reply-To: <20171016160208.20112-1-abologna@redhat.com> References: <20171016160208.20112-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 2/5] ansible: Introduce the 'manage' tool 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 16 Oct 2017 16:02:27 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This script replaces the existing Makefile, and will be extended to provide more functionality in future commits. Signed-off-by: Andrea Bolognani --- ansible/Makefile | 9 --------- ansible/manage | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 57 insertions(+), 9 deletions(-) delete mode 100644 ansible/Makefile create mode 100755 ansible/manage diff --git a/ansible/Makefile b/ansible/Makefile deleted file mode 100644 index 6af7ae3..0000000 --- a/ansible/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -all: - -site: - @ansible-playbook site.yml - -clean: - @rm -f *.retry log - -.PHONY: all site clean diff --git a/ansible/manage b/ansible/manage new file mode 100755 index 0000000..46bec6c --- /dev/null +++ b/ansible/manage @@ -0,0 +1,57 @@ +#!/bin/sh + +PROGRAM_NAME=3D"$0" + +# ------------------- +# Utility functions +# ------------------- + +# die MESSAGE +# +# Abort the program after displaying $MESSAGE on standard error. +die() { + echo "$1" >&2 + exit 1 +} + +# ---------------------- +# User-visible actions +# ---------------------- + +do_help() { + echo "\ +Usage: $PROGRAM_NAME ACTION [OPTIONS] + +Actions: + list List known guests + prepare GUEST Prepare or update GUEST. Can be run as many times as ne= eded + update GUEST Alias for prepare + help Display this help" +} + +do_list() { + INVENTORY=3D$(grep "^inventory\\s*=3D" ansible.cfg 2>/dev/null | sed "= s/^.*=3D\\s*//g") + INVENTORY=3D${INVENTORY:-/etc/ansible/hosts} + + grep -v '^\[' "$INVENTORY" | sort -u +} + +do_prepare() { + GUEST=3D"$1" + + test "$GUEST" || { + die "Usage: $PROGRAM_NAME prepare GUEST" + } + do_list | grep -q "$GUEST" || { + die "$PROGRAM_NAME: $GUEST: Unknown guest" + } + + ansible-playbook -l "$GUEST" site.yml +} + +case "$1" in + list) do_list ;; + prepare|update) do_prepare "$2" ;; + *help) do_help ;; + *) die "Usage: $PROGRAM_NAME ACTION [OPTIONS]" ;; +esac --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list