Ansible安装
来源:互联网 发布:资管新规 知乎 编辑:程序博客网 时间:2024/05/23 13:04
简介:
Ansible提供两种方式去完成任务,一是 ad-hoc 命令,一是写 Ansible playbook.前者可以解决一些简单的任务, 后者解决较复杂的任务.(类似于在命令行敲入shell命令和 写shell scripts两者之间的关系)…
1.安装
[root@localhost ~]# git clone git://github.com/ansible/ansible.git --recursive[root@localhost ~]# cd ansible/[root@localhost ~]# cd hacking/[root@localhost ~]# source ./env-setup[root@localhost ~]# ansible --version
2.编辑hosts文件,默认没有这个文件,自己创建
[root@localhost ~]# vim /etc/ansible/hosts[test]172.16.0.112
3.配置ssh无密码登录
[root@localhost ~]# ssh-keygen[root@localhost ~]# ssh-copy-id -i ~/.ssh/id_rsa.pub root@172.168.0.112
4.尝试几条操作
[root@localhost ~]# ansible all -m ping[root@localhost ~]# ansible constrol -m command -a 'date'[root@localhost ~]# ansible all -a "/bin/echo hello"[root@localhost ~]# ansible test -a "/usr/bin/python" -u root[root@localhost ~]# ansible test -m shell -a "echo $TERM" [root@localhost ~]# ansible 172.16.0.112 -m copy -a “src=/etc/hosts dest=/tmp/hosts"[root@localhost ~]# ansible 172.16.0.112 -m file -a "dest=/tmp/hosts mode=777"
参考链接:
http://www.ansible.com.cn/index.html
阅读全文
0 0
- ansible 安装
- ansible安装
- ansible 安装
- Ansible安装
- ansible安装
- Ansible安装
- ansible安装
- ansible安装
- ansible安装
- Ansible安装
- ansible安装
- Ansible安装
- 安装Ansible
- Ansible安装
- ansible安装
- 安装ansible
- ansible安装
- ansible安装
- 基础练习 杨辉三角形
- [Lintcode]删除链表中元素
- YOLO算法的Caffe实现
- Android 实现气泡布局/弹窗,可控制气泡尖角方向及偏移量
- java.lang.NoSuchMethodError: org.hibernate.Session.getFlushMode()Lorg/hibernate/FlushMode;
- Ansible安装
- [实训]web项目出现高频度读写数据库时失败的情况
- Android SharedPreferences 分析
- python模块安装撞墙的解决方法
- DES算法C语言可运行源代码
- strcpy源代码汇总
- 数组中最大第K元素(快排思想)
- 嵌入式数据库SQLite基础使用
- codeforces New Year Tree dfs序+线段树+状态压缩