修复ansible条件判断可能失败问题

pull/29/head
jmgao 2017-12-15 10:25:32 +08:00
parent 0a343fb960
commit 5c2a151b2b
2 changed files with 13 additions and 5 deletions

View File

@ -30,6 +30,11 @@
shell: systemctl daemon-reload && systemctl enable docker && systemctl restart docker
## 可选 ------安装docker查询镜像 tag的小工具----
# 先拉取下节点的ansible setup信息起到缓存效果否则后续when 判断可能失败
- name: 缓存ansilbe setup信息
setup: gather_subset=min
tags: docker-tag
- name: apt安装轻量JSON处理程序
apt: name=jq state=latest
when: ansible_distribution == "Ubuntu" and ansible_distribution_major_version == "16"

View File

@ -1,13 +1,16 @@
#
# 先拉取下节点的ansible setup信息起到缓存效果否则后续when 判断可能失败
- name: 缓存ansilbe setup信息
setup: gather_subset=min
- name: apt更新缓存刷新
apt: update_cache=yes cache_valid_time=72000
when: ansible_distribution == "Ubuntu" and ansible_distribution_major_version == "16"
- name: apt安装 haproxy using apt
- name: apt安装 haproxy
apt: name=haproxy state=latest
when: ansible_distribution == "Ubuntu" and ansible_distribution_major_version == "16"
- name: yum安装 haproxy using yum
- name: yum安装 haproxy
yum: name=haproxy state=latest
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "7"
@ -17,11 +20,11 @@
- name: 配置 haproxy
template: src=haproxy.cfg.j2 dest=/etc/haproxy/haproxy.cfg
- name: apt安装 keepalived using apt
- name: apt安装 keepalived
apt: name=keepalived state=latest
when: ansible_distribution == "Ubuntu" and ansible_distribution_major_version == "16"
- name: yum安装 keepalived using yum
- name: yum安装 keepalived
yum: name=keepalived state=latest
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "7"