如何在智能告警平台CA触发测试告警
848
2022-10-04
自动化运维工具之Ansible实战-应用部署
如若将软件部署过程比作盖房入住的过程,那么虚拟机的交付即为毛坯交付,虚拟机的初始化为刷白,贴瓷砖;应用的部署则为家居,家电的摆放调试。本文假定是你自己搞的装修,所有任务均需要主人亲自上手。后续将提供精装交钥匙方案(playbook),满足“拎包入住”的需求。
1. JDK环境配置
JDK版本升级到应用程序所需的版本
ansible apmgr_group -m copy -a 'src="/etc/ansible/jdk1.8.0_181" dest="/opt/" owner=hdm group=hdm' -f 10# 两个命令均可ansible apmgr_group -m shell -a 'cd opt;ln -s opt/jdk1.8.0_181/ opt/java'ansible apmgr_group -m file -a ' path="/opt/java" src="/opt/jdk1.8.0_181/" owner=hdm group=hdm mode=755 state=link'ansible apmgr_group -m shell -a 'chmod -R 755 opt/java'
环境变量配置
ansible apmgr_group -m copy -a 'src="/etc/ansible/bash_profile" dest="/home/hdm/.bash_profile" owner=hdm group=hdm' -f 10
2. apmgr应用部署
安装目录规划
ansible apmgr_group -m shell -a "mkdir -pv opt/alsoft/{exec,tools,itmsplus}"
安装包配置
ansible apmgr_group -m copy -a 'src="/etc/ansible/apmgr.0309" dest="/opt/alsoft/itmsplus/" owner=hdm group=hdm mode=755' -f 10ansible apmgr_group -m shell -a 'mv /opt/alsoft/itmsplus/apmgr.0309 /opt/alsoft/itmsplus/apmgr ' -f 10ansible apmgr_group -m copy -a 'src="/etc/ansible/tools" dest="/opt/alsoft/" owner=hdm group=hdm mode=755' -f 10ansible apmgr_group -m shell -a 'cd /opt/alsoft/exec;ln -s ../itmsplus/apmgr/etc/apmgrWrapper S999apmgr;ln -s ../itmsplus/apmgr/etc/apmgrWrapper K999apmgr'ansible apmgr_group -m shell -a 'chmod -R 755 /opt/alsoft'
应用软件启动测试
ansible apmgr_group -m shell -a '/opt/alsoft/tools/uninmcs/nmc -l'
3. ihdmgr应用部署
安装目录规划
ansible ihdmgr_group -m shell -a "mkdir -pv /opt/alsoft/{exec,tools,itmsplus}"
应用软件部署
ansible ihdmgr_group -m copy -a 'src="/etc/ansible/ihdmgr188" dest="/opt/alsoft/itmsplus/" owner=hdm group=hdm mode=755' -f 10ansible ihdmgr_group -m shell -a 'mv /opt/alsoft/itmsplus/ihdmgr188 /opt/alsoft/itmsplus/ihdmgr'ansible ihdmgr_group -m copy -a 'src="/etc/ansible/tools" dest="/opt/alsoft/" owner=hdm group=hdm mode=755' -f 10ansible ihdmgr_group -m shell -a 'cd /opt/alsoft/exec;ln -s ../itmsplus/ihdmgr/etc/ihdmgrWrapper S999ihdmgr;ln -s ../itmsplus/ihdmgr/etc/ihdmgrWrapper K999ihdmgr'ansible ihdmgr_group -m shell -a 'chown -R hdm:hdm /opt/alsoft/' -f 10
应用软件启动测试
ansible ihdmgr_group -m shell -a '/opt/alsoft/tools/uninmcs/nmc -l'
发表评论
暂时没有评论,来抢沙发吧~