简体   繁体   English

如何使用ansible在客户端计算机上安装软件包

[英]How can I install package on client machine using ansible

I am new to Ansible and setup a ansible server. 我是Ansible的新手,并设置了一个ansible服务器。 I have also set up ssh communication between one client server and client. 我还在一个客户端服务器和客户端之间建立了ssh通信。 Now I am able to use few of ansible modules from server in order to make changes in the client one. 现在我可以使用服务器中的几个ansible模块来在客户端进行更改。 Ping, Copy modules are working fine. Ping,复制模块工作正常。

But when I am trying to install a package from ansible server to the client system using "yum" command it is not working. 但是当我尝试使用“yum”命令从ansible服务器安装包到客户端系统时,它无法正常工作。 I am using the below command in order to execute the yum as sudo on my client machine. 我使用以下命令,以便在我的客户端计算机上执行yum as sudo。

Command: 命令:

ansible all -m yum -a "name=httpd state=present" -s

This command is throwing an error that -s is unidentified . 此命令抛出了-s未识别的错误。 Request you to please help me in this case. 请你帮我解决这个问题。

You need replace -s with -b sudo module was replaced by become module, but it does the same 你需要替换-s -b sudo模块被成为模块替换,但它也是如此

tenhi@somehost:somedir$ ansible localhost -b -m yum -a 'name=mc state=present'
localhost | SUCCESS => {
    "ansible_facts": {
        "pkg_mgr": "apt"
    },
    "cache_update_time": 1557517026,
    "cache_updated": false,
    "changed": false
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM