首页 > 其他分享 >常用模块

常用模块

时间:2023-01-16 17:26:06浏览次数:38  
标签:tmp 常用 127.0 file 0.1 state ansible 模块

ping 模块
ansible all -m ping
fetch
# ansible-doc -s fetch 从远端拉取文件
ansible 127.0.0.1 -m fetch -a "src=/etc/hosts dest=/tmp mode=0755  owner=test"
copy
ansible 127.0.0.1 -m copy -a "src=/etc/hosts dest=/tmp/hosts mode=0755 owner=test"
file
# ansible-doc -s file  创建/删除 文件/目录/软连接
ansible 127.0.0.1 -m file -a "path=/tmp/a.log state=touch owner=test mode=0600"

ansible 127.0.0.1 -m file -a "path=/tmp/a.log state=absent"

ansible 127.0.0.1 -m file -a "path=/tmp/a/b state=directory recurse=yes"

ansible 127.0.0.1 -m file -a "path=/tmp/a state=absent"

ansible 127.0.0.1 -m file -a "path=/tmp/a state=link src=/etc/hosts"
command
ansible 127.0.0.1 -m  command -a "chdir='/' ls -a"
shell
# 支持管道,command 不支持
ansible 127.0.0.1 -m  shell -a "chdir='/' ls -a|wc"

script

# /tmp/1.sh 在运维主机
ansible 127.0.0.1 -m  script -a "chdir='/' /tmp/1.sh"

systemd
ansible all -m systemd -a "daemon-reload=yes"
ansible all -m systemd -a "name=network state=restarted enabled=yes"

command 和shell 可以说是一个万能模块,如果运维中不知道ansible 中哪个模块可以实现你的功能,这个时间他们哥俩想必可以帮上忙

标签:tmp,常用,127.0,file,0.1,state,ansible,模块
From: https://www.cnblogs.com/wangend/p/17055916.html

相关文章

  • String 常用方法总结
    String常用方法(JavaSE)常用实例方法求字符串某一位置字符publiccharcharAt(intindex)//返回字符串中指定位置的字符;注意字符串中第一个字符索引是0,最后一个是le......
  • 双麦克风降噪拾音模块解决方案总结及样品展示
    突破 当客户发来满意的笑容时,我的内心才安静下来。喔,又一个山峰被踩在脚下了。随着拾音场景化的需求越来越特殊,双麦克风降噪拾音成为了一些用户的刚需。再次需求上,团队......
  • JumpServer 常用的 MFA 工具
    JumpServer常用的MFA工具安卓版:googleauthenticatormicrosoftauthenticator阿里云App虚拟MFACKEY令牌IOS版:googleauthenticatormicrosoftauthenticator阿里云ap......
  • 3. DRF进阶之DRF视图和常用功能
    DRF视图和常用功能DRF视图DRF视图类介绍在DRF框架中提供了众多的通用视图基类与扩展类,以简化视图的编写。View:Django默认的视图基类,负责将视图连接到URL,HTTP请求方法......
  • logging 模块详解
    日志记录函数以它们用来跟踪的事件的级别或严重性命名。下面描述了标准级别及其适用性(从高到低的顺序)日志等级(level)描述DEBUG 最详细的日志信息,典型应用场景是问......
  • python random模块
    random()函数random()函数可以随机生成一个[0,1)的浮点数。例如importrandomprint(random.random())0.7258069853437111randint(a,b)函数randint(a,b)函数可以......
  • MeterSphere接口测试模块中循环控制器的使用
    MeterSphere开源持续测试平台的“接口测试”模块具有灵活的接口场景编排设计,模块覆盖了多种接口协议,可自由组合接口自动化测试场景,为接口测试带来方便快捷的体验。其中,逻辑......
  • Linux 最常用命令
    操作系统概述操作系统OperatingSystem简称OS,通俗讲就是一款软件,不过和一般的软件不同,操作系统是管理和控制计算机硬件与软件资源的计算机程序,是直接运行在“裸机”上......
  • 河北稳控科技振弦采集模块配置工具VMTool生成寄存器值
    河北稳控科技振弦采集模块配置工具VMTool生成寄存器值 生成寄存器值VMXXX有很多按位使用的寄存器,使用VMTool工具可进行方便的设置,当需要知道寄存器的实际值时,可通......
  • 振弦采集模块配置工具VMTool生成寄存器值
    振弦采集模块​配置​工具VMTool生成寄存器值生成寄存器值VMXXX有很多按位使用的寄存器,使用VMTool工具可进行方便的设置,当需要知道寄存器的实际值时,可通过以下两种方......