当前位置:网站首页>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边栏推荐
- Advanced Mathematics (Seventh Edition) Tongji University exercises 1-9 personal solutions
- App automated test appium advanced
- Today's sleep quality record 80 points
- 数字藏品——新的投资机遇
- fastjson中的@JSONField注解
- How much disk IO will actually occur for a byte of the read file?
- B-string value (string DP) of the 16th Northeast College Students' Programming Competition (warm-up)
- Wechat applet: a new interesting test
- @jsonfield annotation in fastjson
- Win11如何开启移动热点?Win11开启移动热点的方法
猜你喜欢

MySQL面试真题(二十三)——拼多多-球赛分析

数字藏品如何赋能经济实体?

抽奖 ddd 代码

Wechat applet: a new interesting test
![[opencv450] image subtraction, binarization, threshold segmentation](/img/2c/60d64f3cdcc4ad8f95369d30ad2cdd.png)
[opencv450] image subtraction, binarization, threshold segmentation

MySQL面试真题(二十四)——行列互换

Wechat applet: an artifact for calculating the full amount of orders

C primer plus學習筆記 —— 2、常量與格式化IO(輸入/輸出)

Pkav simple blasting

阿里云对象存储oss+picgo+typora实现构建图床
随机推荐
Use of visdom
Qimen dunjia assistant decision software
What does the English letter PC mean? What does the Internet PC mean
Win software - (net framework) processed the certificate chain but terminated in a root certificate that is not trusted by the trusted provider
数字藏品赋能实体产业释放了哪些利好?
英集芯ip6806无线充电方案5W过Qi认证外围精简14颗器件
Wechat applet: wechat can also send flash photos to create wechat applet source code download and customize flash time
LeetCode-1757. Recyclable and low-fat products_ SQL
Win11应用商店一直转圈解决办法
visdom画多条动态损失曲线
[proteus simulation] Arduino uno+pcf8574+lcd1602+mpx4250 electronic scale
How does win11 enable mobile hotspot? How to enable mobile hotspot in win11
高等数学(第七版)同济大学 习题1-9 个人解答
Real MySQL interview question (30) -- shell real estate order analysis
What does it mean to open more accounts? Why open more accounts? How to implement it safely?
Win11如何开启移动热点?Win11开启移动热点的方法
IP6809三线圈15W无线充电发射端方案ic英集芯
Lihongyi, machine learning 5 Tips for neural network design
高等数学(第七版)同济大学 习题1-7 个人解答
Current situation and development of containerization technology under the cloud native trend