毕业设计之ansible_quan_bbs设置
ansible创建连接:
客户端(管理节点)
可能需要安装包:
yum install -y libselinux-python
实现ssh免密码登陆管理的服务器
[apps@anza ~]$ sudo ssh-keygenGenerating public/private rsa key pair.Enter file in which to save the key (/root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa.Your public key has been saved in /root/.ssh/id_rsa.pub.The key fingerprint is:1d:28:6a:40:c3:b7:a7:c8:90:e3:f7:47:f1:67:1f:52 root@anza.quan.byThe key's randomart image is:+--[ RSA 2048]----+| .o || .... . || ... .. . . ||+ ....o . . E ||.+ .oo S . . || .oo. . . + . || . . . o o . || . . . || . |+-----------------+[apps@anza ~]$ sudo ssh-copy-id root@192.168.111.131root@192.168.111.131's password: Now try logging into the machine, with "ssh 'root@192.168.111.131'", and check in:
.ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
测试是否成功:
[apps@anza ~]$ ssh root@192.168.111.131
The authenticity of host '192.168.111.131 (192.168.111.131)' can't be established.
RSA key fingerprint is 3c:ff:51:9e:3c:cc:dd:66:42:f1:49:09:4f:5c:a0:96.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.111.131' (RSA) to the list of known hosts.
Last login: Wed Feb 5 03:56:21 2020 from 192.168.111.1
[root@nginxload ~]# exit
logout
Connection to 192.168.111.131 closed.
ansible安装:
yum install epel-release -y
yum install ansible -y
编辑配置文件
加上:
[nginx_load]
192.168.111.131
测试:
执行带参数的脚本方式:
1先复制到目标服务器:
[apps@anza tmp]$ sudo ansible nginx_load -m copy -a "src=/tmp/Initialize.quan.sh dest=/tmp/Initialize.quan.sh mode=0755"
192.168.111.131 | SUCCESS => {
"changed": true,
"checksum": "204e981c18c685762171813141958d3571ca1091",
"dest": "/tmp/Initialize.quan.sh",
"gid": 0,
"group": "root",
"md5sum": "669c73745fdb44b62c80ea4db2d67e3b",
"mode": "0755",
"owner": "root",
"secontext": "unconfined_u:object_r:admin_home_t:s0",
"size": 8724,
"src": "/root/.ansible/tmp/ansible-tmp-1580824364.23-140749257914601/source",
"state": "file",
"uid": 0
}
指定脚本执行(带参数):
[apps@anza tmp]$ sudo ansible nginx_load -m shell -a "/tmp/Initialize.quan.sh nginxload.one.bbs 2004 2004 "
192.168.111.131 | SUCCESS | rc=0 >>
Changing password for user apps.
passwd: all authentication tokens updated successfully.
Changing password for user dev.
passwd: all authentication tokens updated successfully.
Locking password for user adm.
passwd: Success
Locking password for user lp.
passwd: Success
Locking password for user sync.
passwd: Success
Locking password for user shutdown.
passwd: Success
Locking password for user halt.
passwd: Success
Locking password for user mail.
passwd: Success
Locking password for user uucp.
passwd: Success
Locking password for user operator.
passwd: Success
Locking password for user games.
passwd: Success
Locking password for user gopher.
passwd: Success
Locking password for user vcsa.
passwd: Success
Locking password for user saslauth.
passwd: Success
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
ip6tables: Setting chains to policy ACCEPT: filter [ OK ]
ip6tables: Flushing firewall rules: [ OK ]
ip6tables: Unloading modules: [ OK ]
Stopping sshd: [ OK ]
Starting sshd: [ OK ]
Stopping crond: [ OK ]
Starting crond: [ OK ]
Shutting down postfix: [ OK ]
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.ustc.edu.cn
* updates: mirrors.163.com
Package lrzsz-0.12.20-27.1.el6.x86_64 already installed and latest version
Package 2:vim-enhanced-7.4.629-5.el6_10.2.x86_64 already installed and latest version
Package gcc-4.4.7-23.el6.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package ntpdate.x86_64 0:4.2.6p5-15.el6.centos will be installed
--> Finished Dependency Resolution Dependencies Resolved ================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
ntpdate x86_64 4.2.6p5-15.el6.centos updates 79 k Transaction Summary
================================================================================
Install 1 Package(s) Total download size: 79 k
Installed size: 123 k
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : ntpdate-4.2.6p5-15.el6.centos.x86_64 1/1
Verifying : ntpdate-4.2.6p5-15.el6.centos.x86_64 1/1 Installed:
ntpdate.x86_64 0:4.2.6p5-15.el6.centos Complete!
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.ustc.edu.cn
* updates: mirrors.163.com
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:6-8 will be installed
--> Finished Dependency Resolution Dependencies Resolved ================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
epel-release noarch 6-8 extras 14 k Transaction Summary
================================================================================
Install 1 Package(s) Total download size: 14 k
Installed size: 22 k
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : epel-release-6-8.noarch 1/1
Verifying : epel-release-6-8.noarch 1/1 Installed:
epel-release.noarch 0:6-8 Complete!
All configurations are done,server will be reboot in 60 seconds!ntpd: unrecognized service
error reading information on service ntpd: No such file or directory
/tmp/Initialize.quan.sh: line 252: set_hostname: command not found
修改host指定用户和端口:
[servers]
192.168.0.11 ansible_ssh_user=root ansible_ssh_port=13381
192.168.0.12 ansible_ssh_user=root ansible_ssh_port=13382
192.168.0.13 ansible_ssh_user=root ansible_ssh_port=13383
192.168.0.14 ansible_ssh_user=root ansible_ssh_port=13384
毕业设计之ansible_quan_bbs设置的更多相关文章
- Linux命令总结大全,包含所有linux命令
使用说明:此文档包含所有的Linux命令,只有你想不到的没有你看不到的,此文档共计10万余字,有8400多行,预计阅读时间差不多需要3个小时左右,所以要给大家说一说如何阅读此文档 为了方便大家阅读,我 ...
- 【绝对干货】仿微信QQ设置图形头像裁剪,让你的App从此炫起来~
最近在做毕业设计,想有一个功能和QQ一样可以裁剪头像并设置圆形头像,额,这是设计狮的一种潮流. 而纵观现在主流的APP,只要有用户系统这个功能,这个需求一般都是在(bu)劫(de)难(bu)逃(xue ...
- 毕业设计 之 二 PHP学习笔记(一)
毕业设计 之 二 PHP学习笔记(一) 作者:20135216 平台:windows10 软件:XAMPP,DreamWeaver 一.环境搭建 1.XAMPP下载安装 XAMPP是PHP.MySQL ...
- 毕业设计--天气预报App
9月中旬,开始动手做我的毕业设计了,之前一直在纠结做啥,后来想想,既然是做毕业设计,那就大胆地做点自己没接触过的东西吧.然后网上查找资料得知做天气预报需要用到开放的API,而且要用那种现在还在维护的, ...
- 【毕业设计】基于Android的家校互动平台开发(内含完整代码和所有文档)——爱吖校推(你关注的,我们才推)
☆ 写在前面 之前答应大家的毕业答辩之后把所有文档贡献出来,现在答辩已过,LZ信守承诺,把所有文档开源到了GitHub(这个地址包含所有的代码和文档以及PPT,外层为简单的代码).还望喜欢的朋友们,不 ...
- Android毕业设计-微圈
勤拂拭软件出品,必属精品 : 勤拂拭软件 去年做了一个类似于我的朋友圈的项目,主要功能就是用户可以实时发表自己的动态,好友可以评论点赞什么的,可以建群,聊天啊,拉黑啊,反正是一个不错的社交软件,包含服 ...
- 解决bootstrap row span设置border换行的问题
Hadoop方面的毕业设计告一段落了,趁这几天空闲时间认真学习一下之前常使用但是却没用好的Bootstrap. 本文记录Bootstrap框架使用栅格系统时,遇到row内的span设置border换行 ...
- eclipse中tomcat内存溢出设置
Eclipse里启动Tomcat,配置内存大小 2009年12月11日 星期五 10:50 一般安装完eclipse之后,在安装目录下你应该可以看到有一个 eclipse.ini 文件,对了,就是在这 ...
- 毕业设计 之 五 PHP语法学习笔记
毕业设计 之 四 PHP语法学习笔记 作者:20135216 平台:windows10 软件:XAMPP,DreamWeaver 说明:该笔记是对网站编程语言的详细学习 一.PHP基础 0. 关于环境 ...
随机推荐
- 2021.10.27考试总结[冲刺NOIP模拟17]
T1 宝藏 发现每个数成为中位数的长度是关于权值单调的.线段树二分判断是否合法,单调指针扫即可. 考场上写了二分,平添\(\log\). \(code:\) T1 #include<bits/s ...
- C语言中都有哪些常见的数据结构你都知道几个?
上次在面试时被面试官问到学了哪些数据结构,那时简单答了栈.队列/(ㄒoㄒ)/~~其它就都想不起来了,今天有空整理了一下几种常见的数据结构,原来我们学过的数据结构有这么多~ 首先,先来回顾下C语言中常见 ...
- Java 将Excel转为et和ett格式
以.et结尾的文件格式是属于金山办公软件WPS Office中的电子表格文件,.ett是一种模板文件格式.除了通过WPS软件可以创建该格式的电子表格外,也可以通过格式转换的方法来获得,如将Micros ...
- vue.js+elementUI文件上传、文件导入、文件下载
1.文件下载 <el-button plain @click ="exportVmExcel()" size='mini' icon="el-icon-downlo ...
- 更优于 Shellinabox 的 web shell 工具 -- ttyd
ttyd 是一个运行在服务端,客户端通过web浏览器访问从而连接后台 tty (pts伪终端)接口的程序,把 shell 终端搬到 web 浏览器中. WebSocket WebSocket 是 HT ...
- Linux环境下安装中山大学东校区iNode客户端
在中山大学登录校园网有两种方式,一种是连接WiFi,另一种是连接网线.这两种上网方式都需要用到NetID,但是连接网线的话还需要使用到iNode客户端(指东校区). Windows下iNode客户端的 ...
- docker使用redis过程出现的问题记录
第一次使用docker搭建成功了单机版redis,但在使用过程中,还是遇到了不少问题,故而先把这些问题记录下来,以防后面再出现会忘记. 目前,只是在docker中搭建了三个单机版的容器,打算先捣鼓一周 ...
- harbor安装高可用
harbor架构 下载地址https://github.com/goharbor/harbor/ 高可用架构 解压压缩包 tar -xvf harbor-offline-installer-v1.10 ...
- 前端调试工具(DevTools)
前端调试工具(DevTools) 开启:F12 布局 切换PC和移动端 页面元素的快速测试技巧 保持元素的hover等状态:选中当前行点击右键 元素状态改变的监控技巧 触发断点后元素状态不会再改变,可 ...
- 大爽Python入门教程 0-3 安装Atom与配置Python环境
大爽Python入门公开课教案 点击查看教程总目录 安装轻量级IDE--Atom 一 下载 下面步骤1,2中网络卡顿的朋友, 请直接查看步骤3来操作 1. 搜索官网 使用搜索引擎搜索Atom, 打开搜 ...