ansible常用模块

ansible 核心模块之 raw

2020-12-15  本文已影响0人  wh0am11

rwa模块

raw 模块用于在远程主机上执行 ansible 管理主机上的脚本

参数 (=号后面的参数强制要求):

必须参数,指定需要远程执行的命令,但是并没有具体的一个参数名叫 free_form

注意:

区别:

实例:

- name: Bootstrap a legacy python 2.4 host
  raw: yum -y install python-simplejson

- name: Bootstrap a host without python2 installed
  raw: dnf install -y python2 python2-dnf libselinux-python

- name: Run a command that uses non-posix shell-isms (in this example /bin/sh doesn't handle redirection and wildcards together but bash does)
  raw: cat < /tmp/*txt
  args:
    executable: /bin/bash

- name: safely use templated variables. Always use quote filter to avoid injection issues.
  raw: "{{package_mgr|quote}} {{pkg_flags|quote}} install {{python_simplejson|quote}}"
上一篇下一篇

猜你喜欢

热点阅读