银河麒麟服务器系统v10离线部署ansible
前因
因为平台部署的os只有基础的rpm包,对ansbile包是额外下载,因此又要绕圈部署。
官方离线包地址
[root@k8s-188 yum.repos.d]# cat kylin_x86_64.repo
###Kylin Linux Advanced Server 10 - os repo###
[ks10-adv-os]
name = Kylin Linux Advanced Server 10 - Os
baseurl = https://update.cs2c.com.cn/NS/V10/V10SP3/os/adv/lic/base/$basearch/
gpgcheck = 1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-kylin
enabled = 1
[ks10-adv-updates]
name = Kylin Linux Advanced Server 10 - Updates
baseurl = https://update.cs2c.com.cn/NS/V10/V10SP3/os/adv/lic/updates/$basearch/
gpgcheck = 1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-kylin
enabled = 1
[ks10-adv-addons]
name = Kylin Linux Advanced Server 10 - Addons
baseurl = https://update.cs2c.com.cn/NS/V10/V10SP3/os/adv/lic/addons/$basearch/
gpgcheck = 1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-kylin
enabled = 0
关闭防火墙及selinux
[root@manger01 ~]# systemctl disable firewalld.service
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@manger01 ~]# sed -i -r '/SELINUX=/c\SELINUX=disable' /etc/selinux/config
ansible安装
因为是离线环境,需要什么ansible
依赖就到仓库离线下。
[root@k8s-188 yum.repos.d]# yum install ansible
Kylin Linux Advanced Server 10 - Os 11 kB/s | 3.8 kB 00:00
Kylin Linux Advanced Server 10 - Updates 27 kB/s | 3.0 kB 00:00
Kylin Linux Advanced Server 10 - Updates 27 MB/s | 14 MB 00:00
上次元数据过期检查:0:00:01 前,执行于 2024年04月22日 星期一 15时30分35秒。
Detection of Platform Module failed: No valid Platform ID detected
模块依赖问题
问题: conflicting requests
- nothing provides module(platform:el8) needed by module container-tools:rhel8:8050020211109205056:faa19cc5-0.x86_64
依赖关系解决。
====================================================================================================================================================================================================================
Package Architecture Version Repository Size
====================================================================================================================================================================================================================
安装:
ansible noarch 2.8.8-1.p01.ky10 ks10-adv-os 15 M
安装依赖关系:
libsodium x86_64 1.0.18-1.ky10 ks10-adv-os 152 k
python3-asn1crypto noarch 1.4.0-1.ky10 ks10-adv-os 182 k
python3-babel noarch 2.8.0-3.ky10 ks10-adv-os 6.1 M
python3-bcrypt x86_64 3.2.0-1.ky10 ks10-adv-os 40 k
python3-cryptography x86_64 3.3.1-1.p01.ky10 ks10-adv-os 402 k
python3-jinja2 noarch 2.11.2-2.p01.ky10 ks10-adv-os 223 k
python3-markupsafe x86_64 1.1.1-1.ky10 ks10-adv-os 28 k
python3-paramiko noarch 2.4.3-1.ky10.ky10 ks10-adv-os 281 k
python3-pyasn1 noarch 0.3.7-8.ky10 ks10-adv-os 215 k
python3-pynacl x86_64 1.2.1-5.ky10 ks10-adv-os 77 k
python3-pyyaml x86_64 5.3.1-4.ky10 ks10-adv-os 189 k
sshpass x86_64 1.06-8.ky10 ks10-adv-os 24 k
因为rpm包的仓库都是ks10-adv-os
,那么就https://update.cs2c.com.cn/NS/V10
找到对应系统版本下就行,然后丢到离线虚拟机即可。
Ansible配置文件设置默认
vim /etc/ansible/ansible.cfg
#在文件中进行搜索定位到
#修改后:
host_key_checking = False #第一次交互目标主机,需要输入yes/no,改成False不用输入
timeout = 10 # 设置SSH连接的超时时间,单位为秒
log_path = /var/log/ansible.log #设置日志路径
# 在ansible.cfg的[defaults]部分添加配置
interpreter_python = auto_legacy_silent