# ansible-code **Repository Path**: newwy/ansible-code ## Basic Information - **Project Name**: ansible-code - **Description**: 简单部署 - **Primary Language**: Shell - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-11-09 - **Last Updated**: 2023-04-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: shell ## README shell 脚本 > ansible > shell 脚本 安装前需要先做 ssh 密钥,最好作免密登陆 # ansible 安装 说明:本安装是基于 centos7 系统 ## 一 安装包 位置:/package 内容: ### mysql/nginx/php/wordpress/tomcat libiconv-1.14.tar.gz mysql-5.5.32-linux2.6-x86_64.tar.gz nginx-1.10.2.tar.gz php-5.3.28.tar.gz wordpress-4.7.4-zh_CN.tar.gz jdk-8u60-linux-x64.tar.gz apache-tomcat-8.0.27.tar.gz ### jpress apache-maven-3.3.9-bin.tar.gz jpress-web-newest.war ### lb keepalived-2.0.10.tar.gz ## 二 hosts 主机 [nginx] #开两个网段 200 和 100 an-nginx01 an-nginx02 [tomcat] #开两个网段 200 和 100 an-tomcat01 地址:192.168.200.189:8080 # 做免秘钥登录 [mysql] an-mysql [lb] #高可用+负载均衡 an-lb01 an-lb02 # 三 角色备注 ## roles/nginx nginx.conf 自动添加:include extra/www.conf;并单独创建了 extra 目录和 www.conf 文件 网页根目录在默认 html 里 ## roles/php ## roles/lb 反向代理,keepalived 高可用 # 报错 ### 1、fatal: [redis01]: FAILED! => {"msg": "Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this. Please add this host's fingerprint to your known_hosts file to manage this host."} ### 产生的原因 如果控制端和被控制端第一次通讯,需要先添加指纹信息 ### 解决方法 添加指纹信息 ``` [root@m01 ~]# ssh 172.16.1.7 The authenticity of host '172.16.1.7 (172.16.1.7)' can't be established. ECDSA key fingerprint is SHA256:KS0T63CVc6vyFB3MHXLjPGCuTL3AIaNR5Jk1D92pW8Q. ECDSA key fingerprint is MD5:5e:6e:7e:90:16:0c:0e:c3:a2:3d:73:2a:9a:be:40:aa. Are you sure you want to continue connecting (yes/no)? yes root@172.16.1.7's password: 输入密码 Last login: Tue Feb 26 15:58:50 2019 from 10.0.0.1 [root@web01 ~]# exit logout Connection to 172.16.1.7 closed. [root@m01 ~]# ansible web01 -m ping -i ./hosts 172.16.1.7 | SUCCESS => { "changed": false, "ping": "pong" } ```