Chinaunix首页 | 论坛 | 博客

OPS

  • 博客访问: 490390
  • 博文数量: 117
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1210
  • 用 户 组: 普通用户
  • 注册时间: 2015-05-05 14:50
个人简介

hellow 运维

文章分类

全部博文(117)

文章存档

2019年(1)

2018年(1)

2017年(45)

2016年(38)

2015年(32)

我的朋友

分类: 系统运维

2017-12-20 14:42:25

有一个较为通用的节点部署playbooks,在每次部署的时候传递一个版本号或者用户信息之类的
例子:
- hosts: '{{ hosts }}'
  remote_user: '{{ user }}'
  tasks:
  - name: 创建/tmp/hanye目录
    shell: mkdir /tmp/'{{ hanye }}'
执行命令:
ansible-playbook  nginx_like.yml  --extra-vars "hosts=web user=root hanye=hanye"
执行结果查看
root@debian:/home/sh/ansible_temp# ansible web -m shell -a "ls /tmp|grep hanye"
192.168.1.44 | success | rc=0 >>
hanye

192.168.1.40 | success | rc=0 >>
hanye

192.168.1.43 | success | rc=0 >>
hanye

192.168.1.46 | success | rc=0 >>
hanye


阅读(4476) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~