hi, I am using tomcat standalone example from git-examples to start tomcat server but customised it a little meaning I already have tomcat installed
and it starts fine by sudo service tomcat7 start. So this is my main.xml now. Commented out everything except starting tomcat part.
---
# - name: Install Java 1.7
# yum: name=java-1.7.0-openjdk state=present
# - name: add group "tomcat"
# group: name=tomcat
# - name: add user "tomcat"
# user: name=tom group=tomcat home=/usr/share/tomcat createhome=no
# become: True
# become_method: sudo
# - name: Download Tomcat
# - name: Extract archive
# command: chdir=/usr/share /bin/tar xvf /opt/apache-tomcat-7.0.61.tar.gz -C /opt/ creates=/opt/apache-tomcat-7.0.61
# - name: Symlink install directory
# file: src=/opt/apache-tomcat-7.0.61 path=/usr/share/tomcat state=link
# - name: Change ownership of Tomcat installation
# file: path=/usr/share/tomcat/ owner=tomcat group=tomcat state=directory recurse=yes
# - name: Configure Tomcat server
# template: src=server.xml dest=/usr/share/tomcat/conf/
# notify: restart tomcat
# - name: Configure Tomcat users
# template: src=tomcat-users.xml dest=/usr/share/tomcat/conf/
# notify: restart tomcat
# - name: Install Tomcat init script
# copy: src=tomcat-initscript.sh dest=/etc mode=0755
- name: Start Tomcat
service: name=tomcat state=started enabled=yes
# - name: deploy iptables rules
# template: src=iptables-save dest=/etc/sysconfig/iptables
# when: "ansible_os_family == 'RedHat' and ansible_distribution_major_version == '6'"
# notify: restart iptables
# - name: insert firewalld rule for tomcat http port
# firewalld: port={{ http_port }}/tcp permanent=true state=enabled immediate=yes
# when: "ansible_os_family == 'RedHat' and ansible_distribution_major_version == '7'"
# - name: insert firewalld rule for tomcat https port
# firewalld: port={{ https_port }}/tcp permanent=true state=enabled immediate=yes
# when: "ansible_os_family == 'RedHat' and ansible_distribution_major_version == '7'"
- name: wait for tomcat to start
wait_for: port={{http_port}}
task path: /workspace/ansible-examples/tomcat-standalone/roles/tomcat/tasks/main.yml:36
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: ec2-user
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1470542126.39-140197075045300 `" && echo ansible-tmp-1470542126.39-140197075045300="` echo $HOME/.ansible/tmp/ansible-tmp-1470542126.39-140197075045300 `" ) && sleep 0'
<127.0.0.1> PUT /tmp/tmpwCcjWZ TO /home/ec2-user/.ansible/tmp/ansible-tmp-1470542126.39-140197075045300/service
<127.0.0.1> EXEC /bin/sh -c 'sudo -H -S -n -u root /bin/sh -c '"'"'echo BECOME-SUCCESS-baoesvegdnsupkihscfpmupokzkmkgsm; LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/ec2-user/.ansible/tmp/ansible-tmp-1470542126.39-140197075045300/service; rm -rf "/home/ec2-user/.ansible/tmp/ansible-tmp-1470542126.39-140197075045300/" > /dev/null 2>&1'"'"' && sleep 0'
changed: [127.0.0.1] => {"changed": true, "enabled": true, "invocation": {"module_args": {"arguments": "", "enabled": true, "name": "tomcat", "pattern": null, "runlevel": "default", "sleep": null, "state": "restarted"}, "module_name": "service"}, "name": "tomcat", "state": "started"}
____________
< PLAY RECAP >
------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
127.0.0.1 : ok=2 changed=1 unreachable=0 failed=0
Could anyone explain please what am I doing wrong? Do I need this script to be installed tomcat-initscript.sh ?
Thanks,
Anushri