ansible yum源
时间: 2023-11-17 18:49:19 浏览: 206
ansible yum源分为内部yum源和外部yum源。对于内网环境,如果没有内部yum源,可以通过配置远程yum源或本地yum源来满足需要。在安装ansible时,可以使用已经打包好的rpm包进行安装,或者通过配置ansible playbook来配置远程yum源或本地yum源。
对于远程yum源,可以使用以下playbook配置:
vim install_yum.yml
---
- name: Configure remote yum repository
hosts: all
tasks:
- name: Yum repository executive options
yum_repository:
name: remote_repo
file: local_repo
baseurl: "http://apt.sw.be/redhat/el7/en/$basearch/rpmforge"
description: "remote yum repo"
enabled: yes
gpgcheck: False
对于本地yum源,可以使用以下playbook配置:
vim install_yum.yml
---
- name: Configure local yum repository
hosts: all
tasks:
- name: Yum repository executive options
yum_repository:
name: local_repo
baseurl: "http://x.x.x.x/repository/centos/7/os/$basearch/"
description: "local yum repo"
enabled: yes
gpgcheck: True
gpgkey: "http://x.x.x.x/repository/centos/RPM-GPG-KEY-CentOS-7"
以上是配置远程yum源和本地yum源的示例,根据实际情况进行相应的修改。
阅读全文