zoukankan      html  css  js  c++  java
  • ansible常用命令

    # 检查主机连接
    # ansible test -m ping

    # 执行远程命令
    # ansible test -m command -a 'uptime'

    # 执行主控端脚本
    # ansible test -m script -a '/etc/ansible/script/test.sh'

    # 执行远程主机的脚本
    # ansible test -m shell -a 'ps aux|grep zabbix'

    # 类似shell
    # ansible test -m raw -a "ps aux|grep zabbix|awk '{print $2}'"

    # 创建软链接
    # ansible test -m file -a "src=/etc/resolv.conf dest=/tmp/resolv.conf state=link"

    # 删除软链接
    # ansible test -m file -a "path=/tmp/resolv.conf state=absent"

    # 复制文件到远程服务器
    # ansible test -m copy -a "src=/etc/ansible/ansible.cfg dest=/tmp/ansible.cfg owner=root group=root mode=0644"

    # 指定主机

    #ansible -i /etc/ansible/hosts all -m copy -a "src=test.conf dest=/etc/test.conf owner=root group=root mode=0644"

  • 相关阅读:
    面向对象——多态
    面向对象——继承
    面向对象—封装
    数组
    控制语句
    认识Java
    出入境大厅流程
    2021上半年感想
    记录2020
    读后感《从三分钟热度到一万个小时》
  • 原文地址:https://www.cnblogs.com/mikeluwen/p/6282144.html
Copyright © 2011-2022 走看看