如何传递相对路径以便 Ansible 可以从服务器复制文件node/keys并将它们复制到服务器?
剧本是ansible/playbook。
我的目录结构是:
├── ansible
│ ├── inventory
│ └── playbook
├── node
│ ├── keys
│ ├── index.js
│ ├── node_modules
│ ├── package-lock.json
│ └── utils
└── shell
├── data.json
├── create-data.sh
├── destory.sh
└── firewall-rules.sh
下面是剧本:
- hosts: all
vars:
source: "{{ source }}"
destination: /home/ubuntu
tasks:
- name: Copy files
copy:
src: "{{ source }}"
dest: "{{ destination }}"
我就是这样跑的:
ansible-playbook -i inventory/inventory.yaml playbook/crypto-generate.yaml
--extra-vars "source=../node/keys"
我正在尝试传递相对路径。