With this change, the existing host-based Ansible provisioner is refactored to share a maximum of code with this new guest-based Ansible provisioner. At this stage of development, the existing unit tests are intentionally modified as little as possible, to keep safe the existing funtionalities. Other issues resolved by this changeset: - Display a warning when running from a Windows host [GH-5292] - Do not run `ansible-playbook` in verbose mode when the `verbose` option is set to an empty string.
76 lines
2.1 KiB
Ruby
76 lines
2.1 KiB
Ruby
require "vagrant"
|
|
|
|
module VagrantPlugins
|
|
module Ansible
|
|
class Plugin < Vagrant.plugin("2")
|
|
|
|
name "ansible"
|
|
description <<-DESC
|
|
Provides support for provisioning your virtual machines with Ansible
|
|
from the Vagrant host (`ansible`) or from the guests (`ansible_local`).
|
|
DESC
|
|
|
|
config("ansible", :provisioner) do
|
|
require_relative "config/host"
|
|
Config::Host
|
|
end
|
|
|
|
config("ansible_local", :provisioner) do
|
|
require_relative "config/guest"
|
|
Config::Guest
|
|
end
|
|
|
|
provisioner("ansible") do
|
|
require_relative "provisioner/host"
|
|
Provisioner::Host
|
|
end
|
|
|
|
provisioner("ansible_local") do
|
|
require_relative "provisioner/guest"
|
|
Provisioner::Guest
|
|
end
|
|
|
|
guest_capability(:linux, :ansible_installed) do
|
|
require_relative "cap/guest/posix/ansible_installed"
|
|
Cap::Guest::POSIX::AnsibleInstalled
|
|
end
|
|
|
|
guest_capability(:freebsd, :ansible_installed) do
|
|
require_relative "cap/guest/posix/ansible_installed"
|
|
Cap::Guest::POSIX::AnsibleInstalled
|
|
end
|
|
|
|
guest_capability(:arch, :ansible_install) do
|
|
require_relative "cap/guest/arch/ansible_install"
|
|
Cap::Guest::Arch::AnsibleInstall
|
|
end
|
|
|
|
guest_capability(:debian, :ansible_install) do
|
|
require_relative "cap/guest/debian/ansible_install"
|
|
Cap::Guest::Debian::AnsibleInstall
|
|
end
|
|
|
|
guest_capability(:ubuntu, :ansible_install) do
|
|
require_relative "cap/guest/ubuntu/ansible_install"
|
|
Cap::Guest::Ubuntu::AnsibleInstall
|
|
end
|
|
|
|
guest_capability(:redhat, :ansible_install) do
|
|
require_relative "cap/guest/epel/ansible_install"
|
|
Cap::Guest::EPEL::AnsibleInstall
|
|
end
|
|
|
|
guest_capability(:suse, :ansible_install) do
|
|
require_relative "cap/guest/suse/ansible_install"
|
|
Cap::Guest::SUSE::AnsibleInstall
|
|
end
|
|
|
|
guest_capability(:freebsd, :ansible_install) do
|
|
require_relative "cap/guest/freebsd/ansible_install"
|
|
Cap::Guest::FreeBSD::AnsibleInstall
|
|
end
|
|
|
|
end
|
|
end
|
|
end
|