当前位置: 首页 > article >正文

??Ansible——ad-hoc

文章目录

    • 一、ad-hoc介绍
    • 二、ad-hoc的使用
      • 1、语法
      • 2、ad-hoc常用模块
        • 1)shell模块
        • 2)command模块
        • 3)script模块
        • 4)file模块
        • 5)copy模块
        • 6)yum模块
        • 7)yum-repository模块
        • 8)service模块
        • 9)systemd模块
        • 10)user模块
        • 11)group模块
        • 12)mount模块
        • 13)unarchive模块

一、ad-hoc介绍

在这里插入图片描述

二、ad-hoc的使用

1、语法

???

2、ad-hoc常用模块

在这里插入图片描述

1)shell模块
ansible web_group -m shell -a 'df -h'
ansible web_group -m shell -a 'ps -ef | grep nginx'
2)command模块

不能全部识别shell中的特殊符号,如:command无法使用管道符“|”

验证:

ansible web_group -m command -a 'ps -ef | grep nginx'
3)script模块

管理机脚本推送到其他机器中

ansible web_group -m script -a '/root/test_script_module.sh'
4)file模块

在这里插入图片描述
有什么用:

动作:

状态:

5)copy模块

在这里插入图片描述

6)yum模块

有什么用:

动作:

  • 1
  • 2
  • 3

状态:

  • 1
  • 2
ansible db01 -m yum -a "name=mariadb-server state=present"
7)yum-repository模块

有什么用:

动作:
根据仓库文件的内容的选项:

  • name
    表示仓库的名字

  • description
    对仓库的描述信息

  • baseurl

  • file

  • owner

  • group

  • gpgcheck

    • =yes
    • =no
  • enabled

    • =yes
    • =no

状态:

  • state=present
    创建

  • state=absent
    删除

在这里插入图片描述

#删除仓库:
ansible web01 -m yum_repository -a 'name=nginx-stable-repos state=absent'
8)service模块

有什么用:

动作:

  • name
    服务名

状态:

  • started
  • stopped
  • restarted
  • reloaded
9)systemd模块

在这里插入图片描述

10)user模块

在这里插入图片描述

11)group模块

在这里插入图片描述

12)mount模块

在这里插入图片描述

13)unarchive模块

在这里插入图片描述


http://www.kler.cn/news/306076.html

相关文章:

  • 修改 HTTP 和 HTTPS 代理设置为 `http://127.0.0.1:8118
  • 【Android Studio】API 29(即Android 10)或更高版本,在程序启动时检查相机权限,并在未获取该权限时请求它
  • AI学习指南深度学习篇-Adam的基本原理
  • 计算机三级 - 数据库技术 - 第十三章 大规模数据库架构 笔记
  • 速通LLaMA1:《LLaMA: Open and Efficient Foundation Language Models》全文解读
  • ARM驱动学习之9注册字符类设备
  • Robot Operating System——带有时间戳和坐标系信息的线速度和角速度
  • 51单片机+proteus+(DS1302+DS18B20)
  • css选择器有几种?选择器的优先级是怎样的?
  • [网络][CISCO]Cisco-PIX配置详解
  • Leetcode 3290. Maximum Multiplication Score
  • 通过C# 裁剪PDF页面
  • python+adb
  • IP池对数据爬取工作的帮助
  • 【Android Studio】使用雷电模拟器调试
  • Acrobat XI 安装教程
  • 后端入门 (JQuery基础) 01
  • 3.1 通信协议
  • 多线程进阶
  • 随想录笔记-二叉树练习题
  • 服务器出现访问卡慢的原因有哪些
  • Nature Communications 可远程操控食欲的口服软体机器人
  • gogps 利用广播星历解算卫星位置matlab函数satellite_orbits详细注解版
  • 【Android 13源码分析】WindowContainer窗口层级-2-构建流程
  • 详细介绍 Servlet 基本概念——以餐厅服务员为喻
  • Linux下write函数
  • PG表空间
  • Android命令行查看CPU频率和温度
  • 鲸天科技外卖会员卡系统更专业
  • Spring源码(12)-- Aop源码