/[pdpsoft]/trunk/novalocal-test-delegserver/DS/roles/delegserver/tasks/dep-tomcat.yml
ViewVC logotype

Contents of /trunk/novalocal-test-delegserver/DS/roles/delegserver/tasks/dep-tomcat.yml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3079 - (show annotations) (download) (as text)
Tue Aug 9 11:29:55 2016 UTC (5 years, 9 months ago) by msalle
File MIME type: text/x-yaml
File size: 4278 byte(s)
Adding ansible scripts for the jenkins/novalocal test Delegation Server

1 ---
2
3 # Install tomcat
4
5 - name: install tomcat
6 yum:
7 name: "{{ item }}"
8 state: present
9 with_items: "{{ tomcat_packages }}"
10 register: tomcat_install
11
12 - name: add CATALINA_HOME to bashrc
13 lineinfile:
14 dest: /etc/bashrc
15 state: present
16 line: "export CATALINA_HOME={{ catalina_home }}"
17 regexp: "^export CATALINA_HOME=.*"
18 insertafter: EOF
19
20 #- name: clean up webapps directory
21 # command: /bin/rm -rf "{{ catalina_home }}/webapps/*"
22 # when: tomcat_install.changed
23
24 # Install jglobus-jsse and globus-ssl-proxies (this is only needed for limited proxies!)
25
26 #- name: install jglobus
27 # yum: name={{ item }} state=present
28 # with_items: "{{ tomcat_extra_packages }}"
29
30 #- name: find extra jar libraries for linking
31 # command: find "{{ tomcat_extra_libs }}" -maxdepth 1 -type f -name '*.jar' -exec basename {} \;
32 # register: extra_libs
33
34 #- name: make a link to the jglobus jars
35 # file:
36 # src: "{{ tomcat_extra_libs }}/{{ item }}"
37 # dest: "{{ catalina_home }}/lib/{{ item }}"
38 # owner: root
39 # group: root
40 # state: link
41 # with_items: "{{ extra_libs.stdout_lines }}"
42
43 # configurations
44
45 # close unused ports?
46
47 # set tomcatAuthentication="false" so REMOTE_USER will be taken over from apache
48 # and only listen on localhost
49
50 - name: check if tomcat authnetication is disabled (ignore errors)
51 command: grep 'Connector.*port="8009".*address="127.0.0.1" tomcatAuthentication="false"' "{{ catalina_home }}/conf/server.xml"
52 ignore_errors: True
53 changed_when: False
54 register: tomcat_auth
55
56 - name: disable tomcat authnetication
57 lineinfile:
58 dest: "{{ catalina_home }}/conf/server.xml"
59 regexp: '^(.*)<Connector port="8009"(.*)$'
60 line: '\1<Connector port="8009" address="127.0.0.1" tomcatAuthentication="false"\2'
61 backrefs: yes
62 owner: "{{ tomcat_user }}"
63 group: "{{ tomcat_user }}"
64 mode: 0664
65 when: tomcat_auth.rc != 0
66 notify: restart tomcat
67
68 # only listen on localhost on 8080
69
70 - name: check if listening address
71 command: grep 'Connector.*port="8080".*address="127.0.0.1"' "{{ catalina_home }}/conf/server.xml"
72 ignore_errors: True
73 changed_when: False
74 register: tomcat_local_listen
75
76 - name: disable tomcat authnetication
77 lineinfile:
78 dest: "{{ catalina_home }}/conf/server.xml"
79 regexp: '^(.*)<Connector port="8080"(.*)$'
80 line: '\1<Connector port="8080" address="127.0.0.1" \2'
81 backrefs: yes
82 owner: "{{ tomcat_user }}"
83 group: "{{ tomcat_user }}"
84 mode: 0664
85 when: tomcat_local_listen.rc != 0
86 notify: restart tomcat
87
88 # add oa4mp configuration parameters
89
90 - name: add oa4mp config parameters to web.xml
91 blockinfile:
92 dest: "{{ catalina_home }}/conf/web.xml"
93 marker: "<!-- {mark} ANSIBLE MANAGED BLOCK -->"
94 insertbefore: "</web-app>"
95 owner: "{{ tomcat_user }}"
96 group: "{{ tomcat_user }}"
97 mode: 0664
98 block: |
99 <context-param>
100 <param-name>oa4mp:oauth2.server.config.file</param-name>
101 <param-value>{{ oa4mp_server_conf_file }}</param-value>
102 </context-param>
103 <context-param>
104 <param-name>oa4mp:oauth2.server.config.name</param-name>
105 <param-value>default</param-value>
106 </context-param>
107 notify: restart tomcat
108
109 # add javax.mail jar
110
111 - name: download javax.mail jar
112 get_url:
113 url: "{{ javax_mail_url }}"
114 dest: "{{ catalina_home }}/lib/javax.mail.jar"
115 - name: set permission on javax.mail
116 file:
117 path: "{{ catalina_home }}/lib/javax.mail.jar"
118 owner: root
119 group: root
120 mode: 0644
121
122 # add mail resource to context.xml
123
124 - name: add mail resource to context.xml
125 lineinfile:
126 dest: "{{ catalina_home }}/conf/context.xml"
127 state: present
128 line: "<Resource name=\"mail/Session\" type=\"javax.mail.Session\" auth=\"Container\"></Resource>"
129 insertbefore: "</Context>"
130 mode: 0664
131 owner: "{{ tomcat_user }}"
132 group: "{{ tomcat_user }}"
133 notify: restart tomcat
134
135 # configure the private X509_CERT_DIR as an environmental variable
136
137 - name: set private X509_CERT_DIR variable
138 lineinfile:
139 dest: "{{ catalina_home }}/conf/tomcat.conf"
140 state: present
141 line: "X509_CERT_DIR=\"{{ oa4mp_server_certificates_dir }}\""
142 mode: 0664
143 owner: "{{ tomcat_user }}"
144 group: "{{ tomcat_user }}"
145 notify: restart tomcat
146

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28