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

??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.lryc.cn/news/439758.html

相关文章:

  • 清理Go/Rust编译时产生的缓存
  • 【linux】 ls命令
  • STM32的寄存器深度解析
  • win11 运行vmware workstation 虚拟机很卡,解决办法
  • C语言 | Leetcode C语言题解之第404题左叶子之和
  • jeesite支持db2数据库初始化sql
  • 微信小程序页面制作——婚礼邀请函(含代码)
  • 股票量化接口api,国内股票期权怎么交易
  • Spring解决循环依赖的原理
  • Openal o1初探
  • 基于python+django+vue的学生成绩管理系统
  • mimd 公平收敛在相图中的细节
  • 爬虫--翻页tips
  • 论文内容分类与检测系统源码分享
  • 【MySQL】将表导出CSV(可以使用excel打开)
  • 通用四期ARM架构银河麒麟桌面操作系统V10【安装、配置FTP服务端】
  • 梧桐数据库(WuTongDB):RBO(Rule-Based Optimizer)优化器简介
  • 【农信网-注册/登录安全分析报告】
  • Gitea Action 简单配置(CI/CD)
  • 苍穹外卖 修改nginx的端口后websocket连接失败解决
  • 快速解决Linux中wine程序中文显示为方块的问题
  • 【C++前后缀分解 动态规划】2100. 适合野炊的日子|1702
  • HarmonyOS 速记
  • 使用 Milvus、vLLM 和 Llama 3.1 搭建 RAG 应用
  • 【springboot】父子工程项目搭建
  • 【Paper Reading】结合 NanoFlow 研究,优化大语言模型服务效率的探索
  • 达芬奇竖屏导出有黑屏解决方案
  • Elasticsearch Java API 针对 Geohash7 网点进行分桶聚合
  • Transformer学习(1):注意力机制
  • spring模块(六)spring event事件(3)广播与异步问题