标签:red 模块 ems 获取 说明 disco git logs epel
使用dnf软件安装/卸载时,需要有root权限,
所以要使用become参数
说明:刘宏缔的架构森林是一个专注架构的博客,地址:https://www.cnblogs.com/architectforest
对应的源码可以访问这里获取: https://github.com/liuhongdi/
说明:作者:刘宏缔 邮箱: 371125307@qq.com
#name:软件的名字
#state: 状态,取值有:present:默认的,表示为安装
lastest: 安装为最新的版本
absent:表示删除
[liuhongdi@centos8 ~]$ ansible yujian -m yum -a ‘name=screen state=absent‘ --become --become-method=sudo --become-user=root 121.122.123.47 | CHANGED => { "ansible_facts": { "discovered_interpreter_python": "/usr/libexec/platform-python" }, "changed": true, "msg": "", "rc": 0, "results": [ "Removed: screen-4.6.2-10.el8.x86_64" ] }
[liuhongdi@centos8 ~]$ ansible yujian -m yum -a ‘name=screen‘ --become --become-method=sudo --become-user=root 121.122.123.47 | CHANGED => { "ansible_facts": { "discovered_interpreter_python": "/usr/libexec/platform-python" }, "changed": true, "msg": "", "rc": 0, "results": [ "Installed: screen-4.6.2-10.el8.x86_64" ] }
#disable_gpg_check 值为yes时,禁用gpg验证
[liuhongdi@centos8 ~]$ ansible yujian -m yum -a ‘name=screen disable_gpg_check=yes‘ --become --become-method=sudo --become-user=root
说明:如果对应的 yum 源没有开启 gpg 验证,则需要将此参数的值设置为 yes,否则会报错而无法进行安装
因为这里要和server交互
#enablerepo 指定安装时的来源repo
[liuhongdi@centos8 ~]$ ansible yujian -m yum -a ‘name=screen enablerepo=epel‘ --become --become-method=sudo --become-user=root
[liuhongdi@centos8 ~]$ cat /etc/redhat-release CentOS Linux release 8.1.1911 (Core)
ansible通过yum/dnf模块给受控机安装软件(ansible2.9.5)
标签:red 模块 ems 获取 说明 disco git logs epel
原文地址:https://www.cnblogs.com/architectforest/p/12755276.html