当前位置:网站首页>Ansible 使用普通用户管理被控端
Ansible 使用普通用户管理被控端
2022-06-23 04:07:00 【富士康质检员张全蛋】
场景说明:ansible使用oldxu普通用户统一管理所有被控节点
1:首先控制端,被控端,都需要有oldxu用户,被控端我就不做演示了
[[email protected] ~]# echo "123" | passwd --stdin oldxu
Changing password for user oldxu.
passwd: all authentication tokens updated successfully.2:将控制端oldxu用户的公钥推送到被控端oldxu用户下面,使得普通用户可以免密登入
[rootemanager ~]# su- oldxu
[oldxuemanager ~]ssh-keygen-t rsa -N "" -f ~/.ssh/id_rsa
[oldxuamanager ~]ssh-copy-id -i ~/.ssh/id.pub [email protected]3.所有主机的 oldxu 用户都必须添加 sudo 权限。
[[email protected]~]# visudo
root ALL=(ALL) ALL
oldxu ALL=(ALL) NOPASSWD:ALL
检查语法是否正确
[[email protected] ~]# visudo -c
/etc/sudoers: parsed OK4.修改控制端/etc/ansible/ansible.cfg主配置文件,配置用户提权
[privilege_escalation]
become=True
become_method=sudo
become_user=root
become_ask_pass=False上面这些步骤都可以依托于ansible去做,root免密了,可以使用ansible的控制端去为所有的被控端添加用户,为其设定密码,然后将控制端用户的公钥放到被控端特定用户下,这样就实现了。
最后就是使用这个普通用户来测试
[[email protected] ~]$ ansible --version
ansible 2.9.27
config file = /etc/ansible/ansible.cfg
[[email protected] ~]$ ansible all -m ping -i /etc/ansible/hosts边栏推荐
- Is there a real part-time job online? How do college students find part-time jobs in summer?
- 【斯坦福计网CS144项目】Lab2: TCPReceiver
- jvm: 方法重载时,具体调用哪个方法,是由传入参数的静态类型来决定的,而不是由参数的实际类型来决定
- STC 32-bit 8051 MCU development example tutorial I development environment construction
- 华为软硬件生态圈成型,从根子上改变美国对软硬件体系的领导地位
- MySQL面试真题(二十五)——常见的分组比较场景
- 软件设计开发笔记2:基于QT设计串口调试工具
- Win11如何开启移动热点?Win11开启移动热点的方法
- 数字藏品——新的投资机遇
- 数字藏品火热背后需要强大的技术团队支持 北方技术团队
猜你喜欢

The performance of nonstandard sprintf code in different platforms

Special research on Intelligent upgrading of heavy trucks in China in 2022

Qimen dunjia assistant decision software

Yingjixin ip6806 wireless charging scheme 5W Qi certified peripheral simplified 14 devices

MySQL面试真题(二十五)——常见的分组比较场景

Today's sleep quality record 80 points

MySQL面试真题(二十一)——金融-贷款逾期

Go language - custom error

Design and implementation of spark offline development framework

STC 32-bit 8051 MCU development example tutorial I development environment construction
随机推荐
常用的无线充发射IC芯片
Composite API
Win11 app store keeps turning around solution
Yingjixin ip6806 wireless charging scheme 5W Qi certified peripheral simplified 14 devices
fastjson中的@JSONField注解
STC 32比特8051單片機開發實例教程 一 開發環境搭建
英集芯ip6806无线充电方案5W过Qi认证外围精简14颗器件
Yingjixin launched 4 series of lithium batteries 100W mobile power supply voltage rise and fall scheme SOC chip ip5389
About information disclosure and defense
C primer plus學習筆記 —— 2、常量與格式化IO(輸入/輸出)
How much disk IO will actually occur for a byte of the read file?
Wechat applet: wechat can also send flash photos to create wechat applet source code download and customize flash time
数字藏品市场才刚刚开始
Alibaba cloud object storage oss+picgo+typera implements the construction map
How does win11 enable mobile hotspot? How to enable mobile hotspot in win11
[opencv450] inter frame difference method
Win11应用商店一直转圈解决办法
Cloud native architecture (04) -cncf
Leetcode 797: all possible paths
Win software - (net framework) processed the certificate chain but terminated in a root certificate that is not trusted by the trusted provider