毕业设计之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. 关于环境 ...
随机推荐
- 无网络下,配置yum本地源
1. 新建一个没有iso镜像文件的虚拟机: 2. 本地上传一个镜像文件(CentOS7的镜像),到虚拟机已创建的目录: 例如:上传一个镜像文件CentOS-7-x86_64-Everything-17 ...
- 21.10.9 test
T1 购票方案 \(\color{green}{100}\) 对于每个时间节点维护它作为每种票所能包含的最后一个点时,这种票的起始点位置,由于这个位置是单调的,所以类似双指针维护,\(O(KN)\) ...
- 多线程--vthread
vthread中包含两个类: vthread.vthread.pool vthread.vthread.thread 其中class pool的原型如下: class pool(builtins.ob ...
- Wedding DJ题解 (回归OI)
写在前面 高考结束了, 很遗憾, 我是其中的失败者, zzu, 没有想过最后来到这个学校, 并且还是信息安全专业, 不过, 时间久了, 也慢慢适应了: 当我被这个学校的这个专业录取, 也就注定着, 我 ...
- hdu 3032 Nim or not Nim? (SG,然后找规律)
题意: n堆石头,每堆石头个数:s[1]...s[n]. 每人每次可以选择在一堆中取若干个(不能不取),或者把一堆石头分成两堆(两堆要都有石头). 无法操作者负. 数据范围: (1 ≤ N ≤ 10^ ...
- netty系列之:搭建客户端使用http1.1的方式连接http2服务器
目录 简介 使用http1.1的方式处理http2 处理TLS连接 处理h2c消息 发送消息 总结 简介 对于http2协议来说,它的底层跟http1.1是完全不同的,但是为了兼容http1.1协议, ...
- Oracle ORA 12541 报错解决过程
Oracle 导入全库之后使用plsql登陆时报错 版本12C版本2 ORA-12541: TNS: No Listener 再oracle主机本地可以使用sqlplus 登陆,但是使用plsql无法 ...
- clnt_create: RPC: Port mapper failure - Unable to receive: errno 111 (Connection refused)
clnt_create: RPC: Port mapper failure - Unable to receive: errno 111 (Connection refused) 关闭防火墙,可以连, ...
- spring security之 默认登录页源码跟踪
spring security之 默认登录页源码跟踪 2021年的最后2个月,立个flag,要把Spring Security和Spring Security OAuth2的应用及主流程源码研究透 ...
- k8s入坑之路(10)kubernetes coredns详解
概述 作为服务发现机制的基本功能,在集群内需要能够通过服务名对服务进行访问,那么就需要一个集群范围内的DNS服务来完成从服务名到ClusterIP的解析. DNS服务在kubernetes中经历了三个 ...