1、command 用于查看文件内容,查看磁盘,内存,启动命令等纯命令信息
ansible portal -m command -a "cat /test1/test"
2、ping 检查应用是否开启
ansible portal -m ping
3、copy 将本地文件批量发送到远程服务器上
ansible portal -m copy -a 'src=/test/l.txt dest=/tmp/'
4、file 更改远程文件的权限及属主属组
ansible portal -m file -a "dest=/test mode=755 owner=root group=root"
5、cron 编写、注释定时任务(取消掉注释:disabled=no)
ansible portal -m cron -a 'name="custom job" minute=*/5 hour=* day=* month=* weekday=* job="/bin/bash /server/scripts/df-h.sh >/dev/null 2>&1" disabled=yes'
6、group 在所有节点上创建一个组名为jun gid为2018的组
ansible portal -m group -a "gid=2018 name=jun"
7、user 创建用户,删除用户 present:无则创建,有则不创建
ansible portal -m user -a "name=boy groups=jun state=present" (添加用户)
ansible portal -m user -a "name=boy state=absent remove=yes" (删除用户)
8、yum 远程下载
ansible portal -m yum -a "state=present name=lrzsz"
9、service 远程开启自启服务
ansible portal -m service -a "name=rsyslog state=restarted enabled=yes"
ansible portal -m service -a "name=rsyslog state=stopped enabled=no"
10、script 远程执行脚本(本地脚本在远程服务器上执行)
ansible portal -m script -a '/server/scripts/mk.sh'

ansible远程运维操作的更多相关文章

  1. Ansible自动化运维工具-上

    [Ansible特点] 1)Ansible与saltstack均是基于Python语言开发的 2)安装使用简单,基于不同插件和模块实现各种软件,平台,版本的管理以及支持虚拟容器多层级的部署 3)不需要 ...

  2. ansible 自动化运维

    Ansible 自动化运维 ansible安装epel #yum list all *ansible*#yum install *ansible*#yum info ansible#rpm -ql a ...

  3. Ansible 自动化运维工具

    Ansible 自动化运维工具 Ansible是什么? Ansible是一个"配置管理工具"也是一个"自动化运维工具" Ansible 作用: Ansible是 ...

  4. ansible自动化运维03

    ansible自动化运维常用模块 常用模块实现的功能:安装软件包:修改配置文件:创建程序用户组:创建目录,并修改所属和权限:挂载:启动服务:测试. command模块: shell模块: 注意:com ...

  5. 简单聊一聊Ansible自动化运维

    一.Ansible概述 Ansible是今年来越来越火的一款开源运维自动化工具,通过Ansible可以实现运维自动化,提高运维工程师的工作效率,减少人为失误.Ansible通过本身集成的非常丰富的模块 ...

  6. Ansible自动化运维工具及其常用模块

    Ansible自动化运维工具及其常用模块 目录 Ansible自动化运维工具及其常用模块 一.Ansible简介 1. Ansible概述 2. Ansible作用 3. Ansible的工作模块 4 ...

  7. 一文详解 Ansible 自动化运维

    开源Linux 一个执着于技术的公众号 一.Ansible 概述 Ansible 是近年来越来越火的一款开源运维自动化工具,通过Ansible可以实现运维自动化,提高运维工程师的工作效率,减少人为失误 ...

  8. TiOps,支持容器,支持多云安全远程运维,疫情期间免费开放,助力远程办公

    TiOps,支持多云环境安全远程运维,疫情期间免费对外开放在疫情期间,为减少疾病传染可能性,许多公司的选择了在家远程办公.对于运维来说,既要远程运维,又要保证安全,还要在复杂的IT环境中保持高效,面临 ...

  9. Ansible自动化运维工具的使用

                                 Ansible自动化运维工具的使用       host lnventory 管理主机 ip  root账号密码 ssh端口 core mod ...

随机推荐

  1. ubuntu下配置JDK的一些坑点

    ubuntu下配置JDK的一些坑点 在centos下的JDK配置: 在ubuntu下的话,要修改两个地方: 在/etc/enviornment中配置! 在/etc/profile中配置! 写在最后: ...

  2. 老鼠走迷宫I

    转自:http://blog.csdn.net/holymaple/article/details/8582517 说明:老鼠走迷宫是递回求解的基本提醒,我们在二维阵列中使用2来表示迷宫墙壁,使用1来 ...

  3. springboot @value无法赋值

    1解决方式在类上在加@Compent @Component@EnableBinding(Sink.class)public class ReceiveMessageListenerController ...

  4. Java数八大据类型的拓展

    public class 数据类型拓展问题 { public static void main(String[] args) { //================================= ...

  5. vue-class和style样式绑定

    前言 操作元素的 class 样式列表和 style 内联样式为数据绑定是前端开发中一个常见的需求,这些样式都属于元素的属性 attribute ,因此我们可以通过 v-bind 来动态绑定元素的样式 ...

  6. Lucene入门及实际项目应用场景

    导入maven依赖 <dependency> <groupId>org.apache.lucene</groupId> <artifactId>luce ...

  7. Linux从头学12:读完这篇【特权级】文章,你就比别人更“精通”操作系统!

    作 者:道哥,10+年嵌入式开发老兵,专注于:C/C++.嵌入式.Linux. 关注下方公众号,回复[书籍],获取 Linux.嵌入式领域经典书籍:回复[PDF],获取所有原创文章( PDF 格式). ...

  8. RIAD配置

    一.RIAD 磁盘阵列介绍 二.阵列卡介绍 三.案例举例   一.RAID磁盘阵列介绍 是Redundant Array of Independent Disks的缩写,中文简称为独立冗余磁盘阵列 把 ...

  9. freeswitch python模块

    概述 freeswitch支持多种语言的业务开发,包括C/C++,java,python,js,lua,Golang等等.freeswitch在使用python做业务开发时,有俩种接入方式,一种是ES ...

  10. ysoserial CommonsColletions7分析

    CC7也是一条比较通用的链了,不过对于其原理的话,其实还是挺复杂的.文章如有错误,敬请大佬们斧正 CC7利用的是hashtable#readObject作为反序列化入口.AbstractMap的equ ...