vla*_*neo 8 ansible ansible-playbook
如果我的节点上存在一个定义文件并且还输出以解释该剧本已经停止的原因,是否可以在执行期间停止一个剧本?
这是为了防止在已经安装了我的应用程序的节点上意外重新执行我的playbook,因为我在此安装过程中生成了密码而我不想重新初始化此密码.
yda*_*coR 11
您可以使用故障模块通过自定义故障消息强制发生故障.
使用stat模块将其与文件检查结合起来,这应该足够容易.
一个快速示例或一个运行的剧本可能看起来像这样:
- name: check for foo.conf
stat: path=/etc/foo.conf
register: foo
- name: fail if already run on host
fail: msg="This host has already had this playbook run against it"
when: foo.stat.exists
- name: create foo.conf
file: path=/etc/foo.conf state=touch
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
4087 次 |
最近记录: |