How can I pass a relative path so that Ansible can copy files from node/keys
and copy them to a server?
The playbook is ansible/playbook
.
My directory structure is:
├── ansible
│ ├── inventory
│ └── playbook
├── node
│ ├── keys
│ ├── index.js
│ ├── node_modules
│ ├── package-lock.json
│ └── utils
└── shell
├── data.json
├── create-data.sh
├── destory.sh
└── firewall-rules.sh
Below is the playbook:
- hosts: all
vars:
source: "{{ source }}"
destination: /home/ubuntu
tasks:
- name: Copy files
copy:
src: "{{ source }}"
dest: "{{ destination }}"
That's how I run:
ansible-playbook -i inventory/inventory.yaml playbook/crypto-generate.yaml
--extra-vars "source=../node/keys"
I am trying to pass a relative path.