linux根据ip获得网卡名 #!/bin/baship="10.0.0.14"interfaces=(`ip l | awk -F":" '/^[^ ]/{print $2}'| awk '{print $1}'`)for interface in ${interfaces[*]};do rs=`ip a show $interface| grep $ip` if [ -n "$rs" ];then echo $interface
一键部署k8s脚本,基于kubeasz #!/bin/bash#指定kubeasz版本,并下载release=3.1.1##k8s集群名称K8S_CLUSTER_NAME="k8s-gan"#harbor地址HARBOR_ADDR=10.0.0.84#harbor账号HARBOR_USERNAME="admin"#harbor密码HARBOR_PASSWD="123456"#全部k8s节点TOTAL_ADDR="10.0.0.81 10.0.0.82 10.0.0.83"#master节点,不为IP时注意添加解析MA
ssh免秘钥登录 #!/bin/bashPASS=1234567rm -rf /root/.sshssh-keygen -P "" -f /root/.ssh/id_rsaapt install -y sshpassAliveIP=("10.0.0.80" \"10.0.0.81" \"10.0.0.82" \"10.0.0.85" \"10.0.0.86" \"10.0.0.87" \"10.0.0.90" \"10.0.0.91" \"10.0.0.92")for n in ${AliveI
简单的CICD部署脚本 #!/bin/bash#================================================================# Copyright (C) 2021 . All rights reserved.# # 文件名称:test1.sh# 创 建 者:gan# 创建日期:2021年08月12日# 描 述:##==========================================================
zabbix-api批量添加主机 #!/bin/bash#================================================================# Copyright (C) 2021 . All rights reserved.# # 文件名称:add_host.sh# 创 建 者:gan# 创建日期:2021年08月07日# 描 述:##=======================================================
ansible二进制安装docker ---- hosts: 10.0.0.33 vars: - dockerver: "19.03.15" - dockersrc: "http://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/static/stable/x86_64/docker-{{dockerver}}.tgz" - dockerdir: "/usr/bin" - dockerdatadir: /data/docker tasks:
编译安装redis #!/bin/bashset -ueVERSION=redis-6.2.4PASSWORD=123456INSTALL_DIR=/apps/rediscolor () { RES_COL=60 MOVE_TO_COL="echo -en \\033[${RES_COL}G" SETCOLOR_SUCCESS="echo -en \\033[1;32m" SETCOLOR_FAILURE="echo -en \\033[1;31m" SETCOLOR_WARN
一键安装jdk和tomcat脚本 #!/bin/bashDIR=`pwd`JDK_FILE="jdk-8u291-linux-x64.tar.gz"JDK_DIR="/usr/local"color () { RES_COL=60 MOVE_TO_COL="echo -en \\033[${RES_COL}G" SETCOLOR_SUCCESS="echo -en \\033[1;32m" SETCOLOR_FAILURE="echo -en \\033[1;31m" SETCOLOR_WA
利用ansible为php-fpm编译添加redis模块 ---- hosts: 10.0.0.171 vars: redisver: phpredis-5.3.4 redissrc: phpredis-5.3.4.tar.gz phpdir: /data/php tasks: - name: autoconf yum: name=autoconf - name: get php-redis code unarchive: remote_src=no src={{redissrc}} de
ansible配置nginx支持fastcgi ---- hosts: 10.0.0.171 vars: nginxver: 1.20.1 appdir: "/apps/nginx-{{nginxver}}" htmldir: /data/nginx/html tasks: - name: create http conf file: path={{appdir}}/conf/http state=directory owner=nginx group=nginx - name:
ansible编译安装nginx ---- hosts: 10.0.0.171 vars: nginxver: 1.18.0 nginxsrc: "http://nginx.org/download/nginx-{{nginxver}}.tar.gz" srcdir: "/usr/local/src/nginx-{{nginxver}}" appdir: "/apps/nginx-{{nginxver}}" tasks: - name: get cpus shel
修改配置 apache支持 fastcgi ---- hosts: 10.0.0.172 vars: httpdconf: /data/httpd24/conf/httpd.conf httpdhome: /data/httpd24 htmldir: /var/www/html tasks: - name: create htmldir file: path={{htmldir}} state=directory owner=apache group=apache - n
ansible源码编译安装php7.4,基于fastcgi ---#install php7.4 with fastcgi- hosts: 10.0.0.171 gather_facts: no vars: phpver: php-7.4.19 phpsrc: https://mirrors.sohu.com/php/{{phpver}}.tar.gz dir: /data/php tasks: - name: install necessary packs yum: name:
ansible源码编译安装apache ---- hosts: websrvs gather_facts: no vars: httpd_name: httpd-2.4.48 apr_name: apr-1.7.0 apr_util_name: apr-util-1.6.1 dir: /apps/httpd24 tasks: - name: install necessary packs yum: name: - gcc