From 5716daafc8a8f7dc757400434c68756c21f144b3 Mon Sep 17 00:00:00 2001 From: Ben Shum Date: Fri, 14 Apr 2017 12:36:52 -0400 Subject: [PATCH] Add name definitions for all steps This aids the user in understanding what is being run at each step of the setup process. Also, if a user were to use --steps to go through each step one at a time, this would allow them to know what step was about to happen next. Signed-off-by: Ben Shum --- evergreen/apache.yml | 48 ++++++++++++++++++++++++++++++++---------------- evergreen/eg-build.yml | 6 ++++-- evergreen/eg-install.yml | 27 ++++++++++++++++++--------- evergreen/eg-web.yml | 3 ++- extras/nginx.yml | 12 ++++++++---- extras/rsyslog.yml | 6 ++++-- opensrf/ejabberd.yml | 27 ++++++++++++++++++--------- opensrf/opensrf.yml | 6 ++++-- opensrf/setup.yml | 12 ++++++++---- opensrf/websockets.yml | 6 ++++-- 10 files changed, 102 insertions(+), 51 deletions(-) diff --git a/evergreen/apache.yml b/evergreen/apache.yml index 0da1f8191..d8b0adcf3 100644 --- a/evergreen/apache.yml +++ b/evergreen/apache.yml @@ -1,34 +1,50 @@ # Apache -- service: name=apache2 state=stopped -- copy: +- name: Stop apache2 + service: name=apache2 state=stopped +- name: Setup eg.conf + copy: src: "{{repo_base}}/Evergreen/Open-ILS/examples/apache_24/eg_24.conf" dest: /etc/apache2/sites-available/eg.conf -- copy: +- name: Setup eg_vhost.conf + copy: src: "{{repo_base}}/Evergreen/Open-ILS/examples/apache_24/eg_vhost_24.conf" dest: /etc/apache2/eg_vhost.conf -- copy: +- name: Setup eg_startup + copy: src: "{{repo_base}}/Evergreen/Open-ILS/examples/apache/eg_startup" dest: /etc/apache2/ -- file: path=/etc/apache2/ssl state=directory +- name: Create SSL Certs directory + file: path=/etc/apache2/ssl state=directory - name: Setup SSL Certs shell: > cd /etc/apache2/ssl && openssl req -new -x509 -days 365 -nodes -out server.crt -keyout server.key -subj "/C=XX/ST=XX/L=XX/O=XX/OU=XX/CN={{domain_name}}" -- shell: /usr/sbin/a2dismod mpm_event -- shell: /usr/sbin/a2enmod mpm_prefork -- shell: /usr/sbin/a2enmod deflate -- shell: /usr/sbin/a2enmod headers -- shell: /usr/sbin/a2enmod expires -- shell: /usr/sbin/a2enmod rewrite -- shell: /usr/sbin/a2dissite 000-default -- shell: /usr/sbin/a2ensite eg.conf -- file: path=/var/lock/apache2 owner=opensrf group=opensrf -- replace: +- name: Disable mpm_event + shell: /usr/sbin/a2dismod mpm_event +- name: Enable mpm_prefork + shell: /usr/sbin/a2enmod mpm_prefork +- name: Enable apache mod deflate + shell: /usr/sbin/a2enmod deflate +- name: Enable apache mod headers + shell: /usr/sbin/a2enmod headers +- name: Enable apache mod expires + shell: /usr/sbin/a2enmod expires +- name: Enable apache mod rewrite + shell: /usr/sbin/a2enmod rewrite +- name: Disable default site for apache + shell: /usr/sbin/a2dissite 000-default +- name: Enable eg.conf site for apache + shell: /usr/sbin/a2ensite eg.conf +- name: Change ownership of /var/lock/apache2 to opensrf + file: path=/var/lock/apache2 owner=opensrf group=opensrf +- name: Change run-user for apache to opensrf + replace: dest: /etc/apache2/envvars regexp: 'www-data' replace: 'opensrf' -- replace: +- name: Set KeepAliveTimeout value + replace: dest: /etc/apache2/apache2.conf regexp: 'KeepAliveTimeout .*' replace: 'KeepAliveTimeout 1' diff --git a/evergreen/eg-build.yml b/evergreen/eg-build.yml index 9a114bdad..465ec931f 100644 --- a/evergreen/eg-build.yml +++ b/evergreen/eg-build.yml @@ -10,7 +10,8 @@ cd {{repo_base}}/Evergreen && PERL_MM_USE_DEFAULT=1 make -f Open-ILS/src/extras/Makefile.install {{os_build_target}} -- file: dest="{{repo_base}}" owner=opensrf group=opensrf recurse=yes +- name: Set ownership of {{repo_base}} to opensrf + file: dest="{{repo_base}}" owner=opensrf group=opensrf recurse=yes - name: Build Evergreen become: true become_user: opensrf @@ -21,4 +22,5 @@ && autoreconf -i && ./configure --prefix={{eg_install_path}} --sysconfdir={{eg_install_path}}/conf && make -- file: dest="{{eg_install_path}}" owner=opensrf group=opensrf recurse=yes +- name: Set ownership of {{eg_install_path}} to opensrf + file: dest="{{eg_install_path}}" owner=opensrf group=opensrf recurse=yes diff --git a/evergreen/eg-install.yml b/evergreen/eg-install.yml index 017643f7a..618cc03bc 100644 --- a/evergreen/eg-install.yml +++ b/evergreen/eg-install.yml @@ -15,24 +15,33 @@ state: link src: "{{eg_install_path}}/var/web/xul/current/server" dest: "{{eg_install_path}}/var/web/xul/server" -- copy: +- name: Setup opensrf.xml config file + copy: src: "{{eg_install_path}}/conf/opensrf.xml.example" dest: "{{eg_install_path}}/conf/opensrf.xml" force: no -- copy: +- name: Setup opensrf_core.xml config file + copy: src: "{{eg_install_path}}/conf/opensrf_core.xml.example" dest: "{{eg_install_path}}/conf/opensrf_core.xml" force: no -- get_url: url={{dojo_url}} dest=/tmp/dojo-release-{{dojo_version}}.tar.gz -- unarchive: +- name: Get URL for dojo + get_url: url={{dojo_url}} dest=/tmp/dojo-release-{{dojo_version}}.tar.gz +- name: Unarchive dojo tarball + unarchive: src: /tmp/dojo-release-{{dojo_version}}.tar.gz dest: /tmp/ -- copy: src=/tmp/dojo-release-{{dojo_version}}/ dest={{eg_install_path}}/var/web/js/dojo/ -- file: dest={{eg_install_path}} owner=opensrf group=opensrf recurse=yes -- copy: src={{eg_install_path}}/conf/srfsh.xml.example dest=/home/opensrf/.srfsh.xml force=no -- file: dest=/home/opensrf/.srfsh.xml owner=opensrf group=opensrf +- name: Copy dojo source files into place + copy: src=/tmp/dojo-release-{{dojo_version}}/ dest={{eg_install_path}}/var/web/js/dojo/ +- name: Set ownership of {{eg_install_path}} to opensrf + file: dest={{eg_install_path}} owner=opensrf group=opensrf recurse=yes +- name: Setup .srfsh.xml for opensrf user + copy: src={{eg_install_path}}/conf/srfsh.xml.example dest=/home/opensrf/.srfsh.xml force=no +- name: Set ownership of .srfsh.xml to opensrf + file: dest=/home/opensrf/.srfsh.xml owner=opensrf group=opensrf - name: Copy ldconfig copy: src: "{{playbook_dir}}/evergreen/evergreen.ld.conf" dest: /etc/ld.so.conf.d/evergreen.ld.conf -- shell: ldconfig +- name: Run ldconfig + shell: ldconfig diff --git a/evergreen/eg-web.yml b/evergreen/eg-web.yml index d44731383..2a75acc20 100644 --- a/evergreen/eg-web.yml +++ b/evergreen/eg-web.yml @@ -3,7 +3,8 @@ cd {{repo_base}}/Evergreen && PERL_MM_USE_DEFAULT=1 make -f Open-ILS/src/extras/Makefile.install {{os_build_target}}-developer -- file: dest="{{repo_base}}" owner=opensrf group=opensrf recurse=yes +- name: Set ownership of {{repo_base}} to opensrf + file: dest="{{repo_base}}" owner=opensrf group=opensrf recurse=yes - name: Install Grunt npm: name=grunt-cli global=true - name: Node Build diff --git a/extras/nginx.yml b/extras/nginx.yml index 01c01bf23..47d9f558e 100644 --- a/extras/nginx.yml +++ b/extras/nginx.yml @@ -1,18 +1,22 @@ # Apache must be reconfigured before NGINX is installed # or the NGINX install will fail on conflicting ports -- replace: +- name: Change Apache ports.conf to listen 7080 + replace: dest: /etc/apache2/ports.conf regexp: 'Listen 80' replace: 'Listen 7080' -- replace: +- name: Change Apache ports.conf to listen 7443 + replace: dest: /etc/apache2/ports.conf regexp: 'Listen 443' replace: 'Listen 7443' -- replace: +- name: Change Evergreen eg.conf to listen 7080 + replace: dest: /etc/apache2/sites-available/eg.conf regexp: ':80' replace: ':7080' -- replace: +- name: Change Evergreen eg.conf to listen 7443 + replace: dest: /etc/apache2/sites-available/eg.conf regexp: ':443' replace: ':7443' diff --git a/extras/rsyslog.yml b/extras/rsyslog.yml index 1cef2be9b..5df065689 100644 --- a/extras/rsyslog.yml +++ b/extras/rsyslog.yml @@ -11,11 +11,13 @@ dest: "{{eg_install_path}}/conf/opensrf_core.xml" regexp: '\/(.*)\n.*' -- replace: +- name: Update opensrf_core.xml for rsyslog + replace: dest: "{{eg_install_path}}/conf/opensrf_core.xml" regexp: '-->.*\n(.*)' replace: '' -- replace: +- name: Update opensrf_core.xml for rsyslog + replace: dest: "{{eg_install_path}}/conf/opensrf_core.xml" regexp: '-->.*\n(.*)' replace: '' diff --git a/opensrf/ejabberd.yml b/opensrf/ejabberd.yml index 9bf1e11b4..95740448b 100644 --- a/opensrf/ejabberd.yml +++ b/opensrf/ejabberd.yml @@ -5,12 +5,21 @@ mode: 0600 - name: Restarting Ejabberd service: name=ejabberd state=restarted -- pause: seconds=5 -- shell: ejabberdctl unregister router private.localhost -- shell: ejabberdctl unregister opensrf private.localhost -- shell: ejabberdctl unregister router public.localhost -- shell: ejabberdctl unregister opensrf public.localhost -- shell: ejabberdctl register router private.localhost {{ejabberd_password}} -- shell: ejabberdctl register opensrf private.localhost {{ejabberd_password}} -- shell: ejabberdctl register router public.localhost {{ejabberd_password}} -- shell: ejabberdctl register opensrf public.localhost {{ejabberd_password}} +- name: Wait a moment for Ejabberd + pause: seconds=5 +- name: Unregister Ejabberd user router@private.localhost + shell: ejabberdctl unregister router private.localhost +- name: Unregister Ejabberd user opensrf@private.localhost + shell: ejabberdctl unregister opensrf private.localhost +- name: Unregister Ejabberd user router@public.localhost + shell: ejabberdctl unregister router public.localhost +- name: Unregister Ejabberd user opensrf@public.localhost + shell: ejabberdctl unregister opensrf public.localhost +- name: Register Ejabberd user router@private.localhost + shell: ejabberdctl register router private.localhost {{ejabberd_password}} +- name: Register Ejabberd user opensrf@private.localhost + shell: ejabberdctl register opensrf private.localhost {{ejabberd_password}} +- name: Register Ejabberd user router@public.localhost + shell: ejabberdctl register router public.localhost {{ejabberd_password}} +- name: Register Ejabberd user opensrf@public.localhost + shell: ejabberdctl register opensrf public.localhost {{ejabberd_password}} diff --git a/opensrf/opensrf.yml b/opensrf/opensrf.yml index 506eeb297..76da12ae7 100644 --- a/opensrf/opensrf.yml +++ b/opensrf/opensrf.yml @@ -10,7 +10,8 @@ cd {{repo_base}}/OpenSRF && PERL_MM_USE_DEFAULT=1 make -f src/extras/Makefile.install {{os_build_target}} -- file: dest="{{repo_base}}" owner=opensrf group=opensrf recurse=yes +- name: Set ownership of {{repo_base}} to opensrf + file: dest="{{repo_base}}" owner=opensrf group=opensrf recurse=yes - name: Build OpenSRF become: true become_user: opensrf @@ -25,4 +26,5 @@ environment: PATH: "{{ansible_env.PATH}}:{{eg_install_path}}/bin" shell: cd {{repo_base}}/OpenSRF && make install -- file: dest="{{eg_install_path}}" owner=opensrf group=opensrf recurse=yes +- name: Set ownership of {{eg_install_path}} to opensrf + file: dest="{{eg_install_path}}" owner=opensrf group=opensrf recurse=yes diff --git a/opensrf/setup.yml b/opensrf/setup.yml index 94288b90e..67ba956e7 100644 --- a/opensrf/setup.yml +++ b/opensrf/setup.yml @@ -9,7 +9,8 @@ shell: /bin/bash # Environment changes added to ~/.bash_profile to ensure they are # loaded regardless of whether opensrf is used interactively. -- lineinfile: +- name: Check export PATH for opensrf user profile + lineinfile: dest: /home/opensrf/.bash_profile create: yes owner: opensrf @@ -17,15 +18,18 @@ mode: 0644 regexp: '^export PATH=' line: 'export PATH="{{eg_install_path}}/bin:$PATH"' -- lineinfile: +- name: Check LD_LIBRARY_PATH for opensrf user profile + lineinfile: dest: /home/opensrf/.bash_profile regexp: '^export LD_LIBRARY_PATH=' line: 'export LD_LIBRARY_PATH="{{eg_install_path}}/lib:/usr/local/lib:/usr/local/lib/dbd:$LD_LIBRARY_PATH"' -- lineinfile: +- name: Check /etc/hosts file for public.{{domain_name}} + lineinfile: dest: /etc/hosts regexp: '^127.0.1.2' line: '127.0.1.2 public.{{domain_name}}' -- lineinfile: +- name: Check /etc/hosts file for private.{{domain_name}} + lineinfile: dest: /etc/hosts regexp: '^127.0.1.3' line: '127.0.1.3 private.{{domain_name}}' diff --git a/opensrf/websockets.yml b/opensrf/websockets.yml index 94e6127dc..ac55a4c46 100644 --- a/opensrf/websockets.yml +++ b/opensrf/websockets.yml @@ -4,14 +4,16 @@ dest: "/tmp/apache-websocket" - name: Install Websockets shell: cd /tmp/apache-websocket && apxs2 -i -a -c mod_websocket.c -- stat: path=/etc/apache2-websockets +- name: register variable websocketsconf + stat: path=/etc/apache2-websockets register: websocketsconf - block: - name: Create Websockets Instance shell: > sh /usr/share/doc/apache2/examples/setup-instance websockets && a2dismod websocket - - lineinfile: + - name: Confirm websockets run user is opensrf + lineinfile: state: present dest: /etc/apache2-websockets/envvars regexp: 'APACHE_RUN_USER' -- 2.11.0