当前位置:网站首页>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
其他
如有遗漏欢迎补充
如有问题欢迎留言
如有作用欢迎点赞
边栏推荐
- MySQL26-性能分析工具的使用
- Ansible实战系列二 _ Playbook入门
- Other new features of mysql18-mysql8
- Global and Chinese market of thermal mixers 2022-2028: Research Report on technology, participants, trends, market size and share
- MySQL33-多版本并发控制
- CSDN问答标签技能树(五) —— 云原生技能树
- Unicode decodeerror: 'UTF-8' codec can't decode byte 0xd0 in position 0 successfully resolved
- MySQL transaction log
- Postman environment variable settings
- Mysql28 database design specification
猜你喜欢

Mysql26 use of performance analysis tools

Mysql24 index data structure

CSDN question and answer module Title Recommendation task (I) -- Construction of basic framework

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

Mysql27 - Optimisation des index et des requêtes

MySQL21-用戶與權限管理

Mysql27 index optimization and query optimization
![[C language] deeply analyze the underlying principle of data storage](/img/d6/1c0cd38c75da0d0cc1df7f36938cfb.png)
[C language] deeply analyze the underlying principle of data storage

Adaptive Bezier curve network for real-time end-to-end text recognition

MySQL31-MySQL事务日志
随机推荐
CSDN问答标签技能树(五) —— 云原生技能树
Postman environment variable settings
MySQL32-锁
Pytoch LSTM implementation process (visual version)
Mysql33 multi version concurrency control
Mysql22 logical architecture
导入 SQL 时出现 Invalid default value for ‘create_time‘ 报错解决方法
Global and Chinese markets for aprotic solvents 2022-2028: Research Report on technology, participants, trends, market size and share
Global and Chinese market for intravenous catheter sets and accessories 2022-2028: Research Report on technology, participants, trends, market size and share
Case identification based on pytoch pulmonary infection (using RESNET network structure)
[reading notes] rewards efficient and privacy preserving federated deep learning
CSDN blog summary (I) -- a simple first edition implementation
Mysql21 user and permission management
Solution: log4j:warn please initialize the log4j system properly
La table d'exportation Navicat génère un fichier PDM
[recommended by bloggers] background management system of SSM framework (with source code)
IDEA 导入导出 settings 设置文件
Windows cannot start the MySQL service (located on the local computer) error 1067 the process terminated unexpectedly
MySQL主从复制、读写分离
CSDN question and answer tag skill tree (I) -- Construction of basic framework