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

菏泽哪里有做网站的广州疫情今天最新消息

菏泽哪里有做网站的,广州疫情今天最新消息,嘉兴制作网站,做物流网站实验目的如下: 1. 环境准备: 使用命令lab inventory-variables start初始化环境 2. 进入/home/student/git-repos目录克隆下载http://git.lab.example.com:8081/git/inventory-variables.git 3. 将目录下yaml文件内容以group_vars形式修改 4. 部署并将修改后ansible-playbook代…

实验目的如下:

1. 环境准备: 使用命令lab inventory-variables start初始化环境
2. 进入/home/student/git-repos目录克隆下载http://git.lab.example.com:8081/git/inventory-variables.git
3. 将目录下yaml文件内容以group_vars形式修改
4. 部署并将修改后ansible-playbook代码上传git仓库
5. 环境结束使用lab inventory-variables finish清理环境

试验开始

cd /home/student/git-repos
git clone http://git.lab.example.com:8081/git/inventory-variables.git
cd inventory-variables/=====================
确认2个组名
grep hosts deploy_haproxy.yml  deploy_webapp.yml
====得到以下内容:
deploy_haproxy.yml:  hosts: lb_servers
deploy_webapp.yml:  hosts: web_servers
创建目录
mkdir group_vars/{lb_servers,web_servers} -p

此时deploy_haproxy.yml 内容如下.

[student@workstation inventory-variables (master)]$cat deploy_haproxy.yml
- name: Ensure HAProxy is deployedhosts: lb_serversforce_handlers: Trueroles:# The "haproxy" role has a dependency on the "firewall" role.# The "firewall" role requires a "firewall_rules" variable be defined.- role: haproxyfirewall_rules:# Allow 80/tcp connections- port: 80/tcphaproxy_appservers:- name: serverb.lab.example.comip: 172.25.250.11backend_port: 80- name: serverc.lab.example.comip: 172.25.250.12backend_port: 80

将以下内容放入group_vars/lb_servers/firewall.yml中

firewall_rules:# Allow 80/tcp connections- port: 80/tcp

将以下内容放入group_vars/lb_servers/haproxy.yml中(其实这里路径对即可,文件名可以不严格安装这个,只是好识别)

haproxy_appservers:- name: serverb.lab.example.comip: 172.25.250.11backend_port: 80- name: serverc.lab.example.comip: 172.25.250.12backend_port: 80

然后删除deploy_haproxy.yml中的这部分内容,此时deploy_haproxy.yml如下:

- name: Ensure HAProxy is deployedhosts: lb_serversforce_handlers: Trueroles:# The "haproxy" role has a dependency on the "firewall" role.# The "firewall" role requires a "firewall_rules" variable be defined.- role: haproxy

deploy_apache内容如下:

- name: Ensure Apache is deployedhosts: web_serversforce_handlers: Trueroles:# The "apache" role has a dependency on the "firewall" role.# The "firewall" role requires a "firewall_rules" variable be defined.- role: apachefirewall_rules:# Allow http requests from the load_balancer.- zone: internalservice: httpsource: "172.25.250.10"

将以下内容放入group_vars/web_servers/firewall.yml中

firewall_rules:# Allow http requests from the load_balancer.- zone: internalservice: httpsource: "172.25.250.10"

再将源文件这部分内容删除,此时deploy_apache.yml内容如下

- name: Ensure Apache is deployedhosts: web_serversforce_handlers: Trueroles:# The "apache" role has a dependency on the "firewall" role.# The "firewall" role requires a "firewall_rules" variable be defined.- role: apache

执行命令ansible-playbook site.yml运行部署

