「自动化运维」带你入门ansible( 二 )

 
3 、template模块
文档内变量的替换的模块ansible develop –m template –a ‘src=https://www.isolves.com/mytemplates/foo.j2 dest=/etc/file.conf mode="u=rw,g=r,o=r"’解释:将src上foo.j2的变量模版复制到dest上 。Template适合用playbook编写 ,通过变量然后拷贝到远程主机 。#1.2、jetty-core中的start.shansible ${ENV} -m template -e "codeName=${codeName} startAddressPort=${startAddressPort}" -a "src=/etc/ansible/newProject/start.sh dest=/App/tc-${codeName}/jetty/${codeName}-core/bin/"#2.1、Tomcat-oms:tc-xxx.shansible ${ENV} -m template -e "codeName=${codeName} tcCodeNameAddressPort=${tcCodeNameAddressPort}" -a "src=/etc/ansible/newProject/tc-${codeName}.sh dest=/app/tc-${codeName}/tomcat/" 
7、ansible学习资源?
 
1、小白学Ansible之基本介绍:https://zhuanlan.zhihu.com/p/91231901?utm_source=wechat_session&utm_medium=social&utm_oi=7249907940201676802、AnsibleBook01:https://www.kancloud.cn/hiyang/ansiblebook/3052233、AnsibleBook02:https://www.kancloud.cn/louis1986/ansible/544331



推荐阅读