Bo's Oracle Station

查看: 1298|回复: 0

利用ansible-doc获取帮助

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2020-11-7 21:48:30 | 显示全部楼层 |阅读模式

  1. [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写成临时命令的时侯:回车变空格,冒号变等号,选项的短横去掉。

  1. 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'
  2. 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 '   ""       '



回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-5-20 19:33 , Processed in 0.031081 second(s), 24 queries .

快速回复 返回顶部 返回列表