在Ansible Playbook插件中如何添加多个清单文件

huangapple go评论140阅读模式
英文:

in ansiblePlaybook plugin how to add multiple inventory files

问题

这是 Ansible Playbook。我有两个清单文件。如何在下面的命令中添加这两个?

ansiblePlaybook(
    playbook: 'ansible/playbooks/stop-start.yml',
    inventory: ['ansible-inventory-file1', 'ansible-inventory-file2'],
    credentialsId: 'test-ssh',
    hostKeyChecking: false,
    extraVars: [
        action: "stop",
        deploy_env: "${Environment}",
    ],
)
英文:

This is ansible playbook. I have two inventory files. How can I add those two in the below command?

ansible-inventory-file1
ansible-inventory-file1

 ansiblePlaybook(
        playbook: 'ansible/playbooks/stop-start.yml',
        inventory: 'ansible-inventory-file1',
        credentialsId: 'test-ssh',
        hostKeyChecking: false,
        extraVars: [
        action: "stop",
        deploy_env: "${Environment}",	  
      ],

答案1

得分: 2

把文件放入一个目录中

shell> tree ansible-inventory/
ansible-inventory/
├── file1
└── file2

0 directories, 2 files

使用这个目录

         inventory: 'ansible-inventory',
英文:

Put the files into a directory

shell> tree ansible-inventory/
ansible-inventory/
├── file1
└── file2

0 directories, 2 files

Use this directory

         inventory: 'ansible-inventory',

huangapple
  • 本文由 发表于 2023年3月7日 06:50:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/75656547.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定