Ansible 与 Packer
Ansible with Packer
我正在尝试让加壳器 ansible provisioner 使用用户名和密码,但是由于身份验证步骤失败,使用 ansible 的配置一直停滞不前。
这是我的 Packer Ansible 配置脚本。
{
"type": "ansible",
"user": "pi",
"playbook_file": "playbook.yml",
"extra_arguments": [
"--extra-vars",
"ansible_python_interpreter=/usr/bin/python3",
"--extra-vars",
"ansible_user=pi",
"--extra-vars",
"ansible_ssh_pass=raspberry",
"-vvv"
]
}
我完全不知道为什么这不起作用。
卡住的输出如下
armpi: ==> arm-image: Executing Ansible: ansible-playbook --extra-vars packer_build_name=arm-image packer_builder_type=arm-image -i /tmp/packer-provisioner-ansible288108417 playbook.yml -e ansible_ssh_private_key_file=/tmp/ansible-key528332842 --extra-vars ansible_python_interpreter=/usr/bin/python3 --extra-vars ansible_ssh_user=pi --extra-vars ansible_ssh_pass=raspberry -vvv
看起来它正在尝试使用 ansible_ssh_private_key_file=/tmp/ansible-key528332842
但我不希望它使用我真的只是希望它使用用户名和密码登录。
来自 ansible
配置文件的顶部:
The ansible Packer provisioner runs Ansible playbooks. It dynamically
creates an Ansible inventory file configured to use SSH, runs an SSH
server, executes ansible-playbook, and marshals Ansible plays through
the SSH server to the machine being provisioned by Packer.
Note: Any remote_user
defined in tasks will be ignored. Packer will
always connect with the user given in the json config for this
provisioner.
ansible
配置器无法实现您尝试执行的操作。但是你可以通过 运行 ansible 和 shell-local
provisioner 来实现你尝试做的事情。
(要获取要在 Ansible 清单中使用的 VM 的 IP 地址,您可以遵循我在 this post 中建议的一般模式。)
我正在尝试让加壳器 ansible provisioner 使用用户名和密码,但是由于身份验证步骤失败,使用 ansible 的配置一直停滞不前。
这是我的 Packer Ansible 配置脚本。
{
"type": "ansible",
"user": "pi",
"playbook_file": "playbook.yml",
"extra_arguments": [
"--extra-vars",
"ansible_python_interpreter=/usr/bin/python3",
"--extra-vars",
"ansible_user=pi",
"--extra-vars",
"ansible_ssh_pass=raspberry",
"-vvv"
]
}
我完全不知道为什么这不起作用。
卡住的输出如下
armpi: ==> arm-image: Executing Ansible: ansible-playbook --extra-vars packer_build_name=arm-image packer_builder_type=arm-image -i /tmp/packer-provisioner-ansible288108417 playbook.yml -e ansible_ssh_private_key_file=/tmp/ansible-key528332842 --extra-vars ansible_python_interpreter=/usr/bin/python3 --extra-vars ansible_ssh_user=pi --extra-vars ansible_ssh_pass=raspberry -vvv
看起来它正在尝试使用 ansible_ssh_private_key_file=/tmp/ansible-key528332842
但我不希望它使用我真的只是希望它使用用户名和密码登录。
来自 ansible
配置文件的顶部:
The ansible Packer provisioner runs Ansible playbooks. It dynamically creates an Ansible inventory file configured to use SSH, runs an SSH server, executes ansible-playbook, and marshals Ansible plays through the SSH server to the machine being provisioned by Packer.
Note: Any
remote_user
defined in tasks will be ignored. Packer will always connect with the user given in the json config for this provisioner.
ansible
配置器无法实现您尝试执行的操作。但是你可以通过 运行 ansible 和 shell-local
provisioner 来实现你尝试做的事情。
(要获取要在 Ansible 清单中使用的 VM 的 IP 地址,您可以遵循我在 this post 中建议的一般模式。)