当前位置: 首页 > news >正文

连云港网站建设哪家好滨江网站建设公司

连云港网站建设哪家好,滨江网站建设公司,南通六建网站,app软件下载安装官方免费下载目录 (一)练习一 1.新建一个role——app 2.创建文件 3.删除之前安装的httpd服务和apache用户 4.准备tasks任务 (1)创建组group.yml (2)创建用户user.yml (3)安装程序yum.yml (4)修改模板httpd.conf.j2 (5)编写templ.yml (6)编写start.yml (7)编写copyfile.yml (8…

目录

(一)练习一

1.新建一个role——app

2.创建文件

3.删除之前安装的httpd服务和apache用户 

4.准备tasks任务

(1)创建组group.yml

(2)创建用户user.yml

(3)安装程序yum.yml

(4)修改模板httpd.conf.j2

(5)编写templ.yml

(6)编写start.yml

(7)编写copyfile.yml

(8)定义顺序main.yml 

5.准备变量文件vars

(1)编写变量脚本——main.yml

6.准备触发器handlers

(1)编写脚本main.yml

7.编写playbook脚本调度任务

8.角色app目录结构

9.执行脚本

10.检查结果

(二)练习二——使用运算符//,设置缓存大小

1.准备工作

2.修改node141机器的内存

(1)node141现在的内存 

(2)修改node141的内存

(3)修改node141后内存

(4)查看node142的内存 

3.编辑配置文件 

4.准备tasks任务

(1)编写yum.yml

(2)编写start.yml

(3)编写templ.yml 

(4)编写main.yml

5.角色memcached目录结构 

6.编写playbook脚本

7.检查并执行playbook脚本

8.脚本执行结果

(三)推荐资料 


(一)练习一

1.新建一个role——app

[root@ansible145 ansible]# cd roles/[root@ansible145 roles]# rm -rf app/[root@ansible145 roles]# mkdir app[root@ansible145 roles]# cd app/

2.创建文件

[root@ansible145 app]# mkdir tasks templates vars handlers files[root@ansible145 app]# tree
.
├── files
├── handlers
├── tasks
├── templates
└── vars5 directories, 0 files

3.删除之前安装的httpd服务和apache用户 

ansible all -m shell -a 'rm -rf /data/*'ansible all -m shell -a 'userdel -r apache'ansible all -m shell -a 'yum -y remove httpd'ansible all -m shell -a 'rpm -q httpd'

4.准备tasks任务

(1)创建组group.yml

- name: create groupgroup: name=app system=yes gid=123

(2)创建用户user.yml

- name: create useruser: name=app system=yes shell=/sbin/nologin uid=123

(3)安装程序yum.yml

- name: install packageyum: name=httpd

(4)修改模板httpd.conf.j2

[root@ansible145 tasks]# cp /etc/httpd/conf/httpd.conf ../templates/httpd.conf.j2[root@ansible145 tasks]# vim ../templates/httpd.conf.j241 #Listen 12.34.56.78:80
42 Listen {{ ansible_processor_vcpus*10 }}
43 #
44 # Dynamic Shared Object (DSO) Support64 #
65 User {{ username }}
66 Group {{ groupname }}
67 
68 # 'Main' server configuration

(5)编写templ.yml

- name: copy conftemplate: src=httpd.conf.j2 dest=/etc/httpd/conf/httpd.confnotify: restart service

(6)编写start.yml

- name: start serviceservice: name=httpd state=started enabled=yes

(7)编写copyfile.yml

- name: copy confcopy: src=vhosts.conf dest=/etc/httpd/conf.d/ owner=app

(8)定义顺序main.yml 

- include: group.yml
- include: user.yml
- include: yum.yml
- include: templ.yml
- include: copyfile.yml
- include: start.yml

5.准备变量文件vars

(1)编写变量脚本——main.yml

[root@ansible145 vars]# vim main.ymlusername: app
groupname: app

6.准备触发器handlers

(1)编写脚本main.yml

[root@ansible145 app]# vim handlers/main.yml- name: restart serviceservice: name=httpd state=restarted

7.编写playbook脚本调度任务

[root@ansible145 ansible]# vim app_role.yml- hosts: websrvsremote_user: rootroles:- app

8.角色app目录结构

9.执行脚本

[root@ansible145 ansible]# ansible-playbook app_role.yml

10.检查结果

[root@node141 ~]# ss -ntl
users:(("httpd",pid=10792,fd=4),("httpd",pid=10791,fd=4),("httpd",pid=10790,fd=4),("httpd",pid=10789,fd=4),("httpd",pid=10788,fd=4),("httpd",pid=10787,fd=4))[root@node141 ~]# getent passwd app
app:x:123:100::/home/app:/sbin/nologin[root@node141 ~]# getent group app
app:x:123:[root@node141 ~]# ps aux | grep app
app       10788  0.0  0.1 221948  2968 ?        S    12:01   0:00 /usr/sbin/httpd -DFOREGROUND
app       10789  0.0  0.1 221948  2968 ?        S    12:01   0:00 /usr/sbin/httpd -DFOREGROUND
app       10790  0.0  0.1 221948  2968 ?        S    12:01   0:00 /usr/sbin/httpd -DFOREGROUND
app       10791  0.0  0.1 221948  2968 ?        S    12:01   0:00 /usr/sbin/httpd -DFOREGROUND
app       10792  0.0  0.1 221948  2968 ?        S    12:01   0:00 /usr/sbin/httpd -DFOREGROUND
root      10850  0.0  0.0 112660   964 pts/1    S+   12:08   0:00 grep --color=auto app

(二)练习二——使用运算符//,设置缓存大小

要求每台被控机memcached的缓存空间为物理内存的1/4

1.准备工作

[root@ansible145 roles]# cd memcached/[root@ansible145 memcached]# mkdir tasks templates[root@ansible145 memcached]# yum install -y memcached[root@ansible145 memcached]# cat /etc/sysconfig/memcached 
PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS=""

2.修改node141机器的内存

(1)node141现在的内存 

(2)修改node141的内存

(3)修改node141后内存

(4)查看node142的内存 

3.编辑配置文件 

[root@ansible145 memcached]# cp /etc/sysconfig/memcached templates/memcached.j2[root@ansible145 memcached]# vim templates/memcached.j2 PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="{{ ansible_memtotal_mb//4 }}"
OPTIONS=""

4.准备tasks任务

(1)编写yum.yml

- name: install packageyum: name=memcached

(2)编写start.yml

- name: start serviceservice: name=memcached state=started enabled=yes

(3)编写templ.yml 

- name: copy conftemplate: src=memcached.j2 dest=/etc/sysconfig/memcached

(4)编写main.yml

- include: yum.yml
- include: templ.yml
- include: start.yml

5.角色memcached目录结构 

6.编写playbook脚本

[root@ansible145 ansible]# vim memcached_role.yml- hosts: websrvsremote_user: rootroles:- memcached

7.检查并执行playbook脚本

[root@ansible145 ansible]# ansible-playbook -C memcached_role.yml[root@ansible145 ansible]# ansible-playbook memcached_role.yml

8.脚本执行结果

(三)推荐资料 

http://galaxy.ansible.com

https://galaxy.ansible.com/explore#/

http://github.com/

http://ansible.com.cn/

https://github.com/ansible/ansible

https://github.com/ansible/ansible-examples

http://www.15wanjia.com/news/184563.html

相关文章:

  • 洛阳市住房和城乡建设局网站h5网页设计软件
  • 网站开发实用技术网站建设分项报价表
  • 惠州网站制作费用网站关键字收录
  • app网站建设 - 百度苏州公司注册费用
  • 做网站系统的过程珠海网站设计哪家好
  • 企业公司建设网站企业微网站怎么做
  • 免费的网站源码去哪下载邯郸媒体网络营销诚信合作
  • 用php做企业网站的可行性做国外网站汇款用途是什么
  • 游戏网站建设免费门户网站策划书
  • 网站策划的内容有那些外贸网站产品关键词
  • 导航网站网站提交怎么做北京海淀区房价
  • 佛山网站建设哪家专业网站icp备案网址
  • 网站接入变更网站支付页面怎么做
  • 如何彻底清除网站的网页木马注册网站不用手机短信验证的
  • 电子商务网站建设的方法及流程图广东省第二中医院官网进入公众号
  • 做h5场景的网站购买网站空间送域名
  • 网站开发方倍工作室杭州模板建站软件
  • 设计网络网站有哪些功能积分商城系统
  • 柳州做网站那家好wordpress自定义文章代码和样式
  • 湖北专业网站建设产品介绍智慧团建官方网站
  • 微信手机网站搭建网站logo怎么做最清楚
  • 学做的网站基础蛋糕网站建设范围
  • 网站模板下载后怎么用搜索引擎官网
  • 网站管理文档怎么写山东省住房城乡建设厅门户网站
  • 嘉兴百度网站推广长治市建设局网站
  • 学院网站建设项目的成本计划书wordpress支持大数据处理
  • 网站构建专业网站公司
  • asp企业网站模板卫计网站建设工作计划
  • 东莞网站提升排名windows10php网站建设
  • 新开传奇网站发布站搜索引擎排名优化seo