题目:
创建一个 shell 脚本名为 adhoc.sh 用以运行 ad-hoc 命令 。为每个受控节点配罝 yum仓库。要求如下:
仓库1 :
Name: RH294_base
Description: RH294 base software
baseurl: http://content.example.com/rhel8.0/x86_64/dvd/baseOS
需要验证钦件包 GPG 签名
GPG key 在: /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
启用此软件仓库
仓库 2:
Name: RH294_Stream
Description : RH294 stream software
base url: http://content.example.com/rhel8.0/x86_64/dvd/AppStream
需要验证软件包 GPG 签名
GPG key 在: /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
启用此软件仓库
以下为VMware红帽8解答(由于虚拟机环境可能不同,内容仅供参考)目录
1、进入到ansible目录下
2、查看是否生成yum源
3、编写脚本
4、增加执行权限
5、运行脚本验证
1、进入到ansible目录下
输入代码
ansible all -m yum_repository -a 'name=RH294_base description="RH294 base software" baseurl=http://content.example.com/rhel8.0/x86_64/dvd/baseOS gpgcheck=yes gpgkey=/etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release enabled=yes'
2、查看是否生成yum源
ansible all -m shell -a 'ls /etc/yum.repos.d'
3、编写脚本
4、增加执行权限
chmod +x adhoc.sh
5、运行脚本验证
./adhoc.sh



