|
- [student@workstation ansible]$ ansible-doc yum_repository
复制代码
> YUM_REPOSITORY (/usr/lib/python3.6/site-packages/ansible/modules/packaging/os/yum_repository.py)
Add or remove YUM repositories in RPM-based Linux distributions. If you wish to update an existing repository definition use
[ini_file] instead.
* This module is maintained by The Ansible Core Team
OPTIONS (= is mandatory):
- async
If set to `yes' Yum will download packages and metadata from this repo in parallel, if possible.
[Default: yes]
type: bool
- attributes
The attributes the resulting file or directory should have.
To get supported flags look at the man page for `chattr' on the target system.
This string should contain the attributes in the same order as the one displayed by `lsattr'.
The `=' operator is assumed as default, otherwise `+' or `-' operators need to be included in the string.
(Aliases: attr)[Default: (null)]
type: str
version_added: 2.3
- bandwidth
Maximum available network bandwidth in bytes/second. Used with the `throttle' option.
If `throttle' is a percentage and bandwidth is `0' then bandwidth throttling will be disabled. If `throttle' is expressed as a
data rate (bytes/sec) then this option is ignored. Default is `0' (no bandwidth throttling).
[Default: 0]
- baseurl
URL to the directory where the yum repository's 'repodata' directory lives.
It can also be a list of multiple URLs.
This, the `metalink' or `mirrorlist' parameters are required if `state' is set to `present'.
[Default: (null)]
- cost
Relative cost of accessing this repository. Useful for weighing one repo's packages as greater/less than any other.
:
.......
/EXAMPLE
- name: Add repository
yum_repository:
name: epel
description: EPEL YUM repo
baseurl: https://download.fedoraproject.org/pub/epel/$releasever/$basearch/
- name: Add multiple repositories into the same file (1/2)
yum_repository:
name: epel
description: EPEL YUM repo
file: external_repos
baseurl: https://download.fedoraproject.org/pub/epel/$releasever/$basearch/
gpgcheck: no
- name: Add multiple repositories into the same file (2/2)
yum_repository:
name: rpmforge
description: RPMforge YUM repo
file: external_repos
baseurl: http://apt.sw.be/redhat/el7/en/$basearch/rpmforge
mirrorlist: http://mirrorlist.repoforge.org/el7/mirrors-rpmforge
enabled: no
# Handler showing how to clean yum metadata cache
- name: yum-clean-metadata
command: yum clean metadata
args:
warn: no
# Example removing a repository and cleaning up metadata cache
- name: Remove repository (and clean up left-over metadata)
yum_repository:
name: epel
state: absent
EXAMPLE写成临时命令的时侯:回车变空格,冒号变等号,选项的短横去掉。
- ansible all -m yum_repository -a 'name=EX294_BASE description="EX294 base software" file=baseos baseurl=http://classroom.example.com/content/rhel8.0/x86_64/dvd/BaseOS enabled=yes gpgcheck=yes gpgkey=http://classroom.example.com/content/rhel8.0/x86_64_dvd/RPM-GPG-KEY-redhat-release'
- ansible all -m yum_repository -a 'name=EX294_STREAM description="EX294 stream software" file=appstream baseurl=http://classroom.example.com/content/rhel8.0/x86_64/dvd/AppStream enabled=yes gpgcheck=yes gpgkey=http://classroom.example.com/content/rhel8.0/x86_64_dvd/RPM-GPG-KEY-redhat-release'
复制代码
格式是:
ansible all -m XXX -a ' "" '
|
|