毕业设计之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. 关于环境 ...
随机推荐
- Beta阶段第十次会议
Beta阶段第十次会议 时间:2020.5.26 完成工作 姓名 完成工作 难度 完成度 ltx 1.修正小程序新闻bug2.修正小程序认证bug 中 80% xyq 1.上传信息编辑部分代码到服务器 ...
- CSS 奇技淫巧 | 巧妙实现文字二次加粗再加边框
本文将通过一个实际的业务需求,讲解如何实现 极端场景下文字加粗加边框效果 文字多重边框的效果 需求背景 - 文字的二次加粗 今天遇到这样一个有意思的问题: 在文字展示的时候,利用了 font-weig ...
- 2021.10.7考试总结[NOIP模拟71]
信心赛,但炸了.T3SB错直接炸飞,T4可以硬算的组合数非要分段打表求阶乘..T2也因为一个细节浪费了大量时间.. 会做难题很好,但首先还是要先把能拿的分都拿到. T1 签到题 结论:总可以做到对每个 ...
- 广域网(ppp协议、HDLC协议)
文章转自:https://blog.csdn.net/weixin_43914604/article/details/105028759 学习课程:<2019王道考研计算机网络> 学习目的 ...
- (转载)关于Linux C函数strtok的使用要点
今天遇到了处理字符串的问题,比如分割问题,但是一时间想不起来什么方法,也不想手写一个类似java String中的split函数,于是百度了一下,发现了strtok这个好用的方法,以此作为总结. st ...
- 调整数组顺序使奇数位于偶数前面 牛客网 剑指Offer
调整数组顺序使奇数位于偶数前面 牛客网 剑指Offer 题目描述 输入一个整数数组,实现一个函数来调整该数组中数字的顺序,使得所有的奇数位于数组的前半部分,所有的偶数位于数组的后半部分,并保证奇数和奇 ...
- html5的Message信息提示框
1.定义dialog <dialog id="showDialog"> <div>您没有权限访问本页面!</div> </dialog&g ...
- ansible安装和批量执行命令
yum install -y ansible 编辑 /etc/ansible/hosts 文件 # This is the default ansible 'hosts' file.## It sho ...
- Mysql教程:(三)运算符:数学运算符
运算符:数学运算符 mysql> select class,number,maths,maths+5 from score; mysql>select class,number,chine ...
- 3D 穿梭效果?使用 CSS 轻松搞定
背景 周末在家习惯性登陆 Apex,准备玩几盘.在登陆加速器的过程中,发现加速器到期了. 我一直用的腾讯网游加速器,然而点击充值按钮,提示最近客户端升级改造,暂不支持充值(这个操作把我震惊了~).只能 ...