当前位置:网站首页>Ansible实战系列一 _ 入门
Ansible实战系列一 _ 入门
2022-07-06 09:13:00 【hyh123a】
前言
一个需求:需要对多个主机进行操作。
好吧 坦白,其实是为了使用kubespray部署kubernetes做铺垫
环境
Ubuntu 20.04
1、安装
sudo apt install ansible
2、生成配置ssh秘钥
ssh-keygen
ssh-copy-id [email protected]
ssh-copy-id [email protected]
ssh-copy-id [email protected]
3、例子
sudo nano /etc/ansible/hosts
修改如下 定义用户名和密码 可不设置 默认用户名为root
[web]
172.16.106.20 ansible_ssh_user='ubuntu20' ansible_ssh_pass='AAbb0101'
172.16.106.21 ansible_ssh_user='ubuntu20' ansible_ssh_pass='AAbb0101'
172.16.106.22 ansible_ssh_user='ubuntu20' ansible_ssh_pass='AAbb0101'
ansible web -m command -a 'uptime'
输出如下
172.16.106.20 | CHANGED | rc=0 >>
10:11:57 up 17 days, 5:13, 3 users, load average: 0.47, 0.77, 1.21
172.16.106.22 | CHANGED | rc=0 >>
10:11:57 up 17 days, 6:08, 1 user, load average: 1.34, 1.13, 1.25
172.16.106.21 | CHANGED | rc=0 >>
10:11:57 up 17 days, 5:45, 1 user, load average: 1.44, 1.92, 1.99
其他
如有遗漏欢迎补充
如有问题欢迎留言
如有作用欢迎点赞
边栏推荐
- MySQL34-其他数据库日志
- Mysql27 - Optimisation des index et des requêtes
- Invalid default value for 'create appears when importing SQL_ Time 'error reporting solution
- SSM整合笔记通俗易懂版
- Bytetrack: multi object tracking by associating every detection box paper reading notes ()
- Have you mastered the correct posture of golden three silver four job hopping?
- [paper reading notes] - cryptographic analysis of short RSA secret exponents
- CSDN-NLP:基于技能树和弱监督学习的博文难度等级分类 (一)
- [untitled]
- MySQL19-Linux下MySQL的安装与使用
猜你喜欢

Just remember Balabala

MySQL21-用戶與權限管理

Postman environment variable settings

Mysql21 user and permission management

MySQL33-多版本并发控制

CSDN Q & a tag skill tree (V) -- cloud native skill tree

Unicode decodeerror: 'UTF-8' codec can't decode byte 0xd0 in position 0 successfully resolved

Solution: log4j:warn please initialize the log4j system properly

MySQL27-索引优化与查询优化

MySQL24-索引的数据结构
随机推荐
Mysql27 - Optimisation des index et des requêtes
MySQL23-存储引擎
A brief introduction to the microservice technology stack, the introduction and use of Eureka and ribbon
How to change php INI file supports PDO abstraction layer
Mysql24 index data structure
Anaconda3 installation CV2
Bytetrack: multi object tracking by associating every detection box paper reading notes ()
Just remember Balabala
MySQL23-存儲引擎
Invalid default value for 'create appears when importing SQL_ Time 'error reporting solution
windows下同时安装mysql5.5和mysql8.0
API learning of OpenGL (2002) smooth flat of glsl
[C language foundation] 04 judgment and circulation
MySQL31-MySQL事务日志
MySQL33-多版本并发控制
MySQL27-索引優化與查詢優化
CSDN question and answer module Title Recommendation task (I) -- Construction of basic framework
Why is MySQL still slow to query when indexing is used?
数据库中间件_Mycat总结
Mysql23 storage engine