I have created my own custom library, I added my custom library in the common folder of my repository. In that I need to pass variables dynamically. It\'s a confidential pas
You can't use include_vars
this way, it's only available for use under tasks
.
If sample_tasks.yml
is a list of tasks, you also can't use it on playbook level. See my other answer for explanation.
You can use vars_files
like this:
- hosts: localhost
vars_files:
- sample_vault.yml
tasks:
name: "free task"
command: ls -a
Or pass a file as extra variables:
ansible-playbook --ask-vault-pass -e @sample_vault.yml myplaybook.yml