在 Ansible 中使用脚本模块 [英] Using the Script Module in Ansible

查看:25
本文介绍了在 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 中使用脚本模块,但我不确定如何合并额外的参数.

in Ansible using the script module but I'm not sure how to incorporate the extra args.

推荐答案

首先,您不使用 script 模块运行可执行文件,而是使用 commandshell 模块.

Firstly, you don't run an executable using script module, but using a command or shell module.

其次,您应该利用 Ansible 事实.架构(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屋!

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