当前位置:网站首页>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边栏推荐
- STC 32位8051单片机开发实例教程 一 开发环境搭建
- Markdown add background color to the picture
- MySQL面试真题(二十七)——RFM分析法对用户进行分类
- [opencv450] image subtraction, binarization, threshold segmentation
- Differences between fs4059a and fs5080e charging chips
- Win11不能录制音频怎么办?Win11无法录入声音的解决方法
- 英集芯IP5566带TYPE-C口3A充放快充移动电源5w无线充二合一方案SOC
- fastjson中的@JSONField注解
- Wechat applet: elderly blessing short video
- Mobile power fast charging qc3.0 scheme chip ip5318 fast charging scheme
猜你喜欢

Fs2119a Synchronous Boost IC output 3.3V and fs2119b Synchronous Boost IC output 5V

Wechat applet: wechat can also send flash photos to create wechat applet source code download and customize flash time

树莓派assert初步使用练习

【斯坦福计网CS144项目】Lab2: TCPReceiver

STC 32-bit 8051 MCU development example tutorial I development environment construction

英文字母pc是什么意思,互联网的pc指的是什么

MySQL面试真题(二十六)——滴滴2020年笔试题

read 文件一个字节实际会发生多大的磁盘IO?

Mathematical analysis_ Notes_ Chapter 1: set and mapping

Real MySQL interview question (XXVIII) -- case - Analysis of indicators of communication operators
随机推荐
Go language - custom error
Pkav simple blasting
Heimdall database proxy scale out 20 times
Wechat applet: production and generation of love guarantee
FS2119A同步升压IC输出3.3V和FS2119B同步升压IC输出5V
Leetcode 797: all possible paths
技术开发团队视角看到的数字藏品机遇与挑战
移动电源快充QC3.0方案芯片IP5318快充方案
C primer plus學習筆記 —— 2、常量與格式化IO(輸入/輸出)
MySQL面试真题(二十九)——案例-找到爱看的电影
数字化工厂建设可划分为三个方面
The weak are as irritable as tigers, the strong are as calm as water, and the really powerful have already given up their emotions
Markdown add background color to the picture
[proteus simulation] Arduino uno+pcf8574+lcd1602+mpx4250 electronic scale
Wechat applet: Star Trek spaceship ticket production and generation
阿里云对象存储oss+picgo+typora实现构建图床
Redis缓存穿透解决方案-布隆过滤器
Management system of borrowed books based on SSM framework
Use of visdom
Composite API