如何在命令行中将变量传递给 ansible playbook? [英] How can I pass variable to ansible playbook in the command line?

查看:37
本文介绍了如何在命令行中将变量传递给 ansible playbook?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 ansible 的新手,不知道如何操作,因为以下不起作用

I'm new to ansible and wonder how to do so as the following didn't work

ansible-playbook -i '10.0.0.1,' yada-yada.yml --tags 'loaddata' django_fixtures="tile_colors"

其中 django_fixtures 是我的变量.

推荐答案

阅读文档我找到了 在命令行上传递变量,给出了这个例子:

Reading the docs I find the section Passing Variables On The Command Line, that gives this example:

ansible-playbook release.yml --extra-vars "version=1.23.45 other_variable=foo"

其他示例演示了如何从 JSON 字符串(≥1.2)或文件(≥1.3)加载

Others examples demonstrate how to load from JSON string (≥1.2) or file (≥1.3)

这篇关于如何在命令行中将变量传递给 ansible playbook?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