毕业设计之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. 关于环境 ...
随机推荐
- zlib开发笔记(四):zlib库介绍、编译windows vs2015x64版本和工程模板
前言 Qt使用一些压缩解压功能,介绍过libzip库编译,本篇说明zlib库.需要用到zlib的msvc2015x64版本,编译一下. 版本编译引导 zlib在windows上的mingw32 ...
- [对对子队]会议记录5.15(Scrum Meeting2)
今天已完成的工作 吴昭邦 工作内容:衔接循环指令系统,搭建第4关 相关issue:实现循环组件 相关签入:feat: 将模型加入第四关 第四关可以顺利通过 何瑞 工作内容:衔接循环指令 ...
- 使用logstash的input file filter收集日志文件
使用logstash的input file filter收集日志文件 一.需求 二.实现步骤 1.前置知识 2.编写pipeline文件 3.Input 中 file 插件的部分参数解释: 4.启动l ...
- 热身训练2 The All-purpose Zero
The All-purpose Zero 简要题意: 长度为n的数组,每个数字为S[i],$0$是一种很神奇的数字,你想要的,它都可以变! 问这个序列的最长上升子序列长度为多少? 分析: 我们将除了 ...
- 2021.5.24考试总结 [NOIP模拟3]
带着爆0的心态考的试,没想到整了个假rk2 (炸鱼大佬wtz忒强了OTZ T1 景区路线规划 这题对刚学完概率期望的我来说简直水爆了好吗.. 因为存在时间限制,不好跑高斯消元,就直接跑dp就完了. 令 ...
- C语言基础知识总结大全
1.入门程序 #include <stdio.h> int main() { printf("Hello World!"); return 0; } 2.数据类型 数据 ...
- Maven还停留在导jar包?快来探索Nexus私服的新世界
写在前面 Maven,学习框架之前我们都会接触到的一个工具,感觉他的定位,似乎就跟git一样,只是方便我们开发?于是自然而然的,很多小猿对于Maven都只是停留在会用的阶段,利用他来构建,打包,引入j ...
- Python课程笔记(四)
1.模块的导入 相当于Java的包或C语言的头文件 (1) import math s = math.sqrt(25) print(s) (2) from math import sqrt s=mat ...
- 攻防世界 杂项13.can_has_stdio?
打开发现是由trainfuck编码组成的小星星阵容,果断交给解密网站进行解密, 解密网站:http://ctf.ssleye.com/brain.html flag:flag{esolangs_for ...
- 从零开始的DIY智能家居 - 基于 ESP32 的智能浇水器
前言 上次 土壤湿度传感器 完成之后,就立下一个 flag 要搭建一个智慧浇水的智能场景,现在终于有时间填坑了!(o゚▽゚)o 智慧浇水场景的核心设备有三个: 检测土壤状态的:土壤湿度传感器 通过这个 ...