ansible05 命令模块
来源:互联网 发布:linux find mtime时间 编辑:程序博客网 时间:2024/06/03 17:28
常用模块
1.调试测试类
ping: ping一下远程主机,如果可以通,那么返回pong.
ansible all -m ping
debug:用于调试模块,只是简单的打印一些信息,像echo
ansible all -m debug
2.文件类
copy:从本地复制文件到远程节点.
ansible all -m copy -a "src=original-ks.cfg dest=/tmp/ owner=foo group=foo mode=0664" 设置文件权限
ansible all -m copy -a "src=original-ks.cfg dest=/tmp/ backup=yes" 备份节点上原来的文件
ansible all -m copy -a "src=/etc/sudoers dest=/etc/sudoers validate='visudo -cf %s'" 复制文件后验证操作
template:从本地复制文件到远程节点,并进行变量的替换.
file:设置文件属性
ansible all -m file -a "path=/tmp/original-ks.cfg owner=root group=root state=touch" 创建文件
ansible all -m file -a "src=/tmp/original-ks.cfg dest=/tmp/test1 owner=root group=root state=link" 软连接
ansible all -m file -a "path=/tmp/t2 owner=root group=root state=directory mode=0755" 创建目录
3.linux 常用操作
user:添加,删除,修改用户
ansible all -m user -a "name=johnd1 comment=johnd1 uid=1040 group=root" 创建用户johnd1 root组
ansible all -m user -a "name=johnd3 shell=/bin/bash groups=root,johnd2" 添加到两个组中
ansible all -m user -a "name=johnd3 state=absent remove=yes" 删除用户
yum:安装包
ansible all -m yum -a "name=httpd state=latest" 安装最新版本httpd
ansible all -m yum -a "name=httpd state=absent" 删除包
service 服务管理模块
ansible all -m service -a "name=httpd state=started"
ansible all -m service -a "name=httpd state=stopped"
ansible all -m service -a "name=httpd state=restarted"
ansible all -m service -a "name=httpd state=reloaded"
ansible all -m service -a "name=httpd enabled=yes"
firewalld
4.执行shell命令
shell
command
- ansible05 命令模块
- linux的模块命令
- 内核模块加载命令
- 编译内核模块命令
- Linux加载模块命令
- linux 模块相关命令
- 内核模块相关命令
- 内核模块加载命令
- 创建Perl模块命令
- linux模块管理命令
- linux模块管理命令
- linux模块管理命令
- fvwm 模块命令
- 内核模块相关命令
- Linux模块相关命令
- 内核模块加载命令
- insmod等模块命令
- blade模块命令集
- 03:八进制小数
- java中的super限定
- redis 简单使用总结
- 理解B树,B+树
- 2017年07月30日
- ansible05 命令模块
- 如何掌握所有的程序语言
- 收包函数调用流程
- hdu 2077 汉诺塔IV
- JavaScript--数组
- JS学习第5天
- Python的算法编程
- location.href和location.search区别
- 云计算中基于机器学习的调度研究综述