From: Luis Chamberlain <mcgrof@kernel.org>
To: kdevops@lists.linux.dev, da.gomez@samsung.com, p.raghav@samsung.com
Cc: Luis Chamberlain <mcgrof@kernel.org>
Subject: [PATCH 2/6] bringup: split provisioning into 2 steps
Date: Thu, 25 Jan 2024 12:35:03 -0800 [thread overview]
Message-ID: <20240125203507.430113-3-mcgrof@kernel.org> (raw)
In-Reply-To: <20240125203507.430113-1-mcgrof@kernel.org>
Right now we deal with provisioning as a post bringup work item and it
does two things:
1) Update ssh config file
2) Runs the devconfig playbook, which optionally installs some deps
other than do basic things like setup console, kdump, etc.
The fact that deps are optional on the devconfig playbook makes it
hard to add dependencies we want to install without incurring a penalty
to everyone as a default option to install all standard generic kernel
development tools we define under CONFIG_KDEVOPS_TRY_INSTALL_KDEV_TOOLS.
The reason we disable CONFIG_KDEVOPS_TRY_INSTALL_KDEV_TOOLS by default
is it delays bringup.
However the devconfig playbook is also used to place random oddball
generic tools may want to install on bringup. Some of these tools we
may want to try to install early on, even before we run the devconfig
playbook for generic stuff like setting up the console or kdump.
To help with this, and in order to allow us to keep relying on the
devconfig playbook for random packages we may want to allow users
to install, we split the above two provisioning tasks into two
separate tasks. This will allow us to add another middle set of
targets which get executed after 1) but before 2). We will add
support for this in the next subsequent commit.
For now this should be a no-op for both vagrant and libguest. For
terraform we actually enhance the experience by adding a guard to
not run the devconfig playbook twice if a user by mistake tried to
run 'make bringup' twice. This guard was not present before for
terraform.
Maybe later on we should share these snippets between all 3 bringup
methods. Note we have no generic task for bare metal yet, but we
should -- we should just add the devconfig playbook. That would
cases where bare metal systems which are already brought up and
you have ssh configuration going for already working.
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
.gitignore | 4 +++-
Makefile | 5 +++--
scripts/guestfs.Makefile | 24 ++++++++++++++++++------
scripts/terraform.Makefile | 18 ++++++++++++++++++
scripts/vagrant.Makefile | 22 +++++++++++++++++-----
5 files changed, 59 insertions(+), 14 deletions(-)
diff --git a/.gitignore b/.gitignore
index 738d073e889a..1d2653c5b26c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -29,9 +29,11 @@ scripts/workflows/lib/__pycache__/
vagrant/kdevops_nodes.yaml
vagrant/.Vagrantfile.generated
vagrant/Vagrantfile
-vagrant/.provisioned_once
+vagrant/.provisioned_once*
.vagrant/
+terraform/.provisioned_once*
+
include/
# You can override role specific stuff on these
diff --git a/Makefile b/Makefile
index ad34743e3e53..8ee02f2a9b6c 100644
--- a/Makefile
+++ b/Makefile
@@ -86,9 +86,10 @@ endif # CONFIG_NEEDS_LOCAL_DEVELOPMENT_PATH
ANSIBLE_EXTRA_ARGS += $(LOCAL_DEVELOPMENT_ARGS)
# These should be set as non-empty if you want any generic bring up
-# targets to come up. We support 2 bring up methods:
+# targets to come up. We support 3 bring up methods:
#
-# - vagrant: for kvm/virtualbox
+# - vagrant: for kvm/virtualbox - will eventually be deprecated
+# - libguestfs: for kvm
# - terraform: for any cloud provider
#
# If you are using bare metal, you don't do bring up, or you'd
diff --git a/scripts/guestfs.Makefile b/scripts/guestfs.Makefile
index 211ac9ba688e..17c8cbd354c1 100644
--- a/scripts/guestfs.Makefile
+++ b/scripts/guestfs.Makefile
@@ -5,9 +5,11 @@ GUESTFS_ARGS :=
KDEVOPS_NODES_TEMPLATE := $(KDEVOPS_NODES_ROLE_TEMPLATE_DIR)/guestfs_nodes.j2
KDEVOPS_NODES := guestfs/kdevops_nodes.yaml
-export KDEVOPS_GUESTFS_PROVISIONED := guestfs/.provisioned_once
+export KDEVOPS_GUESTFS_PROVISIONED_SSH := guestfs/.provisioned_once_ssh
+export KDEVOPS_GUESTFS_PROVISIONED_DEVCONFIG := guestfs/.provisioned_once_devconfig
-KDEVOPS_MRPROPER += $(KDEVOPS_GUESTFS_PROVISIONED)
+KDEVOPS_MRPROPER += $(KDEVOPS_GUESTFS_PROVISIONED_SSH)
+KDEVOPS_MRPROPER += $(KDEVOPS_GUESTFS_PROVISIONED_DEVCONFIG)
GUESTFS_ARGS += kdevops_enable_guestfs=True
GUESTFS_ARGS += guestfs_path='$(TOPDIR_PATH)/guestfs'
@@ -51,11 +53,18 @@ GUESTFS_BRINGUP_DEPS :=
GUESTFS_BRINGUP_DEPS += $(9P_HOST_CLONE)
GUESTFS_BRINGUP_DEPS += $(LIBVIRT_PCIE_PASSTHROUGH)
-KDEVOPS_BRING_UP_DEPS := bringup_guestfs
+ KDEVOPS_BRING_UP_DEPS := bringup_guestfs
KDEVOPS_DESTROY_DEPS := destroy_guestfs
# Provisioning goes last
-KDEVOPS_BRING_UP_DEPS += $(KDEVOPS_GUESTFS_PROVISIONED)
+#
+# Provisioning split into 2 steps:
+# 1) Ensuring we can use ansible with ssh
+# 2) Generic devconfig final configuration (which may include extra tools)
+#
+# Anything deps after this is dealt with on each respective workflow.
+KDEVOPS_BRING_UP_DEPS += $(KDEVOPS_GUESTFS_PROVISIONED_SSH)
+KDEVOPS_BRING_UP_DEPS += $(KDEVOPS_GUESTFS_PROVISIONED_DEVCONFIG)
9p_linux_clone:
$(Q)make linux-clone
@@ -66,15 +75,18 @@ libvirt_pcie_passthrough_permissions:
playbooks/libvirt_pcie_passthrough.yml \
-e 'ansible_python_interpreter=/usr/bin/python3'
-$(KDEVOPS_GUESTFS_PROVISIONED):
+$(KDEVOPS_GUESTFS_PROVISIONED_SSH):
$(Q)if [[ "$(CONFIG_KDEVOPS_SSH_CONFIG_UPDATE)" == "y" ]]; then \
LIBVIRT_DEFAULT_URI=$(CONFIG_LIBVIRT_URI) $(TOPDIR)/scripts/update_ssh_config_guestfs.py; \
fi
+ $(Q)touch $(KDEVOPS_GUESTFS_PROVISIONED_SSH)
+
+$(KDEVOPS_GUESTFS_PROVISIONED_DEVCONFIG):
$(Q)if [[ "$(CONFIG_KDEVOPS_ANSIBLE_PROVISION_PLAYBOOK)" != "" ]]; then \
ansible-playbook $(ANSIBLE_VERBOSE) -i \
$(KDEVOPS_HOSTFILE) $(KDEVOPS_PLAYBOOKS_DIR)/$(KDEVOPS_ANSIBLE_PROVISION_PLAYBOOK) ; \
fi
- $(Q)touch $(KDEVOPS_GUESTFS_PROVISIONED)
+ $(Q)touch $(KDEVOPS_GUESTFS_PROVISIONED_DEVCONFIG)
bringup_guestfs: $(GUESTFS_BRINGUP_DEPS)
$(Q)$(TOPDIR)/scripts/bringup_guestfs.sh
diff --git a/scripts/terraform.Makefile b/scripts/terraform.Makefile
index d4caa4dbb6d6..8e95e8cd822b 100644
--- a/scripts/terraform.Makefile
+++ b/scripts/terraform.Makefile
@@ -2,7 +2,22 @@
TERRAFORM_EXTRA_VARS :=
+export KDEVOPS_TERRAFORM_PROVISIONED_DEVCONFIG := terraform/.provisioned_once_devconfig
+KDEVOPS_MRPROPER += $(KDEVOPS_TERRAFORM_PROVISIONED_DEVCONFIG)
+
KDEVOPS_BRING_UP_DEPS := bringup_terraform
+# Provisioning goes last
+#
+# Provisioning split into 2 steps:
+# 1) Ensuring we can use ansible with ssh - this is implied by all
+# terraform providers. That is, our terraform providers all have a last
+# provisioning element task which does this update for us as part of
+# the above bringup_terraform.
+# 2) Generic devconfig final configuration (which may include extra tools)
+#
+# Anything deps after this is dealt with on each respective workflow.
+KDEVOPS_BRING_UP_DEPS += $(KDEVOPS_TERRAFORM_PROVISIONED_DEVCONFIG)
+
KDEVOPS_DESTROY_DEPS := destroy_terraform
KDEVOPS_NODES_TEMPLATE := $(KDEVOPS_NODES_ROLE_TEMPLATE_DIR)/terraform_nodes.tf.j2
@@ -163,10 +178,13 @@ ANSIBLE_EXTRA_ARGS += $(TERRAFORM_EXTRA_VARS)
bringup_terraform:
$(Q)$(TOPDIR)/scripts/bringup_terraform.sh
+
+$(KDEVOPS_TERRAFORM_PROVISIONED_DEVCONFIG):
$(Q)if [[ "$(CONFIG_KDEVOPS_ANSIBLE_PROVISION_PLAYBOOK)" != "" ]]; then \
ansible-playbook $(ANSIBLE_VERBOSE) -i \
$(KDEVOPS_HOSTFILE) $(KDEVOPS_PLAYBOOKS_DIR)/$(KDEVOPS_ANSIBLE_PROVISION_PLAYBOOK) ;\
fi
+ $(Q)touch $(KDEVOPS_TERRAFORM_PROVISIONED_DEVCONFIG)
destroy_terraform:
$(Q)$(TOPDIR)/scripts/destroy_terraform.sh
diff --git a/scripts/vagrant.Makefile b/scripts/vagrant.Makefile
index 0633f90da719..825cfd210c6b 100644
--- a/scripts/vagrant.Makefile
+++ b/scripts/vagrant.Makefile
@@ -8,11 +8,13 @@ KDEVOPS_NODES := vagrant/kdevops_nodes.yaml
KDEVOPS_VAGRANT_TEMPLATE := $(KDEVOPS_NODES_ROLE_TEMPLATE_DIR)/Vagrantfile.j2
KDEVOPS_VAGRANT_GENERATED:= vagrant/.Vagrantfile.generated
KDEVOPS_VAGRANT := vagrant/Vagrantfile
-export KDEVOPS_VAGRANT_PROVISIONED := vagrant/.provisioned_once
+export KDEVOPS_VAGRANT_PROVISIONED_SSH := vagrant/.provisioned_once_ssh
+export KDEVOPS_VAGRANT_PROVISIONED_DEVCONFIG := vagrant/.provisioned_once_devconfig
KDEVOPS_MRPROPER += $(KDEVOPS_VAGRANT_GENERATED)
KDEVOPS_MRPROPER += $(KDEVOPS_VAGRANT)
-KDEVOPS_MRPROPER += $(KDEVOPS_VAGRANT_PROVISIONED)
+KDEVOPS_MRPROPER += $(KDEVOPS_VAGRANT_PROVISIONED_SSH)
+KDEVOPS_MRPROPER += $(KDEVOPS_VAGRANT_PROVISIONED_DEVCONFIG)
VAGRANT_ARGS += kdevops_vagrant_template_full_path='$(TOPDIR_PATH)/$(KDEVOPS_VAGRANT_TEMPLATE)'
@@ -75,7 +77,14 @@ VAGRANT_BRINGUP_DEPS += $(LIBVIRT_PCIE_PASSTHROUGH)
KDEVOPS_BRING_UP_DEPS := bringup_vagrant
# Provisioning goes last
-KDEVOPS_BRING_UP_DEPS += $(KDEVOPS_VAGRANT_PROVISIONED)
+#
+# Provisioning split into 2 steps:
+# 1) Ensuring we can use ansible with ssh
+# 2) Generic devconfig final configuration (which may include extra tools)
+#
+# Anything deps after this is dealt with on each respective workflow.
+KDEVOPS_BRING_UP_DEPS += $(KDEVOPS_VAGRANT_PROVISIONED_SSH)
+KDEVOPS_BRING_UP_DEPS += $(KDEVOPS_VAGRANT_PROVISIONED_DEVCONFIG)
KDEVOPS_DESTROY_DEPS := destroy_vagrant
@@ -99,18 +108,21 @@ libvirt_pcie_passthrough_permissions:
playbooks/libvirt_pcie_passthrough.yml \
-e 'ansible_python_interpreter=/usr/bin/python3'
-$(KDEVOPS_VAGRANT_PROVISIONED):
+$(KDEVOPS_VAGRANT_PROVISIONED_SSH):
$(Q)if [[ "$(CONFIG_KDEVOPS_SSH_CONFIG_UPDATE)" == "y" ]]; then \
ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
--inventory localhost, \
playbooks/update_ssh_config_vagrant.yml \
-e 'ansible_python_interpreter=/usr/bin/python3' ;\
fi
+ $(Q)touch $(KDEVOPS_VAGRANT_PROVISIONED_SSH)
+
+$(KDEVOPS_VAGRANT_PROVISIONED_DEVCONFIG):
$(Q)if [[ "$(CONFIG_KDEVOPS_ANSIBLE_PROVISION_PLAYBOOK)" != "" ]]; then \
ansible-playbook $(ANSIBLE_VERBOSE) -i \
$(KDEVOPS_HOSTFILE) $(KDEVOPS_PLAYBOOKS_DIR)/$(KDEVOPS_ANSIBLE_PROVISION_PLAYBOOK) ;\
fi
- $(Q)touch $(KDEVOPS_VAGRANT_PROVISIONED)
+ $(Q)touch $(KDEVOPS_VAGRANT_PROVISIONED_DEVCONFIG)
bringup_vagrant: $(VAGRANT_BRINGUP_DEPS)
$(Q)$(TOPDIR)/scripts/bringup_vagrant.sh
--
2.42.0
next prev parent reply other threads:[~2024-01-25 20:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-25 20:35 [PATCH 0/6] Fix ordering for systemd remote journal support Luis Chamberlain
2024-01-25 20:35 ` [PATCH 1/6] mirror: add a smart git check Luis Chamberlain
2024-01-25 20:35 ` Luis Chamberlain [this message]
2024-01-25 20:35 ` [PATCH 3/6] bringup: share bringup method targe and agument by two steps Luis Chamberlain
2024-01-25 20:35 ` [PATCH 4/6] provision: move all provisioning things to its own Makefile Luis Chamberlain
2024-01-25 20:35 ` [PATCH 5/6] bringup: move journal-server setup early Luis Chamberlain
2024-01-25 20:35 ` [PATCH 6/6] journal-server: fix by adjusting ordering Luis Chamberlain
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240125203507.430113-3-mcgrof@kernel.org \
--to=mcgrof@kernel.org \
--cc=da.gomez@samsung.com \
--cc=kdevops@lists.linux.dev \
--cc=p.raghav@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox