ansible之yum模組

來源:互聯網
上載者:User

標籤:ansible yum模組

其實這些東西,包括之前的都是很早以前的東東了,就是怕忘記了,記錄一下。到時候可以翻翻看,因為第一次接觸的時候感覺上手挺快的,都是封裝好的。。


比如有一組機器需要安裝vim,那麼不能一個一個伺服器上ssh然後執行yum install vim -y。少的話還闊以,多的話,呵呵。。


yum模組用法

[[email protected] ~]# ansible-doc -s yumless 436Copyright (C) 1984-2009 Mark Nudelmanless comes with NO WARRANTY, to the extent permitted by law.For information about the terms of redistribution,see the file named README in the less distribution.Homepage: http://www.greenwoodsoftware.com/less- name: Manages packages with the `yum‘ package manager  action: yum      conf_file              # The remote yum configuration file to use for the transaction.      disable_gpg_check      # Whether to disable the GPG checking of signatures of packages being installed. Has an effect only                               if state is `present‘ or `latest‘.      disablerepo            # `Repoid‘ of repositories to disable for the install/update operation. These repos will not                               persist beyond the transaction. When specifying multiple repos,                               separate them with a ",".      enablerepo             # `Repoid‘ of repositories to enable for the install/update operation. These repos will not persist                               beyond the transaction. When specifying multiple repos, separate                               them with a ",".      exclude                # Package name(s) to exclude when state=present, or latest      list                   # Various (non-idempotent) commands for usage with `/usr/bin/ansible‘ and `not‘ playbooks. See                               examples.      name=                  # Package name, or package specifier with version, like `name-1.0‘. When using state=latest, this                               can be ‘*‘ which means run: yum -y update. You can also pass a url                               or a local path to a rpm file.  To operate on several packages                               this can accept a comma separated list of packages or (as of 2.0)                               a list of packages.      state                  # Whether to install (`present‘ or `installed‘, `latest‘), or remove (`absent‘ or `removed‘) a                               package.      update_cache           # Force updating the cache. Has an effect only if state is `present‘ or `latest‘.



使用yum包管理器來管理軟體包

選項:

   config_file:yum的設定檔

   disable_gpg_check:關閉gpg_check

   disablerepo:不啟用某個源

   enablerepo:啟用某個源

   list

   name:要進行操作的軟體包的名字,也可以傳遞一個url或者一個本地的rpm包的路徑

   state:狀態(present,absent,latest)

樣本使用yum安裝vim,這裡已經安裝過了,其他選擇根據自己需要的隨意選擇。

[[email protected] ~]# ansible web -m yum -a ‘name=vim state=present‘web | SUCCESS => {    "changed": false,     "msg": "",     "rc": 0,     "results": [        "vim-enhanced-2:7.4.629-5.el6.x86_64 providing vim is already installed"    ]}


本文出自 “村裡的男孩” 部落格,請務必保留此出處http://noodle.blog.51cto.com/2925423/1769477

ansible之yum模組

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.