Summer's Blog
😈酷炫主页
✨运维
🎉安装
👀踩坑
  • k8s
  • shell
  • python
  • redis
  • elasticsearch
  • mysql
  • ceph
  • spark
  • 关于
  • 思维
  • 命令
  • 友链
  • 分类
  • 标签
  • 归档
👨‍👩‍👦‍👦腾讯云社区
🗣GitHub

Summer———夏苏文

💨运维界的前行者
😈酷炫主页
✨运维
🎉安装
👀踩坑
  • k8s
  • shell
  • python
  • redis
  • elasticsearch
  • mysql
  • ceph
  • spark
  • 关于
  • 思维
  • 命令
  • 友链
  • 分类
  • 标签
  • 归档
👨‍👩‍👦‍👦腾讯云社区
🗣GitHub
  • Docker

  • Zabbix

  • Elasticsearch

  • K8s

  • Mysql

  • Redis

  • Nginx

  • Prometheus

  • Ansible

    • ansible安装
      • 在线yum安装
      • 离线安装
      • 配置免密登录
    • ansible创建用户
    • ansible自动搭建redis5集群
    • ansible自动搭建elasticsearch集群
  • 大数据部分

  • 其他

  • 安装
  • Ansible
summer
2020-06-24

ansible安装

# 在线yum安装

[root@summer ~]# yum install -y epel-release  ##先安装epel源
[root@summer ~]# yum install ansible -y    
[root@summer ~]# ansible --version
ansible 2.9.15
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Apr  2 2020, 13:16:51) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
[root@summer ~]# 
1
2
3
4
5
6
7
8
9
10

# 离线安装

略

思路是yum获取所有的依赖包

# 配置免密登录

  1. host配置
[root@summer ~]# vim /etc/ansible/host
[redis]
192.168.0.68 ansible_ssh_user=root ansible_ssh_pass=hadoop prot=27000
192.168.0.186 ansible_ssh_user=root ansible_ssh_pass=1340904087 prot=27000
192.168.0.90 ansible_ssh_user=root ansible_ssh_pass=1340904087 prot=27000
...
1
2
3
4
5
6
  1. 免密互信

这里注意添加本机ip

[root@summer ~]# ssh-keygen -t rsa
[root@summer ~]# ssh-copy-id 192.168.0.68
[root@summer ~]# ssh-copy-id 192.168.0.90
[root@summer ~]# ssh-copy-id 192.168.0.186
1
2
3
4
  1. 验证
  • 列出所有被管理主机list
ansible all --list
1
  • ping各节点
ansible all -m ping
1
  • 查看hostname
ansible summer -m shell -a 'hostname' -o
1
  • 查看主机内存信息
ansible all -m setup -a 'filter=ansible_*_mb'
1
  • 创建文件夹
ansible summer -m file -a 'path=/home/app state=directory'
1
  • 查看文件
ansible summer -m shell -a 'ls -l /home/app'
1
  • 删除文件
ansible summer -m file -a 'path=/home/app state=absent'
1
  • 复制文件到本机
ansible summer -m fetch -a 'src=/home/app/123.txt dest=/home'
1
#ansible
上次更新: 1/25/2021, 6:15:49 PM
redis-exporter部署
ansible创建用户

← redis-exporter部署 ansible创建用户→

最近更新
01
ceph块设备使用iscsi
03-29
02
Citrix设置vm开机自启动
02-17
03
ntp与chrony时间同步
12-17
更多文章>
Theme by Vdoing | Copyright © 2019-2023 夏苏文 | MIT License

网站已在灾难中运行:

蜀ICP备2022029853号-1
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式