在Ansible中使用脚本模块 [英] Using the Script Module in Ansible
本文介绍了在Ansible中使用脚本模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要运行此命令:
setarch $(uname -m) --uname-2.6 /opt/files/IBM/ITM/install.sh -q -h /opt/files/IBM/ITM/Install -p /opt/files/silent_install.txt
在Ansible中使用脚本模块,但是我不确定如何合并额外的args.
in Ansible using the script module but I'm not sure how to incorporate the extra args.
推荐答案
首先,您没有使用script
模块运行可执行文件,而是使用 shell
模块.
Firstly, you don't run an executable using script
module, but using a command
or shell
module.
其次,您应该使用荒谬的事实.体系结构(uname -m
的结果)存储在ansible_facts.architecture
事实中:
Secondly, you should utilise Ansible facts for that. The architecture (the result of uname -m
) is stored in the ansible_facts.architecture
fact:
command: setarch {{ ansible_facts.architecture }} --uname-2.6 /opt/files/IBM/ITM/install.sh -q -h /opt/files/IBM/ITM/Install -p /opt/files/silent_install.txt
这篇关于在Ansible中使用脚本模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文