Ansiblepython
GitHub:https://github.com/ansible/git
官方:https://www.ansible.comgithub
官方文档:https://docs.ansible.comdocker
Ansible语法使用ansible <pattern_goes_here> -m <module_name> -a <arguments>bash
-m NAME,–module-name=NAME:指定执行使用的模块工具
-u USERNAME,–user=USERNAME:指定远程主机以USERNAME运行命令blog
-s,–sudo:至关于Linux系统下的sudo命令ip
-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