ansible语法(2)

目录

fetch

注意:此功能是从其他远程主机下载到本地
|参数|说明|
|-|-|
|dest|远程机器中本地路径(仅能指定文件名),如果dest以/结尾,它将使用源文件的基础名称|
|src|远程机器的远程路径(禁止指定目录)|
|flat|仅传输文件|
传输文件(递归创建目录)

ansible test -m fetch -a "dest=~/ src=/etc/hosts"
ansible test -m shell -a "tree ~/"

仅传输文件

#递归删除
ansible test -m file -a "dest=~/192.168.255.101/ state=absent"
ansible test -m file -a "dest=~/192.168.255.102/ state=absent"
ansible test -m file -a "dest=~/192.168.255.103/ state=absent"
ansible test -m file -a "dest=~/192.168.255.104/ state=absent"
ansible test -m file -a "dest=~/192.168.255.105/ state=absent"
#下载远程机器上的文件
ansible test -m fetch -a "dest=~/ src=/etc/hosts flat=yes"
ansible test -m shell -a "ls ~/"

flat设置时,会覆盖同名文件

mount

猜你喜欢

转载自www.cnblogs.com/anyux/p/12004099.html