當我執行我的CP-sshkey.yml劇本(登錄爲我自己,不是無業遊民用戶)從我的頂級Vagrantfile目錄...爲什麼我無法將SSH密鑰複製到Vagrant VM?
ansible-playbook cp-sshkey.yml
我得到這個錯誤:
TASK: [authorized_key user=vagrant key="{{ lookup('file', './files/id_rsa_vagrant.pub') }}"] ***
fatal: [web1] => Failed to template user=vagrant key="{{ lookup('file', './files/id_rsa_vagrant.pub') }}": could not locate file in lookup: ./files/id_rsa_vagrant.pub
我不明白爲什麼會發生此錯誤。這是一個非常簡單的劇本和公共密鑰文件是我說的是:
.
├── .vagrant
│ └── machines
├── Vagrantfile
├── ansible.cfg
├── bootstrap-mgmt.sh
├── files
│ └── id_rsa_vagrant.pub
├── inventory.ini
├── secrets.yml
├── site.yml
├── website
└── cp-sshkey.yml
,這裏是我的配置和主機文件和劇本:
# ansible.cfg
[defaults]
hostfile = inventory.ini
remote_user = vagrant
private_key_file = .vagrant/machines/default/virtualbox/private_key
host_key_checking = False
# inventory.ini
[local]
localhost ansible_connection=local
[web]
web1 ansible_ssh_host=127.0.0.1 ansible_ssh_port=2222
# cp-sshkey.yml
- name: Install vagrant's public key on VM
hosts: web1
sudo: True
tasks:
- authorized_key: user=vagrant key="{{ lookup('file', './files/id_rsa_vagrant.pub') }}"
我在做什麼錯在這裏?謝謝。
你絕對應該用'ansible'以及標籤這個問題客人使用的操作系統。 –
你最終的版本是什麼?我相信1.9分支報告 –
我使用Ansible 1.9.2。 – William