From nobody Sun Apr 28 17:03:54 2024 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 1532017942554586.3535499672545; Thu, 19 Jul 2018 09:32:22 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6A649811BF; Thu, 19 Jul 2018 16:32:20 +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 B8B263001648; Thu, 19 Jul 2018 16:32:19 +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 2572F24600; Thu, 19 Jul 2018 16:32:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6JGWG62003713 for ; Thu, 19 Jul 2018 12:32:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0B8041C5B7; Thu, 19 Jul 2018 16:32:16 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A06D11C5B8 for ; Thu, 19 Jul 2018 16:32:15 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Thu, 19 Jul 2018 18:32:01 +0200 Message-Id: <20180719163208.23126-2-abologna@redhat.com> In-Reply-To: <20180719163208.23126-1-abologna@redhat.com> References: <20180719163208.23126-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 1/8] lcitool: Make the script location-independent 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.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 19 Jul 2018 16:32:21 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Up until now, the only way to run lcitool has been from the same directory it lives. After this patch, the script is able to figure out its own location and adjust all paths accordingly. Suggested-by: Katerina Koukiou Signed-off-by: Andrea Bolognani Reviewed-by: Erik Skultety --- guests/lcitool | 61 +++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 48 insertions(+), 13 deletions(-) diff --git a/guests/lcitool b/guests/lcitool index 22b08dd..5526a27 100755 --- a/guests/lcitool +++ b/guests/lcitool @@ -43,6 +43,10 @@ class Error(Exception): =20 class Util: =20 + @staticmethod + def get_base(): + return os.path.dirname(os.path.abspath(__file__)) + @staticmethod def mksalt(): alphabeth =3D string.ascii_letters + string.digits @@ -83,8 +87,8 @@ class Config: try: config_dir =3D os.environ["XDG_CONFIG_HOME"] except KeyError: - config_dir =3D os.path.join(os.environ["HOME"], ".config/") - config_dir =3D os.path.join(config_dir, "lcitool/") + config_dir =3D os.path.join(os.environ["HOME"], ".config") + config_dir =3D os.path.join(config_dir, "lcitool") =20 # Create the directory if it doesn't already exist if not os.path.exists(config_dir): @@ -179,13 +183,18 @@ class Config: class Inventory: =20 def __init__(self): + base =3D Util.get_base() + ansible_cfg_path =3D os.path.join(base, "ansible.cfg") + try: parser =3D configparser.SafeConfigParser() - parser.read("./ansible.cfg") + parser.read(ansible_cfg_path) inventory_path =3D parser.get("defaults", "inventory") except Exception: raise Error("Can't find inventory location in ansible.cfg") =20 + inventory_path =3D os.path.join(base, inventory_path) + self._facts =3D {} try: # We can only deal with trivial inventories, but that's @@ -217,12 +226,19 @@ class Inventory: facts[fact] =3D some_facts[fact] =20 def _read_all_facts(self, host): + base =3D Util.get_base() + + sources =3D [ + os.path.join(base, "group_vars", "all"), + os.path.join(base, "host_vars", host), + ] + facts =3D {} =20 # We load from group_vars/ first and host_vars/ second, sorting # files alphabetically; doing so should result in our view of # the facts matching Ansible's - for source in ["./group_vars/all/", "./host_vars/{}/".format(host)= ]: + for source in sources: for item in sorted(os.listdir(source)): yaml_path =3D os.path.join(source, item) if not os.path.isfile(yaml_path): @@ -243,15 +259,20 @@ class Inventory: class Projects: =20 def __init__(self): + base =3D Util.get_base() + + mappings_path =3D os.path.join(base, "vars", "mappings.yml") + try: - with open("./vars/mappings.yml", "r") as infile: + with open(mappings_path, "r") as infile: mappings =3D yaml.load(infile) self._mappings =3D mappings["mappings"] except Exception: raise Error("Can't load mappings") =20 + source =3D os.path.join(base, "vars", "projects") + self._packages =3D {} - source =3D "./vars/projects/" for item in os.listdir(source): yaml_path =3D os.path.join(source, item) if not os.path.isfile(yaml_path): @@ -338,6 +359,8 @@ class Application: print(project) =20 def _action_install(self, hosts, _projects): + base =3D Util.get_base() + flavor =3D self._config.get_flavor() =20 for host in self._inventory.expand_pattern(hosts): @@ -358,6 +381,8 @@ class Application: facts["install_network"], ) =20 + install_config =3D os.path.join(base, facts["install_config"]) + # preseed files must use a well-known name to be picked up by # d-i; for kickstart files, we can use whatever name we please # but we need to point anaconda in the right direction through @@ -381,7 +406,7 @@ class Application: "--graphics", "none", "--console", "pty", "--sound", "none", - "--initrd-inject", facts["install_config"], + "--initrd-inject", install_config, "--extra-args", extra_arg, "--wait", "0", ] @@ -396,28 +421,38 @@ class Application: raise Error("Failed to install '{}'".format(host)) =20 def _action_update(self, hosts, _projects): + base =3D Util.get_base() + flavor =3D self._config.get_flavor() vault_pass_file =3D self._config.get_vault_password_file() root_pass_file =3D self._config.get_root_password_file() =20 ansible_hosts =3D ",".join(self._inventory.expand_pattern(hosts)) =20 + ansible_cfg_path =3D os.path.join(base, "ansible.cfg") + playbook_path =3D os.path.join(base, "site.yml") + extra_vars =3D "flavor=3D{} root_password_file=3D{}".format( flavor, root_pass_file, ) =20 - cmd =3D ["ansible-playbook"] + cmd =3D [ + "ansible-playbook", + "--limit", ansible_hosts, + "--extra-vars", extra_vars, + ] =20 # Provide the vault password if available if vault_pass_file is not None: cmd +=3D ["--vault-password-file", vault_pass_file] =20 - cmd +=3D [ - "--limit", ansible_hosts, - "--extra-vars", extra_vars, - "./site.yml", - ] + cmd +=3D [playbook_path] + + # We need to point Ansible to the correct configuration file, + # and for some reason this has to be done using the environment + # rather than through the command line + os.environ["ANSIBLE_CONFIG"] =3D ansible_cfg_path =20 try: subprocess.check_call(cmd) --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 17:03:54 2024 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 1532017952457942.1872662334463; Thu, 19 Jul 2018 09:32:32 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E72515F784; Thu, 19 Jul 2018 16:32:30 +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 AD050308BDB8; Thu, 19 Jul 2018 16:32:30 +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 62B6C14B0C; Thu, 19 Jul 2018 16:32:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6JGWGGo003718 for ; Thu, 19 Jul 2018 12:32:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id A71B51C5B7; Thu, 19 Jul 2018 16:32:16 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 48C361C5B8 for ; Thu, 19 Jul 2018 16:32:16 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Thu, 19 Jul 2018 18:32:02 +0200 Message-Id: <20180719163208.23126-3-abologna@redhat.com> In-Reply-To: <20180719163208.23126-1-abologna@redhat.com> References: <20180719163208.23126-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 2/8] lcitool: Use JSON to pass extra-vars 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.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 19 Jul 2018 16:32:31 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We're going to add more extra-vars later on, and they will be in some cases more complex than simple strings; using JSON allows us to do that and also be less verbose. Signed-off-by: Andrea Bolognani Reviewed-by: Erik Skultety --- guests/lcitool | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/guests/lcitool b/guests/lcitool index 5526a27..4acb076 100755 --- a/guests/lcitool +++ b/guests/lcitool @@ -19,6 +19,7 @@ import argparse import crypt import fnmatch +import json import os import random import string @@ -432,10 +433,10 @@ class Application: ansible_cfg_path =3D os.path.join(base, "ansible.cfg") playbook_path =3D os.path.join(base, "site.yml") =20 - extra_vars =3D "flavor=3D{} root_password_file=3D{}".format( - flavor, - root_pass_file, - ) + extra_vars =3D json.dumps({ + "root_password_file": root_pass_file, + "flavor": flavor, + }) =20 cmd =3D [ "ansible-playbook", --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 17:03:54 2024 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 1532017943661656.1115180623538; Thu, 19 Jul 2018 09:32:23 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BE44C30832F5; Thu, 19 Jul 2018 16:32:21 +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 738B8194A9; Thu, 19 Jul 2018 16:32:21 +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 1783524602; Thu, 19 Jul 2018 16:32:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6JGWH4P003727 for ; Thu, 19 Jul 2018 12:32:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4DFE51C5B7; Thu, 19 Jul 2018 16:32:17 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E3F731C5BC for ; Thu, 19 Jul 2018 16:32:16 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Thu, 19 Jul 2018 18:32:03 +0200 Message-Id: <20180719163208.23126-4-abologna@redhat.com> In-Reply-To: <20180719163208.23126-1-abologna@redhat.com> References: <20180719163208.23126-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 3/8] lcitool: Pass base and playbook_base to Ansible 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Thu, 19 Jul 2018 16:32:22 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We want to get rid of relative paths in playbooks and tasks, and in order to do that we have to provide Ansible with some more information. base is the directory where lcitool lives, and playbook_base is the directory where a playbook should look for its private resources: they match for the time being, but that will no longer be the case very shortly. Signed-off-by: Andrea Bolognani Reviewed-by: Erik Skultety --- guests/lcitool | 5 ++++- guests/site.yml | 26 +++++++++++++------------- guests/tasks/base.yml | 6 +++--- guests/tasks/jenkins.yml | 4 ++-- guests/tasks/packages.yml | 2 +- guests/tasks/users.yml | 4 ++-- 6 files changed, 25 insertions(+), 22 deletions(-) diff --git a/guests/lcitool b/guests/lcitool index 4acb076..206a014 100755 --- a/guests/lcitool +++ b/guests/lcitool @@ -431,9 +431,12 @@ class Application: ansible_hosts =3D ",".join(self._inventory.expand_pattern(hosts)) =20 ansible_cfg_path =3D os.path.join(base, "ansible.cfg") - playbook_path =3D os.path.join(base, "site.yml") + playbook_base =3D base + playbook_path =3D os.path.join(playbook_base, "site.yml") =20 extra_vars =3D json.dumps({ + "base": base, + "playbook_base": playbook_base, "root_password_file": root_pass_file, "flavor": flavor, }) diff --git a/guests/site.yml b/guests/site.yml index 063b0c6..4de759b 100644 --- a/guests/site.yml +++ b/guests/site.yml @@ -6,33 +6,33 @@ tasks: =20 # Bootstrap Ansible itself - - include: tasks/bootstrap.yml + - include: '{{ playbook_base }}/tasks/bootstrap.yml' =20 - hosts: all remote_user: root =20 vars_files: - - vars/mappings.yml + - '{{ base }}/vars/mappings.yml' =20 tasks: =20 # Prepare environment. None of the actions performed here might # depend on packages being installed - - include: tasks/base.yml + - include: '{{ playbook_base }}/tasks/base.yml' =20 # Install base packages - - include: tasks/packages.yml + - include: '{{ playbook_base }}/tasks/packages.yml' vars: project: base =20 # Remove blacklisted packages - - include: tasks/packages.yml + - include: '{{ playbook_base }}/tasks/packages.yml' vars: project: blacklist state: absent =20 # Install build dependencies for each project - - include: tasks/packages.yml + - include: '{{ playbook_base }}/tasks/packages.yml' with_items: '{{ projects }}' loop_control: @@ -41,20 +41,20 @@ - projects is defined =20 # Install packages needed for the Jenkins agent - - include: tasks/packages.yml + - include: '{{ playbook_base }}/tasks/packages.yml' vars: project: jenkins when: - flavor =3D=3D "jenkins" =20 # Configure environment. Needs to happen after installing packages - - include: tasks/paths.yml - - include: tasks/bootloader.yml - - include: tasks/services.yml - - include: tasks/kludges.yml - - include: tasks/users.yml + - include: '{{ playbook_base }}/tasks/paths.yml' + - include: '{{ playbook_base }}/tasks/bootloader.yml' + - include: '{{ playbook_base }}/tasks/services.yml' + - include: '{{ playbook_base }}/tasks/kludges.yml' + - include: '{{ playbook_base }}/tasks/users.yml' =20 # Configure the Jenkins agent - - include: tasks/jenkins.yml + - include: '{{ playbook_base }}/tasks/jenkins.yml' when: - flavor =3D=3D 'jenkins' diff --git a/guests/tasks/base.yml b/guests/tasks/base.yml index 6310d96..11f600f 100644 --- a/guests/tasks/base.yml +++ b/guests/tasks/base.yml @@ -25,7 +25,7 @@ =20 - name: Enable jessie-backports repository template: - src: templates/jessie-backports.sources.j2 + src: '{{ playbook_base }}/templates/jessie-backports.sources.j2' dest: /etc/apt/sources.list.d/jessie-backports.list owner: root group: root @@ -36,7 +36,7 @@ =20 - name: Configure APT pinning for jessie-backports template: - src: templates/jessie-backports.preferences.j2 + src: '{{ playbook_base }}/templates/jessie-backports.preferences.j2' dest: /etc/apt/preferences.d/jessie-backports owner: root group: root @@ -47,7 +47,7 @@ =20 - name: Enable fedora-rawhide-kernel-nodebug repository template: - src: templates/fedora-rawhide-kernel-nodebug.repo.j2 + src: '{{ playbook_base }}/templates/fedora-rawhide-kernel-nodebug.repo= .j2' dest: /etc/yum.repos.d/fedora-rawhide-kernel-nodebug.repo owner: root group: root diff --git a/guests/tasks/jenkins.yml b/guests/tasks/jenkins.yml index 9076c34..479e5d6 100644 --- a/guests/tasks/jenkins.yml +++ b/guests/tasks/jenkins.yml @@ -1,7 +1,7 @@ --- - name: Open vault include_vars: - file: vars/vault.yml + file: '{{ base }}/vars/vault.yml' =20 - name: Look up Jenkins secret set_fact: @@ -32,7 +32,7 @@ =20 - name: Configure Jenkins agent template: - src: templates/jenkins.service.j2 + src: '{{ playbook_base }}/templates/jenkins.service.j2' dest: /etc/systemd/system/jenkins.service when: - jenkins_secret is defined diff --git a/guests/tasks/packages.yml b/guests/tasks/packages.yml index 718ef47..a725b07 100644 --- a/guests/tasks/packages.yml +++ b/guests/tasks/packages.yml @@ -7,7 +7,7 @@ =20 - name: '{{ project }}: Load variables' include_vars: - file: 'vars/projects/{{ project }}.yml' + file: '{{ base }}/vars/projects/{{ project }}.yml' =20 - set_fact: temp: {} diff --git a/guests/tasks/users.yml b/guests/tasks/users.yml index dd6c39d..ec7f798 100644 --- a/guests/tasks/users.yml +++ b/guests/tasks/users.yml @@ -61,7 +61,7 @@ =20 - name: '{{ flavor }}: Configure ccache' template: - src: templates/ccache.conf.j2 + src: '{{ playbook_base }}/templates/ccache.conf.j2' dest: /home/{{ flavor }}/.ccache/ccache.conf owner: '{{ flavor }}' group: '{{ flavor }}' @@ -96,7 +96,7 @@ =20 - name: '{{ flavor }}: Create shell profile' template: - src: templates/{{ item }}.j2 + src: '{{ playbook_base }}/templates/{{ item }}.j2' dest: /home/{{ flavor }}/.{{ item }} owner: '{{ flavor }}' group: '{{ flavor }}' --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 17:03:54 2024 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 1532017953188154.7599693392184; Thu, 19 Jul 2018 09:32:33 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E928B5F7AA; Thu, 19 Jul 2018 16:32:30 +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 B2602308BDB9; Thu, 19 Jul 2018 16:32:30 +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 64D0314B0D; Thu, 19 Jul 2018 16:32:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6JGWIvo003735 for ; Thu, 19 Jul 2018 12:32:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id E97C71C5B7; Thu, 19 Jul 2018 16:32:17 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8AEA91C5B8 for ; Thu, 19 Jul 2018 16:32:17 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Thu, 19 Jul 2018 18:32:04 +0200 Message-Id: <20180719163208.23126-5-abologna@redhat.com> In-Reply-To: <20180719163208.23126-1-abologna@redhat.com> References: <20180719163208.23126-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 4/8] guests: Move update playbook and related resources 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.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 19 Jul 2018 16:32:31 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This has two advantages: it unclutters the top-level directory, and opens the door for adding more playbooks down the line without turning it into a mess. Thanks to the changes made earlier, moving the playbook is almost entirely transparent to lcitool. Signed-off-by: Andrea Bolognani Reviewed-by: Erik Skultety --- guests/lcitool | 4 ++-- guests/{site.yml =3D> playbooks/update/main.yml} | 0 guests/{ =3D> playbooks/update}/tasks/base.yml | 0 guests/{ =3D> playbooks/update}/tasks/bootloader.yml | 0 guests/{ =3D> playbooks/update}/tasks/bootstrap.yml | 0 guests/{ =3D> playbooks/update}/tasks/jenkins.yml | 0 guests/{ =3D> playbooks/update}/tasks/kludges.yml | 0 guests/{ =3D> playbooks/update}/tasks/packages.yml | 0 guests/{ =3D> playbooks/update}/tasks/paths.yml | 0 guests/{ =3D> playbooks/update}/tasks/services.yml | 0 guests/{ =3D> playbooks/update}/tasks/users.yml | 0 guests/{ =3D> playbooks/update}/templates/bash_profile.j2 | 0 guests/{ =3D> playbooks/update}/templates/bashrc.j2 | 0 guests/{ =3D> playbooks/update}/templates/ccache.conf.j2 | 0 .../update}/templates/fedora-rawhide-kernel-nodebug.repo.j2 | 0 guests/{ =3D> playbooks/update}/templates/jenkins.service.j2 | 0 .../update}/templates/jessie-backports.preferences.j2 | 0 .../update}/templates/jessie-backports.sources.j2 | 0 18 files changed, 2 insertions(+), 2 deletions(-) rename guests/{site.yml =3D> playbooks/update/main.yml} (100%) rename guests/{ =3D> playbooks/update}/tasks/base.yml (100%) rename guests/{ =3D> playbooks/update}/tasks/bootloader.yml (100%) rename guests/{ =3D> playbooks/update}/tasks/bootstrap.yml (100%) rename guests/{ =3D> playbooks/update}/tasks/jenkins.yml (100%) rename guests/{ =3D> playbooks/update}/tasks/kludges.yml (100%) rename guests/{ =3D> playbooks/update}/tasks/packages.yml (100%) rename guests/{ =3D> playbooks/update}/tasks/paths.yml (100%) rename guests/{ =3D> playbooks/update}/tasks/services.yml (100%) rename guests/{ =3D> playbooks/update}/tasks/users.yml (100%) rename guests/{ =3D> playbooks/update}/templates/bash_profile.j2 (100%) rename guests/{ =3D> playbooks/update}/templates/bashrc.j2 (100%) rename guests/{ =3D> playbooks/update}/templates/ccache.conf.j2 (100%) rename guests/{ =3D> playbooks/update}/templates/fedora-rawhide-kernel-nod= ebug.repo.j2 (100%) rename guests/{ =3D> playbooks/update}/templates/jenkins.service.j2 (100%) rename guests/{ =3D> playbooks/update}/templates/jessie-backports.preferen= ces.j2 (100%) rename guests/{ =3D> playbooks/update}/templates/jessie-backports.sources.= j2 (100%) diff --git a/guests/lcitool b/guests/lcitool index 206a014..2cfb0e9 100755 --- a/guests/lcitool +++ b/guests/lcitool @@ -431,8 +431,8 @@ class Application: ansible_hosts =3D ",".join(self._inventory.expand_pattern(hosts)) =20 ansible_cfg_path =3D os.path.join(base, "ansible.cfg") - playbook_base =3D base - playbook_path =3D os.path.join(playbook_base, "site.yml") + playbook_base =3D os.path.join(base, "playbooks", "update") + playbook_path =3D os.path.join(playbook_base, "main.yml") =20 extra_vars =3D json.dumps({ "base": base, diff --git a/guests/site.yml b/guests/playbooks/update/main.yml similarity index 100% rename from guests/site.yml rename to guests/playbooks/update/main.yml diff --git a/guests/tasks/base.yml b/guests/playbooks/update/tasks/base.yml similarity index 100% rename from guests/tasks/base.yml rename to guests/playbooks/update/tasks/base.yml diff --git a/guests/tasks/bootloader.yml b/guests/playbooks/update/tasks/bo= otloader.yml similarity index 100% rename from guests/tasks/bootloader.yml rename to guests/playbooks/update/tasks/bootloader.yml diff --git a/guests/tasks/bootstrap.yml b/guests/playbooks/update/tasks/boo= tstrap.yml similarity index 100% rename from guests/tasks/bootstrap.yml rename to guests/playbooks/update/tasks/bootstrap.yml diff --git a/guests/tasks/jenkins.yml b/guests/playbooks/update/tasks/jenki= ns.yml similarity index 100% rename from guests/tasks/jenkins.yml rename to guests/playbooks/update/tasks/jenkins.yml diff --git a/guests/tasks/kludges.yml b/guests/playbooks/update/tasks/kludg= es.yml similarity index 100% rename from guests/tasks/kludges.yml rename to guests/playbooks/update/tasks/kludges.yml diff --git a/guests/tasks/packages.yml b/guests/playbooks/update/tasks/pack= ages.yml similarity index 100% rename from guests/tasks/packages.yml rename to guests/playbooks/update/tasks/packages.yml diff --git a/guests/tasks/paths.yml b/guests/playbooks/update/tasks/paths.y= ml similarity index 100% rename from guests/tasks/paths.yml rename to guests/playbooks/update/tasks/paths.yml diff --git a/guests/tasks/services.yml b/guests/playbooks/update/tasks/serv= ices.yml similarity index 100% rename from guests/tasks/services.yml rename to guests/playbooks/update/tasks/services.yml diff --git a/guests/tasks/users.yml b/guests/playbooks/update/tasks/users.y= ml similarity index 100% rename from guests/tasks/users.yml rename to guests/playbooks/update/tasks/users.yml diff --git a/guests/templates/bash_profile.j2 b/guests/playbooks/update/tem= plates/bash_profile.j2 similarity index 100% rename from guests/templates/bash_profile.j2 rename to guests/playbooks/update/templates/bash_profile.j2 diff --git a/guests/templates/bashrc.j2 b/guests/playbooks/update/templates= /bashrc.j2 similarity index 100% rename from guests/templates/bashrc.j2 rename to guests/playbooks/update/templates/bashrc.j2 diff --git a/guests/templates/ccache.conf.j2 b/guests/playbooks/update/temp= lates/ccache.conf.j2 similarity index 100% rename from guests/templates/ccache.conf.j2 rename to guests/playbooks/update/templates/ccache.conf.j2 diff --git a/guests/templates/fedora-rawhide-kernel-nodebug.repo.j2 b/guest= s/playbooks/update/templates/fedora-rawhide-kernel-nodebug.repo.j2 similarity index 100% rename from guests/templates/fedora-rawhide-kernel-nodebug.repo.j2 rename to guests/playbooks/update/templates/fedora-rawhide-kernel-nodebug.r= epo.j2 diff --git a/guests/templates/jenkins.service.j2 b/guests/playbooks/update/= templates/jenkins.service.j2 similarity index 100% rename from guests/templates/jenkins.service.j2 rename to guests/playbooks/update/templates/jenkins.service.j2 diff --git a/guests/templates/jessie-backports.preferences.j2 b/guests/play= books/update/templates/jessie-backports.preferences.j2 similarity index 100% rename from guests/templates/jessie-backports.preferences.j2 rename to guests/playbooks/update/templates/jessie-backports.preferences.j2 diff --git a/guests/templates/jessie-backports.sources.j2 b/guests/playbook= s/update/templates/jessie-backports.sources.j2 similarity index 100% rename from guests/templates/jessie-backports.sources.j2 rename to guests/playbooks/update/templates/jessie-backports.sources.j2 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 17:03:54 2024 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 1532017952606768.3431629035966; Thu, 19 Jul 2018 09:32:32 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DF6E7308A950; Thu, 19 Jul 2018 16:32:30 +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 AD29BC432E; Thu, 19 Jul 2018 16:32:30 +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 5D09314B0B; Thu, 19 Jul 2018 16:32:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6JGWIkg003742 for ; Thu, 19 Jul 2018 12:32:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id 909571C5B7; Thu, 19 Jul 2018 16:32:18 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 325F41C5B8 for ; Thu, 19 Jul 2018 16:32:18 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Thu, 19 Jul 2018 18:32:05 +0200 Message-Id: <20180719163208.23126-6-abologna@redhat.com> In-Reply-To: <20180719163208.23126-1-abologna@redhat.com> References: <20180719163208.23126-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 5/8] guests: Drop install_config from inventory 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.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Thu, 19 Jul 2018 16:32:31 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The information is mostly duplicated and can be easily inferred in a programmatic manner, so storing it in the inventory is far from the cleanest solution. As a side-effect, we reintroduce the error message that was supposed to be displayed when attempting to install a FreeBSD guest but was lost in the Python rewrite. Signed-off-by: Andrea Bolognani Reviewed-by: Erik Skultety --- guests/host_vars/libvirt-centos-7/install.yml | 1 - guests/host_vars/libvirt-debian-8/install.yml | 1 - guests/host_vars/libvirt-debian-9/install.yml | 1 - .../host_vars/libvirt-debian-sid/install.yml | 1 - .../host_vars/libvirt-fedora-27/install.yml | 1 - .../host_vars/libvirt-fedora-28/install.yml | 1 - .../libvirt-fedora-rawhide/install.yml | 1 - .../host_vars/libvirt-ubuntu-16/install.yml | 1 - .../host_vars/libvirt-ubuntu-18/install.yml | 1 - guests/lcitool | 19 ++++++++++++++----- 10 files changed, 14 insertions(+), 14 deletions(-) diff --git a/guests/host_vars/libvirt-centos-7/install.yml b/guests/host_va= rs/libvirt-centos-7/install.yml index f003b89..2164ac5 100644 --- a/guests/host_vars/libvirt-centos-7/install.yml +++ b/guests/host_vars/libvirt-centos-7/install.yml @@ -1,3 +1,2 @@ --- install_url: http://mirror.centos.org/centos/7/os/x86_64/ -install_config: kickstart.cfg diff --git a/guests/host_vars/libvirt-debian-8/install.yml b/guests/host_va= rs/libvirt-debian-8/install.yml index a2c8341..299a1a6 100644 --- a/guests/host_vars/libvirt-debian-8/install.yml +++ b/guests/host_vars/libvirt-debian-8/install.yml @@ -1,3 +1,2 @@ --- install_url: http://deb.debian.org/debian/dists/jessie/main/installer-amd6= 4/ -install_config: preseed.cfg diff --git a/guests/host_vars/libvirt-debian-9/install.yml b/guests/host_va= rs/libvirt-debian-9/install.yml index 5b1da76..7641753 100644 --- a/guests/host_vars/libvirt-debian-9/install.yml +++ b/guests/host_vars/libvirt-debian-9/install.yml @@ -1,3 +1,2 @@ --- install_url: http://deb.debian.org/debian/dists/stretch/main/installer-amd= 64/ -install_config: preseed.cfg diff --git a/guests/host_vars/libvirt-debian-sid/install.yml b/guests/host_= vars/libvirt-debian-sid/install.yml index da1c7a8..46c6366 100644 --- a/guests/host_vars/libvirt-debian-sid/install.yml +++ b/guests/host_vars/libvirt-debian-sid/install.yml @@ -1,3 +1,2 @@ --- install_url: http://deb.debian.org/debian/dists/sid/main/installer-amd64/ -install_config: preseed.cfg diff --git a/guests/host_vars/libvirt-fedora-27/install.yml b/guests/host_v= ars/libvirt-fedora-27/install.yml index 66ce38e..f7a45af 100644 --- a/guests/host_vars/libvirt-fedora-27/install.yml +++ b/guests/host_vars/libvirt-fedora-27/install.yml @@ -1,3 +1,2 @@ --- install_url: https://download.fedoraproject.org/pub/fedora/linux/releases/= 27/Everything/x86_64/os -install_config: kickstart.cfg diff --git a/guests/host_vars/libvirt-fedora-28/install.yml b/guests/host_v= ars/libvirt-fedora-28/install.yml index 4b2b9f0..73433f1 100644 --- a/guests/host_vars/libvirt-fedora-28/install.yml +++ b/guests/host_vars/libvirt-fedora-28/install.yml @@ -1,3 +1,2 @@ --- install_url: https://download.fedoraproject.org/pub/fedora/linux/releases/= 28/Everything/x86_64/os -install_config: kickstart.cfg diff --git a/guests/host_vars/libvirt-fedora-rawhide/install.yml b/guests/h= ost_vars/libvirt-fedora-rawhide/install.yml index 2216e81..5c67562 100644 --- a/guests/host_vars/libvirt-fedora-rawhide/install.yml +++ b/guests/host_vars/libvirt-fedora-rawhide/install.yml @@ -1,3 +1,2 @@ --- install_url: https://download.fedoraproject.org/pub/fedora/linux/developme= nt/rawhide/Everything/x86_64/os -install_config: kickstart.cfg diff --git a/guests/host_vars/libvirt-ubuntu-16/install.yml b/guests/host_v= ars/libvirt-ubuntu-16/install.yml index a7bb2da..d8ce841 100644 --- a/guests/host_vars/libvirt-ubuntu-16/install.yml +++ b/guests/host_vars/libvirt-ubuntu-16/install.yml @@ -1,3 +1,2 @@ --- install_url: http://archive.ubuntu.com/ubuntu/dists/xenial/main/installer-= amd64/ -install_config: preseed.cfg diff --git a/guests/host_vars/libvirt-ubuntu-18/install.yml b/guests/host_v= ars/libvirt-ubuntu-18/install.yml index bd3e1d9..544b3f2 100644 --- a/guests/host_vars/libvirt-ubuntu-18/install.yml +++ b/guests/host_vars/libvirt-ubuntu-18/install.yml @@ -1,3 +1,2 @@ --- install_url: http://archive.ubuntu.com/ubuntu/dists/bionic/main/installer-= amd64/ -install_config: preseed.cfg diff --git a/guests/lcitool b/guests/lcitool index 2cfb0e9..13f0392 100755 --- a/guests/lcitool +++ b/guests/lcitool @@ -382,15 +382,24 @@ class Application: facts["install_network"], ) =20 - install_config =3D os.path.join(base, facts["install_config"]) + # Different operating systems require different configuration + # files for unattended installation to work, but some operating + # systems simply don't support unattended installation at all + if facts["os_name"] in ["Debian", "Ubuntu"]: + install_config =3D "preseed.cfg" + elif facts["os_name"] in ["CentOS", "Fedora"]: + install_config =3D "kickstart.cfg" + else: + raise Error( + "Host {} doesn't support installation".format(host) + ) + initrd_inject =3D os.path.join(base, install_config) =20 # preseed files must use a well-known name to be picked up by # d-i; for kickstart files, we can use whatever name we please # but we need to point anaconda in the right direction through # a kernel argument - extra_arg =3D "console=3DttyS0 ks=3Dfile:/{}".format( - facts["install_config"], - ) + extra_arg =3D "console=3DttyS0 ks=3Dfile:/{}".format(install_c= onfig) =20 cmd =3D [ "virt-install", @@ -407,7 +416,7 @@ class Application: "--graphics", "none", "--console", "pty", "--sound", "none", - "--initrd-inject", install_config, + "--initrd-inject", initrd_inject, "--extra-args", extra_arg, "--wait", "0", ] --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 17:03:54 2024 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 1532017958155708.4694291847562; Thu, 19 Jul 2018 09:32:38 -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 C6DBF308330B; Thu, 19 Jul 2018 16:32:36 +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 771E35C73D; Thu, 19 Jul 2018 16:32:36 +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 ED3C61800B6C; Thu, 19 Jul 2018 16:32:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6JGWJiB003749 for ; Thu, 19 Jul 2018 12:32:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 37BB21C5B7; Thu, 19 Jul 2018 16:32:19 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CD8A21C5B8 for ; Thu, 19 Jul 2018 16:32:18 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Thu, 19 Jul 2018 18:32:06 +0200 Message-Id: <20180719163208.23126-7-abologna@redhat.com> In-Reply-To: <20180719163208.23126-1-abologna@redhat.com> References: <20180719163208.23126-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 6/8] guests: Move install configs 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.44]); Thu, 19 Jul 2018 16:32:37 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The rationale is the same as for moving playbooks. Signed-off-by: Andrea Bolognani Reviewed-by: Erik Skultety --- guests/{ =3D> configs}/kickstart.cfg | 0 guests/{ =3D> configs}/preseed.cfg | 0 guests/lcitool | 2 +- 3 files changed, 1 insertion(+), 1 deletion(-) rename guests/{ =3D> configs}/kickstart.cfg (100%) rename guests/{ =3D> configs}/preseed.cfg (100%) diff --git a/guests/kickstart.cfg b/guests/configs/kickstart.cfg similarity index 100% rename from guests/kickstart.cfg rename to guests/configs/kickstart.cfg diff --git a/guests/preseed.cfg b/guests/configs/preseed.cfg similarity index 100% rename from guests/preseed.cfg rename to guests/configs/preseed.cfg diff --git a/guests/lcitool b/guests/lcitool index 13f0392..96a59ac 100755 --- a/guests/lcitool +++ b/guests/lcitool @@ -393,7 +393,7 @@ class Application: raise Error( "Host {} doesn't support installation".format(host) ) - initrd_inject =3D os.path.join(base, install_config) + initrd_inject =3D os.path.join(base, "configs", install_config) =20 # preseed files must use a well-known name to be picked up by # d-i; for kickstart files, we can use whatever name we please --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 17:03:54 2024 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 1532017958416340.7748558467075; Thu, 19 Jul 2018 09:32:38 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B88A6C04AC5D; Thu, 19 Jul 2018 16:32:36 +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 77D8B308332F; Thu, 19 Jul 2018 16:32:36 +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 0343914B08; Thu, 19 Jul 2018 16:32:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6JGWJVR003754 for ; Thu, 19 Jul 2018 12:32:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id D2EA31C5B7; Thu, 19 Jul 2018 16:32:19 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 74B401C5BC for ; Thu, 19 Jul 2018 16:32:19 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Thu, 19 Jul 2018 18:32:07 +0200 Message-Id: <20180719163208.23126-8-abologna@redhat.com> In-Reply-To: <20180719163208.23126-1-abologna@redhat.com> References: <20180719163208.23126-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 7/8] lcitool: Allow installing a subset of build dependencies 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.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 19 Jul 2018 16:32:37 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" For CentOS CI, we need build dependencies for all known projects to be installed; however, when using lcitool for development purposes, it is very convenient to install just the subset relevant to the project that's being worked on, as doing so reduces the storage requirements and makes the update procedure quite a bit faster. The previous behavior can still be obtained by using $ lcitool -a update -p all ... Signed-off-by: Andrea Bolognani Reviewed-by: Erik Skultety --- guests/lcitool | 4 +++- guests/playbooks/update/main.yml | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/guests/lcitool b/guests/lcitool index 96a59ac..2aa9674 100755 --- a/guests/lcitool +++ b/guests/lcitool @@ -430,7 +430,7 @@ class Application: except Exception: raise Error("Failed to install '{}'".format(host)) =20 - def _action_update(self, hosts, _projects): + def _action_update(self, hosts, projects): base =3D Util.get_base() =20 flavor =3D self._config.get_flavor() @@ -438,6 +438,7 @@ class Application: root_pass_file =3D self._config.get_root_password_file() =20 ansible_hosts =3D ",".join(self._inventory.expand_pattern(hosts)) + selected_projects =3D self._projects.expand_pattern(projects) =20 ansible_cfg_path =3D os.path.join(base, "ansible.cfg") playbook_base =3D os.path.join(base, "playbooks", "update") @@ -448,6 +449,7 @@ class Application: "playbook_base": playbook_base, "root_password_file": root_pass_file, "flavor": flavor, + "selected_projects": selected_projects, }) =20 cmd =3D [ diff --git a/guests/playbooks/update/main.yml b/guests/playbooks/update/mai= n.yml index 4de759b..753bac4 100644 --- a/guests/playbooks/update/main.yml +++ b/guests/playbooks/update/main.yml @@ -34,11 +34,11 @@ # Install build dependencies for each project - include: '{{ playbook_base }}/tasks/packages.yml' with_items: - '{{ projects }}' + '{{ selected_projects }}' loop_control: loop_var: project when: - - projects is defined + - project in projects =20 # Install packages needed for the Jenkins agent - include: '{{ playbook_base }}/tasks/packages.yml' --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 17:03:54 2024 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 1532017963735441.729627736411; Thu, 19 Jul 2018 09:32:43 -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 64F77C04B948; Thu, 19 Jul 2018 16:32:42 +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 1B74C60172; Thu, 19 Jul 2018 16:32:42 +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 BB52D14B14; Thu, 19 Jul 2018 16:32:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6JGWKdp003759 for ; Thu, 19 Jul 2018 12:32:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7A1651C5B7; Thu, 19 Jul 2018 16:32:20 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1B9E31C5B8 for ; Thu, 19 Jul 2018 16:32:19 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Thu, 19 Jul 2018 18:32:08 +0200 Message-Id: <20180719163208.23126-9-abologna@redhat.com> In-Reply-To: <20180719163208.23126-1-abologna@redhat.com> References: <20180719163208.23126-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 8/8] guests: Update documentation 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.31]); Thu, 19 Jul 2018 16:32:43 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The usage has once again changed slightly; additionally, a few concrete examples are now provided. Signed-off-by: Andrea Bolognani Reviewed-by: Erik Skultety --- guests/README.markdown | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/guests/README.markdown b/guests/README.markdown index 4a40619..ddf0149 100644 --- a/guests/README.markdown +++ b/guests/README.markdown @@ -4,22 +4,48 @@ libvirt CI - guest management tools The tools contained in this directory simplify and automate the management of the guests used by the Jenkins-based libvirt CI environment. =20 + +Usage and examples +------------------ + There are two steps to bringing up a guest: =20 -* `./lcitool -a install -h $guest` will perform an unattended installation +* `lcitool -a install -h $guest` will perform an unattended installation of `$guest`. Not all guests can be installed this way: see the "FreeBSD" section below; =20 -* `./lcitool -a update -h $guest` will go through all the post-installation - configuration steps required to make the newly-created guest usable; +* `lcitool -a update -h $guest -p $project` will go through all the + post-installation configuration steps required to make the newly-created + guest usable and ready to be used for building `$project`; =20 Once those steps have been performed, maintainance will involve running: =20 -* `./lcitool -a update -h $guest` + lcitool -a update -h $guest -p $project =20 periodically to ensure the guest configuration is sane and all installed packages are updated. =20 +To get a list of known guests and projects, run + + lcitool -a hosts + +and + + lcitool -a projects + +respectively. You can run operations involving multiple guests and projects +at once by providing a list on the command line: for example, running + + lcitool -a update -h '*fedora*' -p '*osinfo*' + +will update all Fedora guests and get them ready to build libosinfo and +related projects, while running + + lcitool -a update -h all -p libvirt,libvirt+mingw + +will update all hosts and prepare them to build libvirt both as a native +library and, where supported, as a Windows library using MinGW. + =20 Host setup ---------- @@ -40,13 +66,13 @@ you'll want to use the `libvirt_guest` variant of the p= lugin. To keep guests up to date over time, it's recommended to have an entry along the lines of =20 - 0 0 * * * cd ~/libvirt-jenkins-ci/guests && ./lcitool -a update -h all + 0 0 * * * ~/libvirt-jenkins-ci/guests/lcitool -a update -h all -p all =20 in your crontab. =20 =20 Test use ---------------- +-------- =20 If you are a developer trying to reproduce a bug on some OS you don't have easy access to, you can use these tools to create a suitable test --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list