Skip to content
This repository has been archived by the owner on Dec 12, 2019. It is now read-only.

Commit

Permalink
Now using become rather than sudo.
Browse files Browse the repository at this point in the history
  • Loading branch information
dixhuit committed Feb 22, 2016
1 parent 47be5e1 commit 97df8a9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
24 changes: 12 additions & 12 deletions tasks/debian_tomcat.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- name: install java and tomcat packages
apt: pkg={{ item }} state=installed
sudo: true
become: true
with_items:
- openjdk-7-jre
- tomcat6
Expand All @@ -10,34 +10,34 @@

- name: change port of tomcat server
copy: src=server.xml dest=/etc/tomcat6/server.xml
sudo: true
become: true

- name: ensure correct run level of tomcat
service: name=tomcat6 enabled=yes
sudo: true
become: true
notify:
- restart tomcat6

- name: force (re)start of tomcat6
service: name=tomcat6 state=restarted
sudo: true
become: true

- name: copy the tomcat6 users file
copy: src=tomcat-users.xml dest=/etc/tomcat6/tomcat-users.xml owner=tomcat6 group=tomcat6 mode=0644
sudo: true
become: true
notify:
- restart tomcat6

- name: get iptables rules
shell: iptables -L
register: iptablesrules
always_run: yes
sudo: true
become: true
changed_when: false

- name: add tomcat iptable rule
command: /sbin/iptables -I INPUT 1 -p tcp --dport 8081 -j ACCEPT -m comment --comment "tomcat"
sudo: true
become: true
when: iptablesrules.stdout.find("tomcat") == -1
notify:
- save iptables
Expand All @@ -47,15 +47,15 @@

- name: extract apache commons logging
command: tar -zxf commons-logging-1.2-bin.tar.gz chdir=/home/{{ user }} creates=/home/{{ user }}/commons-logging-1.2
sudo: true
become: true

- name: list commons-logging files (in order to copy)
command: ls -1 /home/{{ user }}/commons-logging-1.2/
register: commonsfiles

- name: copy apache commons logging
command: cp -r /home/{{ user }}/commons-logging-1.2/{{ item }} /usr/share/tomcat6/lib creates=/usr/share/tomcat6/lib/{{ item }}
sudo: true
become: true
with_items: commonsfiles.stdout_lines

- name: download SLF4J
Expand All @@ -70,14 +70,14 @@

- name: copy SLF4J
command: cp -r /home/{{ user }}/slf4j-1.7.7/{{ item }} /usr/share/tomcat6/lib creates=/usr/share/tomcat6/lib/{{ item }}
sudo: true
become: true
with_items: slf4jfiles.stdout_lines
when: "'android' not in item and 'slf4j-log4j12' not in item and 'log4j-over-slf4j' not in item and 'slf4j-jcl' not in item"

- name: force restart of tomcat6
service: name=tomcat6 state=restarted
sudo: true
become: true

- name: copy the log4j properties file
copy: src=log4j.properties dest=/usr/share/tomcat6/lib/log4j.properties
sudo: true
become: true
24 changes: 12 additions & 12 deletions tasks/redhat_tomcat.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- name: install java and tomcat packages
yum: pkg={{ item }} state=installed
sudo: true
become: true
with_items:
- icedtea-web
- tomcat6
Expand All @@ -10,34 +10,34 @@

- name: change port of tomcat server
copy: src=server.xml dest=/etc/tomcat6/server.xml
sudo: true
become: true

- name: ensure correct run level of tomcat
service: name=tomcat6 enabled=yes
sudo: true
become: true
notify:
- restart tomcat6

- name: force (re)start of tomcat6
service: name=tomcat6 state=restarted
sudo: true
become: true

- name: copy the tomcat6 users file
copy: src=tomcat-users.xml dest=/etc/tomcat6/tomcat-users.xml owner=tomcat group=tomcat mode=0644
sudo: true
become: true
notify:
- restart tomcat6

- name: get iptables rules
shell: iptables -L
register: iptablesrules
always_run: yes
sudo: true
become: true
changed_when: false

- name: add tomcat iptable rule
command: /sbin/iptables -I INPUT 1 -p tcp --dport 8081 -j ACCEPT -m comment --comment "tomcat"
sudo: true
become: true
when: iptablesrules.stdout.find("tomcat") == -1
notify:
- save iptables
Expand All @@ -47,15 +47,15 @@

- name: extract apache commons logging
command: tar -zxf commons-logging-1.2-bin.tar.gz chdir=/home/{{ user }} creates=/home/{{ user }}/commons-logging-1.2
sudo: true
become: true

- name: list commons-logging files (in order to copy)
command: ls -1 /home/{{ user }}/commons-logging-1.2/
register: commonsfiles

- name: copy apache commons logging
command: cp -r /home/{{ user }}/commons-logging-1.2/{{ item }} /usr/share/tomcat6/lib creates=/usr/share/tomcat6/lib/{{ item }}
sudo: true
become: true
with_items: commonsfiles.stdout_lines

- name: download SLF4J
Expand All @@ -70,14 +70,14 @@

- name: copy SLF4J
command: cp -r /home/{{ user }}/slf4j-1.7.7/{{ item }} /usr/share/tomcat6/lib creates=/usr/share/tomcat6/lib/{{ item }}
sudo: true
become: true
with_items: slf4jfiles.stdout_lines
when: "'android' not in item and 'slf4j-log4j12' not in item and 'log4j-over-slf4j' not in item and 'slf4j-jcl' not in item"

- name: force restart of tomcat6
service: name=tomcat6 state=restarted
sudo: true
become: true

- name: copy the log4j properties file
copy: src=log4j.properties dest=/usr/share/tomcat6/lib/log4j.properties
sudo: true
become: true

0 comments on commit 97df8a9

Please sign in to comment.