From 72422b83c9941d937c3c9c1ae00b4da0416c2069 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Mon, 21 Apr 2025 18:20:50 +0200 Subject: [PATCH] Deprecate the ansible provision mode and playbook MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Anders F Björklund --- pkg/limayaml/limayaml.go | 4 ++-- pkg/limayaml/validate.go | 1 + templates/default.yaml | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/limayaml/limayaml.go b/pkg/limayaml/limayaml.go index b954063c06c..ddbcaa0be72 100644 --- a/pkg/limayaml/limayaml.go +++ b/pkg/limayaml/limayaml.go @@ -221,7 +221,7 @@ const ( ProvisionModeUser ProvisionMode = "user" ProvisionModeBoot ProvisionMode = "boot" ProvisionModeDependency ProvisionMode = "dependency" - ProvisionModeAnsible ProvisionMode = "ansible" + ProvisionModeAnsible ProvisionMode = "ansible" // DEPRECATED ProvisionModeData ProvisionMode = "data" ) @@ -230,7 +230,7 @@ type Provision struct { SkipDefaultDependencyResolution *bool `yaml:"skipDefaultDependencyResolution,omitempty" json:"skipDefaultDependencyResolution,omitempty"` Script string `yaml:"script" json:"script"` File *LocatorWithDigest `yaml:"file,omitempty" json:"file,omitempty" jsonschema:"nullable"` - Playbook string `yaml:"playbook,omitempty" json:"playbook,omitempty"` + Playbook string `yaml:"playbook,omitempty" json:"playbook,omitempty"` // DEPRECATED // All ProvisionData fields must be nil unless Mode is ProvisionModeData ProvisionData `yaml:",inline"` // Flatten fields for "strict" YAML mode } diff --git a/pkg/limayaml/validate.go b/pkg/limayaml/validate.go index ee3b3f8070f..a26eedaff80 100644 --- a/pkg/limayaml/validate.go +++ b/pkg/limayaml/validate.go @@ -277,6 +277,7 @@ func Validate(y *LimaYAML, warn bool) error { if _, err := os.Stat(playbook); err != nil { return fmt.Errorf("field `provision[%d].playbook` refers to an inaccessible path: %q: %w", i, playbook, err) } + logrus.Warnf("ansible provision mode is deprecated, use `ansible-playbook %q` instead", playbook) } if strings.Contains(p.Script, "LIMA_CIDATA") { logrus.Warn("provisioning scripts should not reference the LIMA_CIDATA variables") diff --git a/templates/default.yaml b/templates/default.yaml index eac787d7d77..3f41e0ca650 100644 --- a/templates/default.yaml +++ b/templates/default.yaml @@ -256,6 +256,8 @@ containerd: # # It requires `ansible-playbook` command to be installed. # # Environment variables such as ANSIBLE_CONFIG can be used, to control the behavior of the playbook execution. # # See ansible docs, and `ansible-config`, for more info https://docs.ansible.com/ansible/latest/playbook_guide/ +# # DEPRECATED The ansible mode is deprecated, and should not be used. Instead call ansible-playbook directly, +# # either from the host after the instance is started or from the instance by running ansible locally instead. # - mode: ansible # playbook: playbook.yaml # # `data` is a file that is written to the guest filesystem and not executed at all.