Install solr packages on ansible

Good afternoon.
I’m installing an ckan via ansible project.
However, I need to install SOLR packages, but I can not.
I would like to ask you for help, knowing in this way which commands you could produce for the following installations.

wget https://archive.apache.org/dist/lucene/solr/5.1.0/solr-5.1.0.tgz

tar xzf solr-5.1.0.tgz solr-5.1.0/bin/install_solr_service.sh --strip-components=2

sudo bash ./install_solr_service.sh solr-5.1.0.tgz

wget http://search.maven.org/remotecontent?filepath=com/vividsolutions/jts/1.13/jts-1.13.jar -O jts-1.13.jar

sudo -u solr cp jts-1.13.jar /opt/solr/server/solr-webapp/webapp/WEB-INF/lib/.

sudo service solr restart

If this is not the best way, I would like to ask you the best way to run solr / jetty and all its dependencies.

All this is due to the fact that I am getting to the end of the installation, however, when I open the browser I can not access, giving me the 500 error.

Thanks in advance for your help.

With the best compliments