当前位置:网站首页>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
其他
如有遗漏欢迎补充
如有问题欢迎留言
如有作用欢迎点赞
边栏推荐
- Mysql22 logical architecture
- Mysql26 use of performance analysis tools
- Installation and use of MySQL under MySQL 19 Linux
- MySQL18-MySQL8其它新特性
- 解决:log4j:WARN Please initialize the log4j system properly.
- Mysql30 transaction Basics
- [recommended by bloggers] C WinForm regularly sends email (with source code)
- MySQL29-数据库其它调优策略
- Generate PDM file from Navicat export table
- Idea import / export settings file
猜你喜欢

MySQL20-MySQL的数据目录

MySQL23-存储引擎

Moteur de stockage mysql23

MySQL28-数据库的设计规范

Idea import / export settings file

Isn't there anyone who doesn't know how to write mine sweeping games in C language

API learning of OpenGL (2003) gl_ TEXTURE_ WRAP_ S GL_ TEXTURE_ WRAP_ T

1. Mx6u learning notes (VII): bare metal development (4) -- master frequency and clock configuration

Redis的基础使用

MySQL32-锁
随机推荐
Pytoch LSTM implementation process (visual version)
Mysql 其他主机无法连接本地数据库
Solve the problem that XML, YML and properties file configurations cannot be scanned
Global and Chinese market for intravenous catheter sets and accessories 2022-2028: Research Report on technology, participants, trends, market size and share
Postman Interface Association
虚拟机Ping通主机,主机Ping不通虚拟机
Kubernetes - problems and Solutions
API learning of OpenGL (2005) gl_ MAX_ TEXTURE_ UNITS GL_ MAX_ TEXTURE_ IMAGE_ UNITS_ ARB
MySQL19-Linux下MySQL的安装与使用
Invalid default value for 'create appears when importing SQL_ Time 'error reporting solution
MySQL25-索引的创建与设计原则
MySQL flush operation
Development of C language standard
Esp8266 at+cipstart= "", "", 8080 error closed ultimate solution
Postman uses scripts to modify the values of environment variables
Mysql36 database backup and recovery
Mysql26 use of performance analysis tools
Other new features of mysql18-mysql8
Swagger、Yapi接口管理服务_SE
Kubesphere - deploy the actual combat with the deployment file (3)