我有一个 vagrantfile,正在尝试实例化一个 ansible 类型的最终配置程序,我打算在其中完成大部分配置虚拟机的工作。
Vagrantfile 在没有 ansible 配置器的情况下也能正常工作
$vagrant up, destroy, reload etc
Ansible playbook 直接通过 ansible 运行时运行良好
$sudo su -i -u ansible ansible-playbook zsh.yml -i hosts
但当我尝试调用
$vagrant provision --provision-with install_zsh node2
剧本:
---
- name: Ansible TEST Playbook
hosts: all
gather_facts: true
become: true
tasks:
- name: Install ZSH
ansible.builtin.dnf:
name: 'zsh'
state: present
通过此提供者:
node.vm.provision "install_zsh", type: "ansible", run: "always" do |zsh|
zsh.playbook = "zsh.yml"
end # node.vm.provision
其他“shell”供应商运行良好。
我得到这个结果:
==> node2: Running provisioner: install_zsh (ansible)...
Windows is not officially supported for the Ansible Control Machine.
Please check https://docs.ansible.com/intro_installation.html#control-machine-requirements
Vagrant gathered an unknown Ansible version:
and falls back on the compatibility mode '1.8'.
Alternatively, the compatibility mode can be specified in your Vagrantfile:
https://www.vagrantup.com/docs/provisioning/ansible_common.html#compatibility_mode
node2: Running ansible-playbook...
The Ansible software could not be found! Please verify
that Ansible is correctly installed on your host system.
If you haven't installed Ansible yet, please install Ansible
on your host system. Vagrant can't do this for you in a safe and
automated way.
Please check https://docs.ansible.com for more information.
$vagrant --version
Vagrant 2.3.4
$ansible --version
ansible [core 2.13.3]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/<username>/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.9/site-packages/ansible
ansible collection location = /home/<username>/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.9.13 (main, Nov 16 2022, 15:11:16) [GCC 8.5.0 20210514 (Red Hat 8.5.0-15.0.1)]
jinja version = 3.1.2
libyaml = True
我认为第一步是弄清楚为什么我的流浪者找不到 ansible