Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加支持RedHat(only) #431

Merged
merged 1 commit into from
Jan 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 99.clean.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,11 @@
tags: rm_ntp
when: ansible_distribution == "Ubuntu" or ansible_distribution == "Debian"

- name: stop and disable chronyd in CentOS
- name: stop and disable chronyd in CentOS/RedHat
service: name=chronyd state=stopped enabled=no
ignore_errors: true
tags: rm_ntp
when: ansible_distribution == "CentOS"
when: ansible_distribution == "CentOS" or ansible_distribution == "RedHat"

- name: clean certs and keys
file: name={{ item }} state=absent
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

|组件|支持|
|:-|:-|
|OS|Ubuntu 16.04+, CentOS 7|
|OS|Ubuntu 16.04+, CentOS/RedHat 7|
|k8s|v1.8, v1.9, v1.10, v1.11, v1.12|
|etcd|v3.1, v3.2, v3.3|
|docker|17.03.2-ce, 18.06.1-ce|
Expand Down
8 changes: 4 additions & 4 deletions roles/chrony/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
- block:
- name: 配置 chrony server
template: src=server-centos.conf.j2 dest=/etc/chrony.conf
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "7"
when: (ansible_distribution == "CentOS" or ansible_distribution == "RedHat") and ansible_distribution_major_version == "7"

- name: 配置 chrony server
template: src=server-ubuntu.conf.j2 dest=/etc/chrony/chrony.conf
when: ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int >= 16

- name: 启动 chrony server
service: name=chronyd state=restarted enabled=yes
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "7"
when: (ansible_distribution == "CentOS" or ansible_distribution == "RedHat") and ansible_distribution_major_version == "7"

- name: 启动 chrony server
service: name=chrony state=restarted enabled=yes
Expand All @@ -29,15 +29,15 @@
- block:
- name: 配置 chrony client
template: src=client-centos.conf.j2 dest=/etc/chrony.conf
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "7"
when: (ansible_distribution == "CentOS" or ansible_distribution == "RedHat") and ansible_distribution_major_version == "7"

- name: 配置 chrony client
template: src=client-ubuntu.conf.j2 dest=/etc/chrony/chrony.conf
when: ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int >= 16

- name: 启动 chrony client
service: name=chronyd state=restarted enabled=yes
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "7"
when: (ansible_distribution == "CentOS" or ansible_distribution == "RedHat") and ansible_distribution_major_version == "7"

- name: 启动 chrony client
service: name=chrony state=restarted enabled=yes
Expand Down
6 changes: 3 additions & 3 deletions roles/lb/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@

- name: yum安装 haproxy
yum: name=haproxy state=latest
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "7"
when: (ansible_distribution == "CentOS" or ansible_distribution == "RedHat") and ansible_distribution_major_version == "7"

- name: 创建haproxy配置目录
file: name=/etc/haproxy state=directory

- name: 修改centos的haproxy.service
template: src=haproxy.service.j2 dest=/usr/lib/systemd/system/haproxy.service
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "7"
when: (ansible_distribution == "CentOS" or ansible_distribution == "RedHat") and ansible_distribution_major_version == "7"
tags: restart_lb

- name: 配置 haproxy
Expand All @@ -36,7 +36,7 @@

- name: yum安装 keepalived
yum: name=keepalived state=latest
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "7"
when: (ansible_distribution == "CentOS" or ansible_distribution == "RedHat") and ansible_distribution_major_version == "7"

- name: 创建keepalived配置目录
file: name=/etc/keepalived state=directory
Expand Down
2 changes: 1 addition & 1 deletion roles/prepare/tasks/centos.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- name: 删除centos默认安装
- name: 删除centos/redhat默认安装
yum:
name:
- firewalld
Expand Down
2 changes: 1 addition & 1 deletion roles/prepare/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
when: ansible_distribution == "Ubuntu" or ansible_distribution == "Debian"

- import_tasks: centos.yml
when: ansible_distribution == "CentOS"
when: ansible_distribution == "CentOS" or ansible_distribution == "RedHat"

- name: prepare some dirs
file: name={{ item }} state=directory
Expand Down