Ansible Tower系列 三(使用tower执行一个任务)
Posted hch的随笔 成功的秘诀在于恒心—迪斯雷利
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Ansible Tower系列 三(使用tower执行一个任务)相关的知识,希望对你有一定的参考价值。
创建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
创建登陆凭据
![技术分享](http://upload-images.jianshu.io/upload_images/3629406-755329a7a7001304.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
Paste_Image.png
创建项目
![技术分享](http://upload-images.jianshu.io/upload_images/3629406-0b0a38c2210d4a39.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
Paste_Image.png
创建主机清单
![技术分享](http://upload-images.jianshu.io/upload_images/3629406-fea7a6dae4a494e5.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
Paste_Image.png
在主机清单里添加主机
点击主机清单名称,就可以进入添加主机的页面
![技术分享](http://upload-images.jianshu.io/upload_images/3629406-95a29edd6df14575.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
Paste_Image.png
点击 +ADD HOST
![技术分享](http://upload-images.jianshu.io/upload_images/3629406-cb3f86552d11073c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
Paste_Image.png
本次添加了2个主机
![技术分享](http://upload-images.jianshu.io/upload_images/3629406-ca5b94914ee16adb.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
Paste_Image.png
创建任务模板
Inventory 选择 ops_主机清单
PROJECT 选择 Test_Project
PALYBOOK 选择 man.yml
MACHINE CREDENTIAL 选择 ssh登陆账号
其他默认
![技术分享](http://upload-images.jianshu.io/upload_images/3629406-21d7ad7922777022.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
Paste_Image.png
运行模板
点击任务右侧得火箭按钮
![技术分享](http://upload-images.jianshu.io/upload_images/3629406-b2c78ccc7ee3c801.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
Paste_Image.png
查看任务运行情况
![技术分享](http://upload-images.jianshu.io/upload_images/3629406-819ff36fa335680f.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
Paste_Image.png
DETAILS 里面可以查看任务得详细信息
转自
Ansible Tower系列 三(使用tower执行一个任务) - 简书
http://www.jianshu.com/p/804832965259
以上是关于Ansible Tower系列 三(使用tower执行一个任务)的主要内容,如果未能解决你的问题,请参考以下文章
Ansible Tower系列 四(使用tower执行一个命令)