Skip to content

Deprecate the ansible provision mode and playbook #3451

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/limayaml/limayaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ const (
ProvisionModeUser ProvisionMode = "user"
ProvisionModeBoot ProvisionMode = "boot"
ProvisionModeDependency ProvisionMode = "dependency"
ProvisionModeAnsible ProvisionMode = "ansible"
ProvisionModeAnsible ProvisionMode = "ansible" // DEPRECATED
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ProvisionModeData ProvisionMode = "data"
)

Expand All @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions pkg/limayaml/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it is clear to the user that ansible-playbook should be run directly (on the host? inside the VM?), and that it isn't a new lima.yaml setting.

Nit-picking: provision mode "ansible"

}
if strings.Contains(p.Script, "LIMA_CIDATA") {
logrus.Warn("provisioning scripts should not reference the LIMA_CIDATA variables")
Expand Down
2 changes: 2 additions & 0 deletions templates/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add an /examples/ansible page under https://lima-vm.io/docs/examples/ for ansible-playbook

# - mode: ansible
# playbook: playbook.yaml
# # `data` is a file that is written to the guest filesystem and not executed at all.
Expand Down
Loading