Ansible基础

Ansible

GitHub:https://github.com/ansible/

官方:https://www.ansible.com

官方文档:https://docs.ansible.com

 

Ansible命令使用

Ansible语法使用ansible <pattern_goes_here> -m <module_name> -a <arguments>

-m NAME,–module-name=NAME:指定执行使用的模块

-u USERNAME,–user=USERNAME:指定远程主机以USERNAME运行命令

-s,–sudo:相当于Linux系统下的sudo命令

-USUDO_USERNAME,–sudo-user=SUDO_USERNAME:使用sudo,相当于Linux下的sudo命令

-C -check只检查不实际执行

-e EXTRA_VARS,引用外部参数

-i INVENTORY,指定仓库列表,默认/etc/ansible/hosts

–list-hosts,列出执行主机列

 

安装目录

配置文件目录:/etc/ansible/

执行文件目录:/usr/bin/

Lib库依赖目录:/usr/lib/pythonX.X/site-packages/ansible/

Help文档目录:/usr/share/doc/ansible-X.X.X/

Man文档目录:/usr/share/man/man1/

 

安装

1.安装

[root@docker ~]# git clone git://github.com/ansible/ansible.git --recursive
[root@docker ~]# cd ansible/

 2.进行源码安装

[root@docker ansible]# make && make install

 3.先安装pip包管理工具,然后安装ansible 程序所使用的几个python模块

[root@docker ansible]# easy_install pip
[root@docker ansible]# pip install paramiko PyYAML Jinja2 httplib2 six

 4.更新ansible 代码时用到的两条命令

[root@docker ansible]# git pull --rebase
Current branch devel is up to date.
[root@docker ansible]# git submodule update --init --recursive

 

转载于:https://www.cnblogs.com/cevinchen/p/9513600.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值