zoukankan      html  css  js  c++  java
  • Ansible 的 ad-hoc

    1.什么是ad-hoc

    ad-hoc简而言之就是远程执行“临时命令”,执行完即结束,并不会保存

    2.ad-hoc使用场景

    比如在多台机器上查看某个进程是否启动,或拷贝指定文件到本地,等等

    3.ad-hoc使用

    [root@m01 ~]# ansible 'web01' -m shell -a 'free -m'
    web01 | CHANGED | rc=0 >>
                  total        used        free      shared  buff/cache   available
    Mem:            972         110         461          19         400         667
    Swap:          2047           0        2047

    4.ad-hoc返回结果颜色含义

    绿色: 代表被管理端主机没有被修改
    黄色: 代表被管理端主机发现变更
    红色: 代表出现了故障,注意查看提示
    紫色:警告

    5.ad-hoc常用模块

    command             # 执行shell命令(不支持管道等特殊字符)
    shell               # 执行shell命令
    script              # 执行shell脚本
    yum_repository      # 配置yum仓库
    yum                 # 安装软件
    copy                # 变更配置文件
    file                # 建立目录或文件
    service             # 启动与停止服务
    mount               # 挂载设备
    cron                # 定时任务
    get_url             # 下载软件
    firewalld           # 防火墙
    selinux             # selinux

    6.ad-hoc帮助

    #查看所有模块
    [root@m01 ~]# ansible-doc -l
    
    #常看指定模块使用方法
    [root@m01 ~]# ansible-doc command
    EXAMPLES:
    
    #查看模块可以使用的参数
    [root@m01 ~]# ansible-doc -s file
  • 相关阅读:
    .net MVC 下载文件乱码问题解决方案
    javascript将json转字符串
    js中将字符串转换成json的三种方式
    mvc项目,导出到Excel,中文显示乱码
    20160606面试题总结
    bzoj 4318: OSU!
    bzoj 1419: Red is good
    Codeforces 123 E Maze
    HDU 4336 Card Collector
    Codeforces 540 D Bad Luck Island
  • 原文地址:https://www.cnblogs.com/chenlifan/p/13777162.html
Copyright © 2011-2022 走看看