在尝试运行Tomcat-8的startup.sh脚本时,出现以下错误。使用STDOUT- "Tomcat started“可以成功执行Playbook,但它没有反映在远程机器上。命令和shell这两个模块都有这个错误
- name: Download Tomcat version 8
get_url:
url: http://mirrors.wuchna.com/apachemirror/tomcat/tomcat-8/v8.5.35/bin/apache-tomcat-8.5.35.tar.gz
dest: /tmp/apache-tomcat-8.5.35.tar.gz
- name: Untar Tomcat to /opt
shell: tar -zxvf apache-tomcat-8.5.35.tar.gz -C /opt
args:
chdir: /tmp/
warn: False
- name: Change permissions of Tomcat folder
file:
path: /opt/apache-tomcat-8.5.35
mode: 0777
recurse: yes
- name: Set Catalina Home
lineinfile:
path: /etc/profile.d/maven.sh
regexp: '^#?\s*export CATALINA_HOME=(.*)$'
line: 'export CATALINA_HOME=/opt/apache-tomcat-8.5.35'
state: present
- name: execute source
shell: source maven.sh
args:
chdir: /etc/profile.d/
executable: /bin/sh
- name: start catalina
become: true
command: /opt/apache-tomcat-8.5.35/bin/startup.sh &>> /var/log/log.txt发布于 2018-11-20 14:00:22
我试着在Centos7上的剧本中运行你的任务,并在Tomcat正常运行的情况下成功执行。(我必须先安装maven )我可能需要更多的信息来调试这个。
看一下这个例子:https://github.com/ansible/ansible-examples/tree/master/tomcat-standalone
https://stackoverflow.com/questions/53386334
复制相似问题