From 97df8a907ea145c56eba58daf0556ba65ab5a8bd Mon Sep 17 00:00:00 2001 From: Dan Bohea Date: Mon, 22 Feb 2016 09:50:52 +0000 Subject: [PATCH] Now using `become` rather than `sudo`. --- tasks/debian_tomcat.yml | 24 ++++++++++++------------ tasks/redhat_tomcat.yml | 24 ++++++++++++------------ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/tasks/debian_tomcat.yml b/tasks/debian_tomcat.yml index 4e4d665..84fc525 100755 --- a/tasks/debian_tomcat.yml +++ b/tasks/debian_tomcat.yml @@ -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 @@ -10,21 +10,21 @@ - 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 @@ -32,12 +32,12 @@ 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 @@ -47,7 +47,7 @@ - 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/ @@ -55,7 +55,7 @@ - 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 @@ -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 diff --git a/tasks/redhat_tomcat.yml b/tasks/redhat_tomcat.yml index 231eeb0..f1ad59d 100755 --- a/tasks/redhat_tomcat.yml +++ b/tasks/redhat_tomcat.yml @@ -1,7 +1,7 @@ --- - name: install java and tomcat packages yum: pkg={{ item }} state=installed - sudo: true + become: true with_items: - icedtea-web - tomcat6 @@ -10,21 +10,21 @@ - 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 @@ -32,12 +32,12 @@ 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 @@ -47,7 +47,7 @@ - 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/ @@ -55,7 +55,7 @@ - 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 @@ -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