ansible实践
ansible常用module
ansible-doc
-l List available modules
-s Show playbook snippet for specified module(s) ansible: ansible <host-pattern> [-f forks] [-m module_name] [-a args]
args:
key=value 注意:command模块要执行命令无须为key=value格式,而是直接给出要执行的命令即可; 常用模块:
command
-a 'COMMAND'
#查看web组磁盘空间使用率
ansible web -m command -a 'df -h' user
-a 'name= state={present|absent} system= uid='
#创建系统账户test,uid为444
ansible test -m user -a 'name=test state=present system=yes uid=444'
ansible test -m user -a 'name=test state=absent' group
-a 'name= gid= state= system=' cron
-a 'name= minute= hour= day= month= weekday= job= user= state='
#每3分钟做一次时间同步
ansible test -m cron -a 'name="custom job" minute=*/3 job="/usr/sbin/ntpdate 172.16.254.23"'
ansible test -m cron -a 'name="custom job" state=absent' copy
-a 'dest= src= mode= owner= group='
ansible test -m copy -a 'src=/root/a.sh dest=/tmp/ owner=root group=root mode=0755' file
-a 'path= mode= owner= group= state={directory|link|present|absent} src='
ansible test -m file -a 'path=/tmp/a.sh state=absent' ping
ansible web -m ping yum
-a 'name= state={present|latest|absent}'
ansible test -m yum -a 'name=httpd state=latest'
ansible test -m yum -a 'name=httpd state=absent' service
-a 'name= state={started|stopped|restarted} enabled='
ansible test -m service -a 'name=httpd state=started enabled=yes' shell
-a 'COMMAND'
ansible test -m shell -a 'chkconfig --list httpd' script
-a '/path/to/script'
ansible test -m script -a '/root/a.sh' setup
ansible web -m setup synchronize
-a 'src= dest= mode={pull|push} rsync_opts="auv"'
ansible webg:webappg -m synchronize -a 'src=/app/webapps/app/ dest=/app/webapps/app/ mode=push rsync_opts="-av"'
ansible实践的更多相关文章
- Nebula Graph 的 Ansible 实践
本文首发于 Nebula Graph 公众号 NebulaGraphCommunity,Follow & 看大厂图数据库技术实践 背景 在 Nebula-Graph 的日常测试中,我们会经常在 ...
- ansible实践4- 管理配置文件
生产环境中大多时候是需要管理配置文件的,安装软件包只是在初始化环境的时候用一下.下面我们来写个管理nginx配置文件的playbook mkdir -p /etc/ansible/nginx_c ...
- ansible实践3-playbook条件判断
--- - hosts: testhost user: root gather_facts: True tasks: - name: use when shell: t ...
- ansible实践2-拷贝文件或目录
ansible testhost -m copy -a "src=/etc/ansible dest=/tmp/ansibletest owner=root group=root mo ...
- ansible实践-1
不需要安装客户端,通过sshd去通信 基于模块工作,模块可以由任何语言开发 不仅支持命令行使用模块,也支持编写yaml格式的playbook 支持sudo 有提供UI(浏览器图形化)www.ans ...
- Ansible实践总结
Ansible playbook 根据条件动态设置变量 首先新建 inventory,主机列表如下: node-01 ansible_host=192.168.64.30 node-02 ansibl ...
- Ansible - 简介和应用自动化基础实践
installAnsible简介和应用自动化基础实践 一.引入: 1.1 如官方定义,Ansible is The simplest way to automate apps and IT infr ...
- 《Ansible自动化运维:技术与佳实践》第二章读书笔记
Ansible 安装与配置 本章主要讲的是 Ansible 安装与基本配置,主要包含以下内容: Ansible 环境准备 安装 Ansible 配置运行环境 Ansible 环境准备 从 GitHub ...
- ansible服务部署与使用
第1章 ssh+key实现基于密钥连接(ansible使用前提) 说明: ansible其功能实现基于SSH远程连接服务 使用ansible需要首先实现ssh密钥连接 1.1 部署ssh ...
随机推荐
- css实现背景全透明样式
background-color:transparent; filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#26FFF ...
- 好吧,关于nginx
今天在看关于nginx的文章,自己也动手试了一下. 我是在本地测试的,在IIS上面绑了两个网站,端口号不同.当我把IIS配置好以后,修改了nginx的conf文件. nginx配置: nginx配置好 ...
- 写点恐怖小说为自己打call
https://github.com/zhangbo2008/TryingWriteHorrorStory
- linux实操_shell运算符
1."$((运算式))"或"[运算式]" 2.expr m + n 注意:expr运算符要有空格 3.expr m - n 4.expr \*,/,/% 乘,除 ...
- python ini文件内容的读取
(1)新建一个项目,再次新建一个文件 test_cfg.ini (2)再次新建 get_test_cfg.py,用来读取/写入/更改 ini的文件内容 #!/usr/bin/env python # ...
- 模块讲解---time模块,datetime模块,random模块,hashlib模块和hmac模块,typing模块,requests模块,re模块
目录 1. 包 2. time模块 1. 优先掌握 2. 了解 3. datetime模块 1. 优先掌握 4. random模块 1. 优先掌握 2. 了解 5. hashlib模块 ...
- airflow--Error: Already running on PID 22603 (or pid file '/home/rdev/airflow/airflow-webserver.pid' is stale)
kill这个残留进程然后直接重新启动airflow webserver就OK (wqbin) rdev@testhk1:~/etl/py_etl/warehouse$ cat /home/rdev/a ...
- flutter 编译报错 ../extended_network_image_provider.dart:63:41: Error: Type 'DecoderCallback' not found
flutter 编译的时候报错 Compiler message:../../../.pub-cache/hosted/pub.dartlang.org/extended_image_library- ...
- Luogu P3690【模板】Link Cut Tree (LCT板题)
省选前刷道LCT板题(话说之前没做这道题-) CODE #include<bits/stdc++.h> using namespace std; inline void read(int ...
- 五十七.分布式ELK平台、ES安装 、 扩展插件 、Kibana安装
1. ES集群安装 准备1台虚拟机 部署elasticsearch第一个节点 访问9200端口查看是否安装成功 1ELK是日志分析平台,不是一款软件,而是一整套解决方案,是三个软件产品的首字母缩写 ...