当前位置:网站首页>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边栏推荐
- Real MySQL interview question (XXVIII) -- case - Analysis of indicators of communication operators
- Wechat applet: future wife query generator
- Leetcode 797: all possible paths
- 英集芯ip6806无线充电方案5W过Qi认证外围精简14颗器件
- [opencv450] inter frame difference method
- Mobile phone wireless charging dual coil 15W scheme SOC IC ip6809
- Win software - (net framework) processed the certificate chain but terminated in a root certificate that is not trusted by the trusted provider
- Redis缓存穿透解决方案-布隆过滤器
- Win11如何开启移动热点?Win11开启移动热点的方法
- Cloud native database is the world of future databases
猜你喜欢

Current situation and development of containerization technology under the cloud native trend

How much disk IO will actually occur for a byte of the read file?

Wechat applet: production and generation of love guarantee

Shifu, the open source development platform of the Internet of things, is open for internal testing! Release of the first version of technical documents

数字藏品赋能实体产业释放了哪些利好?

MySQL面试真题(二十二)——表连接后的条件筛选及分组筛选

Win software - (net framework) processed the certificate chain but terminated in a root certificate that is not trusted by the trusted provider

visdom的使用

Win11如何开启移动热点?Win11开启移动热点的方法
![[opencv450] inter frame difference method](/img/ad/c8a56e27d78cea581deb1874620613.png)
[opencv450] inter frame difference method
随机推荐
数字化工厂建设可划分为三个方面
Pkav simple blasting
Go language - custom error
Lottery DDD code
AHA C language Chapter 8 game time is up (lesson 29)
mysql字符集
C primer plus学习笔记 —— 2、常量与格式化IO(输入/输出)
数字藏品如何赋能经济实体?
技能自检 | 想当测试Leader,这6项技能你会吗?
Visdom draws multiple dynamic loss curves
MySQL面试真题(三十)——贝壳-房产订单分析
read 文件一个字节实际会发生多大的磁盘IO?
True question of MySQL interview (29) -- case - finding favorite movies
FS2119A同步升压IC输出3.3V和FS2119B同步升压IC输出5V
Wechat applet: future wife query generator
STC 32-bit 8051 MCU development example tutorial I development environment construction
MySQL Foundation
104. simple chat room 7: use socket to transfer objects
The performance of nonstandard sprintf code in different platforms
【owt】owt-client-native-p2p-e2e-test vs2017构建 6:修改脚本自动生成vs工程