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