創建playbook
Tower playbook 項目默認存在 /var/lib/awx/projects/
su - awx
cd projects/
mkdir ansible-for-devops && cd ansible-for-devops
cat main.yml << EOF
--- - hosts: all gather_facts: no tasks: - name: Check the date on the server. command: date - name: Check the eth0 ip on the server. command: ifconfig eth0 EOF
創建登陸憑據
Paste_Image.png
創建項目
Paste_Image.png
創建主機清單
Paste_Image.png
在主機清單里添加主機
點擊主機清單名稱,就可以進入添加主機的頁面
Paste_Image.png
點擊 +ADD HOST
Paste_Image.png
本次添加了2個主機
Paste_Image.png
創建任務模板
Inventory 選擇 ops_主機清單
PROJECT 選擇 Test_Project
PALYBOOK 選擇 man.yml
MACHINE CREDENTIAL 選擇 ssh登陸賬號
其他默認
Paste_Image.png
運行模板
點擊任務右側得火箭按鈕
Paste_Image.png
查看任務運行情況
Paste_Image.png
DETAILS 里面可以查看任務得詳細信息
轉自
Ansible Tower系列 三(使用tower執行一個任務) - 簡書
http://www.jianshu.com/p/804832965259
