ansible-playbook ansible-yum_repository写入控制台

时间:2019-02-16 20:52:33

标签: ansible yum

我有一个剧本可以做到这一点:

- name: Add Copr Yum Repository
  yum_repository:
    name: czanik-syslog-ng-githead
    description: Copr repo for syslog-ng-githead owned by czanik
    baseurl: https://copr-be.cloud.fedoraproject.org/results/czanik/syslog-ng-githead/epel-7-$basearch/
    skip_if_unavailable: yes
    gpgkey: https://copr-be.cloud.fedoraproject.org/results/czanik/syslog-ng-githead/pubkey.gpg
    repo_gpgcheck: no
    enabled: yes

我每15分钟从cron运行我的剧本,每15分钟看到一次...

2019 Feb 16 20:45:31 sa-tool-001.example.com ansible-yum_repository Invoked with force=None directory_mode=None ip_resolve=None remote_src=None reposdir=/etc/yum.repos.d includepkgs=None owner=None bandwidth=None cost=None file=None exclude=None mirrorlist_expire=None follow=False attributes=None keepalive=None content=NOT_LOGGING_PARAMETER repo_gpgcheck=False src=None group=None failovermethod=None unsafe_writes=None delimiter=None deltarpm_metadata_percentage=None gpgkey=['https://copr-be.cloud.fedoraproject.org/results/czanik/syslog-ng-githead/pubkey.gpg'] setype=None http_caching=None priority=None serole=None mirrorlist=None params=None gpgcheck=None include=None proxy_username=None username=None metadata_expire=None description=Copr repo for syslog-ng-githead owned by czanik ui_repoid_vars=None selevel=None sslclientcert=None baseurl=['https://copr-be.cloud.fedoraproject.org/results/czanik/syslog-ng-githead/epel-7-$basearch/'] gpgcakey=None sslverify=None s3_enabled=None state=present sslcacert=None proxy_password=NOT_LOGGING_PARAMETER enablegroups=None regexp=None password=NOT_LOGGING_PARAMETER seuser=None retries=None protect=None ssl_check_cert_permissions=None throttle=None name=czanik-syslog-ng-githead deltarpm_percentage=None sslclientkey=None metalink=None enabled=True skip_if_unavailable=True keepcache=None mode=None timeout=None async=None metadata_expire_filter=None backup=None proxy=None

...写入控制台。这很烦人,尤其是当您将文件编辑为根文件或尾随某些日志文件的输出时。如何使其停止?

1 个答案:

答案 0 :(得分:1)

在任务中设置no_log: True。这样,Ansible不会记录任务

- name: Add Copr Yum Repository
  yum_repository:
    name: czanik-syslog-ng-githead
    description: Copr repo for syslog-ng-githead owned by czanik
    baseurl: https://copr-be.cloud.fedoraproject.org/results/czanik/syslog-ng-githead/epel-7-$basearch/
    skip_if_unavailable: yes
    gpgkey: https://copr-be.cloud.fedoraproject.org/results/czanik/syslog-ng-githead/pubkey.gpg
    repo_gpgcheck: no
    enabled: yes
  no_log: True

您必须为整个task(不是不是)的yum模块设置变量。