silpion / ansible-tomcat Goto Github PK
View Code? Open in Web Editor NEWManage installation of Tomcat
License: Apache License 2.0
Manage installation of Tomcat
License: Apache License 2.0
Hi there,
I'm trying to setup the module, but I think I'm or doing wrong or I forget someting.
Ik get the following error message:
TASK: [groover.tomcat | Install sysvinit Tomcat Service] **********************
fatal: [wdserver00] => {'msg': "AnsibleUndefinedVariable: One or more undefined variables: 'java_home' is undefined", 'failed': True}
fatal: [wdserver00] => {'msg': "AnsibleUndefinedVariable: One or more undefined variables: 'java_home' is undefined", 'failed': True}
I did setup the facts file:
[root@server ~]# cat /etc/ansible/facts.d/java.fact
[default]
java_home=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.71.x86_64
[general]
java_home=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.71.x86_64
When I run the setup:
ansible server -i etc/host_list -m setup -a "filter=ansible_local"
server | success >> {
"ansible_facts": {
"ansible_local": {
"java": {
"default": {
"java_home": "/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.71.x86_64"
},
"general": {
"java_home": "/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.71.x86_64"
}
}
}
},
"changed": false
}
The directories does exists though...
What am I doing wrong or missing?
Kind regards,
Werner
Inside Sysvinit system when using an instance user Tomcat process still run under root user.
using
tomcat_instances:
- name: foo
user: vagrant
group: vagrant
path: /home/vagrant
home: /home/vagrant
service_name: tomcat-foo
service_file: tomcat-foo
port_ajp: 18009
port_connector: 18080
port_redirect: 18443
port_shutdown: 18005
result
root 5196 0.2 5.7 2259404 58380 ? Sl 21:46 0:03 /usr/java/default/bin/java -Djava.util.logging.config.file=/home/vagrant/catalina/foo/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/opt/tomcat/apache-tomcat-7.0.62/endorsed -classpath /opt/tomcat/apache-tomcat-7.0.62/bin/bootstrap.jar:/opt/tomcat/apache-tomcat-7.0.62/bin/tomcat-juli.jar -Dcatalina.base=/home/vagrant/catalina/foo -Dcatalina.home=/opt/tomcat/apache-tomcat-7.0.62 -Djava.io.tmpdir=/home/vagrant/catalina/foo/temp org.apache.catalina.startup.Bootstrap start
Inside service_sysvinit.j2
there is reference to instance user here https://github.com/silpion/ansible-tomcat/blob/master/templates/service_sysvinit.j2#L11 but it never uses.
I'm not Tomcat expert and you may have your reason to keep process on root user but if it just missing we can do something like
start(){
echo -n $"Starting $PROC: "
{% if tomcat_service_umask is defined %}
umask {{ tomcat_service_umask }}
{% endif %}
touch $CATALINA_PID 2>&1
if [ "$?" -eq "0" ]; then
chown ${TOMCAT_USER}:{{ tomcat_user_group }} $CATALINA_PID
fi
daemon --user=$TOMCAT_USER $CATALINA_HOME/bin/catalina.sh start
ret=$?
echo
[ $ret -eq 0 ] && touch $LOCK
}
(can be improved by adding default value for tomcat_user_group
)
Hey guys,
I'm sort of shocked to realize that CATALINA_OPTS is completely broken in systemd with this module. It's calling java direct so there's nothing to actually -add- CATALINA_OPTS in.
If I add $CATALINA_OPTS before the classpath in start/stop in systemd it seems to work. I don't want to submit this as a PR as I'm not confident this is the right approach. Without this all the catalina_opts stuff is completely ignored, however.
Hi,
could you please commit/merge pull request #31
Thanks so much
I wanted to know if it's possible to add the following folder for catalina instances:
lib
bin
based on https://github.com/silpion/ansible-tomcat/blob/master/vars/main.yml#L19-23 tomcat_instance_dirs
is not overrideable, but I don't think it's mandatory we should just add missing keys tomcat's folders.
Tomcat 8 removed JasperListener
.
Using the following template https://github.com/silpion/ansible-tomcat/blob/master/templates/server.xml.j2#L21 Tomcat 8 boot failed.
I know we can add our custom template by using tomcat_server_xml_template
but it can be great to support Tomcat 8 natively because Tomcat 7 becomes an old man :)
This ansible role isn't compatible with tomcat 8.5.x because the permission properties changes in conf
folder.
I added a chmod +r -Rf ./conf
but still having problems starting the service. Anything I'm missing??
Hi, first of all, sorry if something is strange, english isn't my mother tongue, so please tell me if you can't understand.
Well, I read this role, and something I can't find (or understand) if it included a feature for enabling (or not) some features? For example, the role has a lot of useful features, in some cases, oneself could not need the role manages install tomcat. For example, I need to migrate the entire architecture of more than 20 tomcat server, each have more than 5 webapps in it, and I need to migrate all of them to an architecture where each webapp is running inside his own JVM, this role can do this work, but also there are tasks related to installing and restart the servers, and as I don't need to install tomcat again, I need to edit the tasks files of the role, etc for avoid it, so will be really useful If in the playboook file I could set something as "Manage installation" through a variable.
For what I read, that feature isn't in the scope of the role, am I right? If not, is possible to add it?
Thanks a lot!
Regards,
ceso.
there is a syntax error with tomcat 8.5
file : ansible-tomcat/tasks/8.5-acls.yml
Hello!
ansible-galaxy install silpion.tomcat
ERROR! - you can use --ignore-errors to skip failed roles and finish processing the list.
Does the ansible-tomcat module support authbind? Or is it up to me to pre-install and configure it before this one?
Your tomcat role create an ansible fact for tomcat to expose tomcat version https://github.com/silpion/ansible-tomcat/blob/master/templates/facts.j2
But it could be cool to allow user to customize the facts, indeed I wanted to put catalina_base on it to easily manipulate it later on post_process task
Hi,
upon using this role in a playbook like
- hosts: stage02
vars_files:
- vars.yml
roles:
- { role: groover.java}
- { role: groover.tomcat}
where vars.yml contains only the tomcat_default_catalina_opts
and stage02 is a remote server assessed as a non-root user which is a sudoer
When running this playbook via
sudo ansible-playbook deploy.yml
everything gets installed, but when I try to run tomcat manually with /opt/tomcat/apache-tomcat-7.0.62/bin/catalina.sh run
I get back the following log:
Using CATALINA_BASE: /opt/tomcat/apache-tomcat-7.0.62
Using CATALINA_HOME: /opt/tomcat/apache-tomcat-7.0.62
Using CATALINA_TMPDIR: /opt/tomcat/apache-tomcat-7.0.62/temp
Using JRE_HOME: /opt/java/oracle/jdk1.8.0_45
Using CLASSPATH: /opt/tomcat/apache-tomcat-7.0.62/bin/bootstrap.jar:/opt/tomcat/apache-tomcat-7.0.62/bin/tomcat-juli.jar
Oct 15, 2015 10:24:30 AM org.apache.catalina.startup.Catalina load
WARNING: Unable to load server configuration from [/opt/tomcat/apache-tomcat-7.0.62/conf/server.xml]
Oct 15, 2015 10:24:30 AM org.apache.catalina.startup.Catalina load
WARNING: Permissions incorrect, read permission is not allowed on the file.
Oct 15, 2015 10:24:30 AM org.apache.catalina.startup.Catalina load
WARNING: Unable to load server configuration from [/opt/tomcat/apache-tomcat-7.0.62/conf/server.xml]
Oct 15, 2015 10:24:30 AM org.apache.catalina.startup.Catalina load
WARNING: Permissions incorrect, read permission is not allowed on the file.
Oct 15, 2015 10:24:30 AM org.apache.catalina.startup.Catalina start
SEVERE: Cannot start server. Server instance is not configured
upon more inspection I noticed that
a) entire /opt/tomcat
along with subdirectories is owned by root
b) /opt/tomcat/apache-tomcat-7.0.62/conf
is both owned by root AND has 600 permissions, meaning the running tomcat
user cannot read the configuration - it's available only for root
Of course, running via sudo service tomcat start
doesn't work either
Cant find a solution for this error.
Here's my playbook:
---
- hosts: server1
vars:
tomcat_version: 8.5.9
tomcat_install_base: /srv
tomcat_service_allow_restart: false
tomcat_instances:
- name: tomcat
user: tomcat
group: tomcat
system: true
service_name: tomcat
service_file: tomcat.service
prefer_ipv4: true
prefer_urandom: true
override_uri_encoding: UTF-8
roles:
- { role: tomcat }
The README.md references ansible_local.java.default.java_home whereis it should be ansible_local.java.general.java_home
Can we get the newest release pushed to Ansible Galaxy? The latest version available there is 1.3.0
.
https://galaxy.ansible.com/groover/tomcat/
Hello! I was following the instructions in the README, which say to place
any webapp and configuration must be deployed to
CATALINA_HOME
which defaults to/srv/tomcat/catalina/tomcat
.
I thought this meant {{ tomcat_env_catalina_home }}
, but that turned out to be the central Tomcat, not the instance. I ended up using "{{ ansible_local.tomcat.instances[tomcat_instance_name].catalina_base }}"
. Not sure if that's the simplest way to get the path, but it worked for me. Just wanted to leave it here in case anyone else was confused by this, and wonder if the documentation could help prevent people from making the same mistake. Thanks!
Hi,
Thank you for the nice tomcat role, really well done sir ! but there's a small error in your "Readme" file when you say : "Tomcat uses two main paths: CATALINA_BASE which contains all common files and CATALINA_HOME which contains instance-specific files.
Consequently, any webapp and configuration must be deployed to CATALINA_HOME which defaults to /srv/tomcat/catalina/tomcat"
In fact this isn't correct, It's the other way around.
CATALINA_HOME = common file and binary
CATALINA_BASE = Instance specific config and webapp ( e.g war file )
****************** From Official tomcat documentation *********************
Throughout the docs, you'll notice there are numerous references to $CATALINA_HOME.
This represents the root of your Tomcat installation.
When we say, "This information can be found in your $CATALINA_HOME/README.txt file" we mean to look at the README.txt file at the root of your Tomcat install.
Optionally, Tomcat may be configured for multiple instances by defining $CATALINA_BASE for each instance.
If multiple instances are not configured, $CATALINA_BASE is the same as $CATALINA_HOME
Have a look to apache tomcat official documentation https://tomcat.apache.org/tomcat-7.0-doc/introduction.html
Cheers
Since EL7 version systemd has been adopted.
So when trying it on Centos 7 I have the following error:
TASK: [groover.tomcat | Install sysvinit Tomcat Service] **********************
fatal: [localhost] => {'msg': "AnsibleUndefinedVariable: One or more undefined variables: 'ansible_local' is undefined", 'failed': True}
fatal: [localhost] => {'msg': "AnsibleUndefinedVariable: One or more undefined variables: 'ansible_local' is undefined", 'failed': True}
Do you think is possible to enhance the role to support EL7 platform?
I have just updated all roles (groover.tomcat:1.3.0, groover.util:1.1.0, silpion.lib:2.1.2, silpion.util:2.0.5) and tomcat install hangs at the "include" task. I'm new to Ansible, so having difficulty troubleshooting this. In verbose mode, Ansible emits no messages after starting the include task and on the target host, I see no processes that appear to be related to Ansible, SSH or anything else that might be involved. Any help you can provide would be greatly appreciated. The target host is a fresh install of Ubuntu 14.04 LTS.
With Ansbile 2.0.0.2, the sample playbook seems to hang while downloading Tomcat.
TASK [groover.tomcat : include] ************************************************
I have a very basic playbook:
- hosts: all
roles:
- { role: groover.tomcat }
using the following requirements.yml
:
---
- src: https://github.com/silpion/ansible-util/archive/1.1.0.tar.gz
name: silpion.util
- name: groover.tomcat
version: 1.3.0
I'm getting error when using default setup:
TASK [ansible-tomcat : Detect version upgrade] *********************************
fatal: [ansibletomcattest]: FAILED! => {"failed": true, "msg": "The conditional check 'ansible_local.tomcat.general.version is defined' failed. The error was: error while evaluating conditional (ansible_local.tomcat.general.version is defined): 'dict object' has no attribute 'general'\n\nThe error appears to have been in '/home/dracic/git/ansible-tomcat/tasks/main.yml': line 35, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Detect version upgrade\n ^ here\n"}
Can anyone help about this error message?
When using this role through the Vagrant Ansible provisioner the local_action
which writes data in to /usr/local/src/ansible
fails with the following permissions error:
TASK: [groover.tomcat | Install local ansible data path directory (local)] ****
<127.0.0.1> REMOTE_MODULE file state=directory owner=0 group=0 mode=2777 dest=/usr/local/src/ansible/data
failed: [tc1 -> 127.0.0.1] => {"failed": true, "parsed": false}
invalid output was: Traceback (most recent call last):
File "/home/egrant/.ansible/tmp/ansible-tmp-1416997610.02-204869902985063/file", line 1675, in <module>
main()
File "/home/egrant/.ansible/tmp/ansible-tmp-1416997610.02-204869902985063/file", line 216, in main
os.mkdir(curpath)
OSError: [Errno 13] Permission denied: '//usr/local/src/ansible'
FATAL: all hosts have already failed -- aborting
I think this might be a similar issue to silpion/ansible-packerio#1 but I can't quite figure out a good approach. I initially tried running the role with sudo: true
and configuring ansible.ask_sudo_pass = true
in my VagrantFile, however this didn't make any difference. I subsequently realised that the local_action
task doesn't use sudo anyway so am guessing this is why this doesn't work?.
I may be missing something obvious in my setup, would you be able to elaborate on the intended way of running this?
Many thanks,
Edd
OS Fedora 26
ansible 2.4.1.0
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.14 (default, Nov 2 2017, 18:42:05) [GCC 7.2.1 20170915 (Red Hat 7.2.1-2)]
I am trying to install with using ansible galaxy groover.tomcat on centos 7.4
from my fedora 26 machine I am trying to execute this with below playbook during the time
I get this error.
Fresh installation on Centos 6 (using vagrant https://atlas.hashicorp.com/hansode/boxes/centos-6.6-x86_64)
[vagrant@vagrant-centos6 ~]$ sudo /etc/init.d/tomcat stop
Stopping tomcat: [FAILED]
I have to kill it manually using kill -9 {pid}
.
start
action works great.
cause:
killproc
does not work correctly
[vagrant@vagrant-centos6 ~]$ . /etc/init.d/functions
[vagrant@vagrant-centos6 ~]$ killproc tomcat
[vagrant@vagrant-centos6 ~]$ [FAILED]
Running from Vagrant with "ubuntu/trusty64", I get the following error.
TASK: [groover.tomcat | Assert platform is supported] *************************
<192.168.150.47> ESTABLISH CONNECTION FOR USER: vagrant
ok: [target] => {"msg": "all assertions passed"}
TASK: [groover.tomcat | Load version vars] ************************************
<192.168.150.47> ESTABLISH CONNECTION FOR USER: vagrant
ok: [target] => (item=/etc/ansible/roles/groover.tomcat/vars/versions/7.0.57.yml) => {"ansible_facts": {"tomcat_redis_sha256sum": "1ce390049ed23143e3db0c94781c1e88a4d1b39ceb471c0af088a0c326d637cb"}, "item": "/etc/ansible/roles/groover.tomcat/vars/versions/7.0.57.yml"}
TASK: [groover.tomcat | Assert version vars] **********************************
<192.168.150.47> ESTABLISH CONNECTION FOR USER: vagrant
ok: [target] => {"msg": "all assertions passed"}
TASK: [groover.tomcat | Install local ansible data path directory (local)] ****
<127.0.0.1> REMOTE_MODULE file state=directory owner=0 group=0 mode=2777 dest=/usr/local/src/ansible/data
<127.0.0.1> EXEC ['/bin/sh', '-c', 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1433794205.76-27770763108460 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1433794205.76-27770763108460 && echo $HOME/.ansible/tmp/ansible-tmp-1433794205.76-27770763108460']
<127.0.0.1> PUT /tmp/tmp9INWKg TO /home/administrator/.ansible/tmp/ansible-tmp-1433794205.76-27770763108460/file
<127.0.0.1> EXEC /bin/sh -c 'sudo -k && sudo -H -S -p "[sudo via ansible, key=dywrfvmvlomvkbqjswhewxzpswpjtaqe] password: " -u root /bin/sh -c '"'"'echo BECOME-SUCCESS-dywrfvmvlomvkbqjswhewxzpswpjtaqe; LANG=C LC_CTYPE=C /usr/bin/python /home/administrator/.ansible/tmp/ansible-tmp-1433794205.76-27770763108460/file; rm -rf /home/administrator/.ansible/tmp/ansible-tmp-1433794205.76-27770763108460/ >/dev/null 2>&1'"'"''
failed: [target -> 127.0.0.1] => {"failed": true, "parsed": false}
[sudo via ansible, key=dywrfvmvlomvkbqjswhewxzpswpjtaqe] password:
FATAL: all hosts have already failed -- aborting
My playbook
- { role: groover.tomcat }
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.