[student@workstation inventory-variables (master *%)]$ansible-playbook site.ymlPLAY [Ensure HAProxy is deployed] ******************************************************TASK [Gathering Facts] *****************************************************************
ok: [servera.lab.example.com]TASK [firewall : Ensure Firewall Sources Configuration] ********************************
ok: [servera.lab.example.com] => (item={'port': '80/tcp'})TASK [haproxy : Ensure haproxy packages are present] ***********************************
changed: [servera.lab.example.com]TASK [haproxy : Ensure haproxy is started and enabled] *********************************
changed: [servera.lab.example.com]TASK [haproxy : Ensure haproxy configuration is set] ***********************************
changed: [servera.lab.example.com]RUNNING HANDLER [haproxy : reload haproxy] *********************************************
changed: [servera.lab.example.com]PLAY [Ensure Apache is deployed] *******************************************************TASK [Gathering Facts] *****************************************************************
ok: [serverc.lab.example.com]
ok: [serverb.lab.example.com]TASK [firewall : Ensure Firewall Sources Configuration] ********************************
ok: [serverb.lab.example.com] => (item={'zone': 'internal', 'service': 'http', 'source': '172.25.250.10'})
ok: [serverc.lab.example.com] => (item={'zone': 'internal', 'service': 'http', 'source': '172.25.250.10'})TASK [apache : Install http] ***********************************************************
changed: [serverb.lab.example.com]
changed: [serverc.lab.example.com]TASK [apache : Configure SELinux to allow httpd to connect to remote database] *********
ok: [serverb.lab.example.com]
ok: [serverc.lab.example.com]TASK [apache : http service state] *****************************************************
changed: [serverb.lab.example.com]
changed: [serverc.lab.example.com]PLAY [Ensure Web App is deployed] ******************************************************TASK [Gathering Facts] *****************************************************************
ok: [serverb.lab.example.com]
ok: [serverc.lab.example.com]TASK [webapp : Copy a stub file.] ******************************************************
ok: [serverb.lab.example.com]
ok: [serverc.lab.example.com]PLAY RECAP *****************************************************************************
servera.lab.example.com    : ok=6    changed=4    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
serverb.lab.example.com    : ok=7    changed=2    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
serverc.lab.example.com    : ok=7    changed=2    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

访问测试,可以看到实现通过servera对serverb,serverc的轮询

[student@workstation inventory-variables (master *%)]$curl http://servera
This is serverb. (version v1.0)
[student@workstation inventory-variables (master *%)]$curl http://servera
This is serverc. (version v1.0)
[student@workstation inventory-variables (master *%)]$curl http://servera
This is serverb. (version v1.0)
[student@workstation inventory-variables (master *%)]$curl http://servera
This is serverc. (version v1.0)

因为需要对ansible-playbook的管理

git commit  -a -m "Use Group Vars"
git push

至此试验完成,执行以下命令清理环境

lab inventory-variables finish
cd .. && rm -rf inventory-variables
http://www.rdtb.cn/news/20904.html

相关文章:

  • 怎么设计网站规划方案如何开发网站平台
  • 咸阳做网站的公司电话太原百度seo排名软件
  • 株洲手机网站建设西安推广平台排行榜
  • 网站建设开放的端口购买链接平台
  • 上海做网站的的公司seo推广优化方案
  • ubuntu wordpress 搭建关键词排名优化官网
  • 网站建设方案调查分析报告上海百度提升优化
  • 学习建设网站潍坊网站seo
  • 门户网站是啥廊坊关键词优化平台
  • 百度广告买下的订单在哪里找潍坊关键词优化软件
  • 广州注册公司自助办理东莞seo推广
  • 做pc端网站流程浙江seo外包
  • 洛阳营销型网站建设品牌网络推广运营公司
  • 建设厂招工信息网站体验营销案例
  • w网站制作和推广国际军事最新消息今天
  • 2017电商网站建设背景做关键词推广
  • 腾讯域名购买鼓楼网页seo搜索引擎优化
  • wordpress网站 搬家南京seo网络推广
  • 屏显的企业网站应该怎么做手机百度助手
  • 网站备案到公司网站流量查询平台
  • 贵州中小型营销型网站建设公司seo排名工具外包
  • 衡水网站建设哪家好营销网站建设创意
  • 天津网站建设排名建站系统推荐
  • 天猫网站做链接怎么做googleplay
  • 广州做网站的公免费注册推广网站
  • 浙江省建设网站徐叨法广州seo服务外包
  • 做网站编辑要会什么软文范例800字
  • 福建网站备案百度下载正版
  • 南宁保洁网站建设网络广告投放
  • 网站设计建设服务电商大数据查询平台