Skip to content
This repository was archived by the owner on Jun 5, 2024. It is now read-only.

Commit 72a6e14

Browse files
committed
support openEuler
* upgrade ansible to support ansible_os_family for openEuler * openEuler has python3 only * openEuler has no firewalld installed * openEuler doesn't have /etc/redhat-release * adjust additional repos for openEuler * openEuler doesn't support to disable selinux * openEuler has no yum-utils, moreutils and inxi available * openEuler has its own way to install Docker
1 parent 7b21c10 commit 72a6e14

File tree

14 files changed

+85
-11
lines changed

14 files changed

+85
-11
lines changed

Pipfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ verify_ssl = true
77
name = "pypi"
88

99
[packages]
10-
ansible = "==2.9.27"
10+
ansible = "==2.10.0"
1111
ansible-lint = "==5.0.8"
1212
jinja2 = "==3.0.3"
1313
pylint = "==2.7.2"

roles/baseline_ansible/action_plugins/package.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def run(self, tmp=None, task_vars=None):
4040
# Add/Change ansible_python_interpreter to python2 for CentOS 7.x and RHEL 7.x
4141
# pylint: disable=f-string-without-interpolation
4242
is_redhat_family_7 = \
43-
self._templar.template("{{ (ansible_os_family == 'RedHat' and "
43+
self._templar.template("{{ (ansible_os_family == 'RedHat' and ansible_distribution != 'openEuler' and "
4444
"ansible_distribution_version < '8') | bool }}")
4545
if is_redhat_family_7:
4646
if 'ansible_python_interpreter' in task_vars:

roles/baseline_ansible/action_plugins/yum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def run(self, tmp=None, task_vars=None):
4040
# Add/Change ansible_python_interpreter to python2 for CentOS 7.x and RHEL 7.x
4141
# pylint: disable=f-string-without-interpolation
4242
is_redhat_family_7 = \
43-
self._templar.template("{{ (ansible_os_family == 'RedHat' and "
43+
self._templar.template("{{ (ansible_os_family == 'RedHat'and ansible_distribution != 'openEuler' and "
4444
"ansible_distribution_version < '8') | bool }}")
4545
if is_redhat_family_7:
4646
if 'ansible_python_interpreter' in task_vars:

roles/baseline_ansible/infrastructure/firewall_open_ports/tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@
2020
# where every element has the value "enabled" or "disabled"
2121
loop: "{{ (fw_open_ports | default([]) | zip_longest([], fillvalue='enabled') | list) + (fw_close_ports | default([]) | zip_longest([], fillvalue='disabled') | list) }}" # noqa line-length
2222
become: yes
23-
when: ansible_os_family == 'RedHat'
23+
when: ansible_os_family == 'RedHat' and ansible_distribution != 'openEuler'

roles/baseline_ansible/infrastructure/install_dependencies/tasks/install_os_packages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
- name: install os packages
2020
block:
2121
- name: install os packages
22-
action: "{{ ansible_pkg_mgr }} name={{ install_dependencies_full_list }} state=present update_cache=yes"
22+
action: "{{ ansible_pkg_mgr }} disable_excludes=main name={{ install_dependencies_full_list }} state=present update_cache=yes"
2323
register: pkg_mgr_results
2424
retries: "{{ number_of_retries | default(3) }}"
2525
until: pkg_mgr_results is success

roles/baseline_ansible/infrastructure/install_packages/tasks/redhat_enable_repositories.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
when:
3232
- ansible_distribution_version < '8'
3333
- ius_repository_enabled
34+
- ansible_distribution != 'openEuler'
3435

3536
- name: Install PowerTools repository
3637
include_tasks: redhat_powertools_repository.yml
@@ -46,6 +47,8 @@
4647
command: cat /etc/redhat-release
4748
register: release
4849
changed_when: false
50+
when:
51+
- ansible_distribution != 'openEuler'
4952

5053
- name: set full distribution version RHEL
5154
set_fact:

roles/baseline_ansible/infrastructure/install_packages/tasks/redhat_epel_repository.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,14 @@
2323
become: yes
2424
when:
2525
- ansible_distribution == "CentOS"
26+
27+
- name: add EPEL repository for openEuler
28+
ansible.builtin.yum_repository:
29+
name: epel
30+
description: EPEL
31+
baseurl: https://dl.fedoraproject.org/pub/epel/8/Everything/$basearch/
32+
gpgkey: https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8
33+
enabled: true
34+
become: yes
35+
when:
36+
- ansible_distribution == "openEuler"

roles/baseline_ansible/infrastructure/install_packages/tasks/redhat_install_kernel_headers_and_devel.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,20 @@
9191
when:
9292
- ansible_distribution == "RedHat"
9393
- ansible_distribution_version >= '8'
94+
95+
- name: pull matching kernel headers and devel on openEuler
96+
become: yes
97+
package:
98+
name: "{{ item }}"
99+
state: present
100+
allow_downgrade: true
101+
disable_excludes: main
102+
retries: "{{ number_of_retries | default(5) }}"
103+
delay: "{{ retry_delay | default(3) }}"
104+
register: source_status
105+
until: source_status is not failed
106+
loop:
107+
- "kernel-headers"
108+
- "kernel-devel"
109+
when:
110+
- ansible_distribution == "openEuler"

roles/baseline_ansible/infrastructure/install_packages/vars/main.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
---
55
os_base_packages:
66
RedHat:
7+
- CentOS:
8+
- yum-utils
9+
- moreutils
710
- curl
8-
- yum-utils
911
- device-mapper-persistent-data
1012
- lvm2
1113
- wget
@@ -29,7 +31,6 @@ os_base_packages:
2931
- gcc-c++
3032
- psmisc
3133
- pixman-devel
32-
- moreutils
3334
- createrepo
3435
- sshpass
3536
- bash-completion
@@ -111,8 +112,9 @@ os_python_packages:
111112

112113
hardware_details_tools:
113114
RedHat:
115+
- CentOS:
116+
- inxi
114117
- hwinfo
115-
- inxi
116118
- jq
117119
- pciutils
118120
Debian:

roles/baseline_ansible/infrastructure/selinux/tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222
state: disabled
2323
become: yes
2424
when: ansible_distribution_version >= '8'
25-
when: ansible_os_family == "RedHat"
25+
when: ansible_os_family == "RedHat" and ansible_distribution != "openEuler"

0 commit comments

Comments
 (0)