毕业设计之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. 关于环境 ...
随机推荐
- MacOS安装使用Kettle
一.环境说明 操作系统版本:macOS Big Sur 11.6.1 机型:Intel版本 JDK版本:Amazon Corretto-openjdk8 Kettle版本:Kettle8.9 二.问题 ...
- (数据科学学习手札129)geopandas 0.10版本重要新特性一览
本文示例代码及文件已上传至我的Github仓库https://github.com/CNFeffery/DataScienceStudyNotes 1 简介 就在前不久,我们非常熟悉的Python地理 ...
- LVDS DP等显示器接口简介
LVDS 产品传输速率从几百Mbps到2Gbps.它是电流驱动的,他通过在接收端放置一个负载而得到的电压,当电流正向流动,接收端输出为1,反之为0,它的摆幅250mV-450mV. lvds 即低压差 ...
- 最长子序列(线性DP)学习笔记
子序列和子串不一样.子串要求必须连续,而子序列不需要连续. 比如说\(\{a_1,a_2\dots a_n\}\),他的子串就是\(\{a_i,a_{i+1},\dots, a_j|1\leq i\l ...
- Xpath运算符
5.position定位 >>print tree.xpath('//*[@id="testid"]/ol/li[position()=2]/text()')[0] & ...
- MVC中单选按钮的实现
-------------控制器-------------- ViewBag.Kinds = SYS_Category.List(xxxxxxxxxxxxxxxxxxxxxxx); --------- ...
- Luogu P1654 OSU! | 期望
题目链接 很妙的一道题. 题目要求$X^3$的期望值. 直接求不好求. 考虑先求出$X$和$X^2$的期望值,然后再求$X^3$的期望值. 迎.刃.而.解. #include<iostream& ...
- Java之父 James Gosling 发表博文 《Too Soon》纪念乔布斯。
几个礼拜前,我们还在讨论乔布斯的辞职.虽然我们都知道这意味着什么,但是我没有想到一切来的如此之快.已经有很多关于这件事情的文章了,特别是"经济学人"的这篇文章. 乔布斯是一个很独特 ...
- 2021.11.4测试T1-妹子
题目 今天测试,直接挂完了 写了四个小时,最后发现自己题目理解错误了 有两个区间,在输入了 \(l\) 和 \(r\) 以后,进行查询 \[ min(max(a_1,a_2,...a_p,b_{p+1 ...
- 羽夏看Win系统内核——保护模式篇
写在前面 此系列是本人一个字一个字码出来的,包括示例和实验截图.由于系统内核的复杂性,故可能有错误或者不全面的地方,如有错误,欢迎批评指正,本教程将会长期更新. 如有好的建议,欢迎反馈.码字不易, ...