how to use include_vars in ansible

前端 未结 1 1557
隐瞒了意图╮
隐瞒了意图╮ 2021-01-04 05:19

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

相关标签:
1条回答
  • 2021-01-04 05:51

    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
    
    0 讨论(0)
提交回复
热议问题