d4science-gcube/redmine.yml: split the production ad devel variables for redmine. Get all the modules distrib files that do not have a public download site. Install a logrotate script to handle the redmine logs. Fix some playbook problems.

This commit is contained in:
Andrea Dell'Amico 2015-10-08 19:17:33 +02:00
parent 7feadf3945
commit 66f26bf76f
4 changed files with 44 additions and 50 deletions

View File

@ -62,6 +62,9 @@ unicorn_worker_processes: 5
unicorn_timeout: 120 unicorn_timeout: 120
unicorn_log_dir: /var/log/unicorn unicorn_log_dir: /var/log/unicorn
unicorn_pid_file: /run/unicorn/unicorn.pid unicorn_pid_file: /run/unicorn/unicorn.pid
unicorn_gems:
- unicorn
- coderay
unicorn_apache_modules: unicorn_apache_modules:
- proxy_balancer - proxy_balancer
- proxy - proxy

View File

@ -2,26 +2,22 @@
- name: Fail if the redmine data directory variable is not defined - name: Fail if the redmine data directory variable is not defined
fail: redmine_glob_root_dir is required for this role fail: redmine_glob_root_dir is required for this role
when: redmine_glob_root_dir is not defined when: redmine_glob_root_dir is not defined
tags: tags: redmine
- redmine
- name: ensure that the redmine data directories exist - name: ensure that the redmine data directories exist
file: dest={{ item }} state=directory owner=root group=root file: dest={{ item }} state=directory owner=root group=root
with_items: with_items:
- '{{ redmine_glob_root_dir }}' - '{{ redmine_glob_root_dir }}'
- '{{ redmine_glob_users_home_base }}' - '{{ redmine_glob_users_home_base }}'
tags: tags: redmine
- redmine
- name: Create the user that will run the redmine process - name: Create the user that will run the redmine process
user: name={{ redmine_user }} createhome=true home={{ redmine_user_home }} shell=/bin/bash user: name={{ redmine_user }} createhome=true home={{ redmine_user_home }} shell=/bin/bash
tags: tags: redmine
- redmine
- name: Ensure that the redmine user can write its $HOME/.subversion to store the svn site ssl certificate - name: Ensure that the redmine user can write its $HOME/.subversion to store the svn site ssl certificate
file: dest={{ redmine_user_home }}/.subversion state=directory owner={{ redmine_user }} group={{ redmine_group }} file: dest={{ redmine_user_home }}/.subversion state=directory owner={{ redmine_user }} group={{ redmine_group }}
tags: tags: redmine
- redmine
# We need to find a way to run svn and accept the certificate in non interactive mode as user www-data # We need to find a way to run svn and accept the certificate in non interactive mode as user www-data
# su - www-data svn list https://svn.driver.research-infrastructures.eu/driver # su - www-data svn list https://svn.driver.research-infrastructures.eu/driver
@ -29,8 +25,7 @@
# don't know if it's useful # don't know if it's useful
- name: Explicitly accept the svn ssl certificate - name: Explicitly accept the svn ssl certificate
shell: /bin/true shell: /bin/true
tags: tags: redmine
- redmine
# - name: Check if we have the svn.driver.research-infrastructures.eu public SSL certificate already # - name: Check if we have the svn.driver.research-infrastructures.eu public SSL certificate already
# shell: ls -l /etc/ssl/certs/svn.driver.research-infrastructures.eu.epm # shell: ls -l /etc/ssl/certs/svn.driver.research-infrastructures.eu.epm
@ -43,62 +38,56 @@
- name: Get the redmine tarball - name: Get the redmine tarball
get_url: url=http://www.redmine.org/releases/redmine-{{ redmine_version }}.tar.gz dest={{ redmine_glob_root_dir }}/redmine-{{ redmine_version }}.tar.gz get_url: url=http://www.redmine.org/releases/redmine-{{ redmine_version }}.tar.gz dest={{ redmine_glob_root_dir }}/redmine-{{ redmine_version }}.tar.gz
tags: tags: redmine
- redmine
- name: Explode the redmine archive - name: Explode the redmine archive
unarchive: src={{ redmine_glob_root_dir }}/redmine-{{ redmine_version }}.tar.gz dest={{ redmine_glob_root_dir }} copy=no owner=root group=root creates={{ redmine_glob_root_dir }}/redmine-{{ redmine_version }}/Rakefile unarchive: src={{ redmine_glob_root_dir }}/redmine-{{ redmine_version }}.tar.gz dest={{ redmine_glob_root_dir }} copy=no owner=root group=root creates={{ redmine_glob_root_dir }}/redmine-{{ redmine_version }}/Rakefile
register: redmine_install register: redmine_install
tags: tags: redmine
- redmine
- name: Create the right path for the application. - name: Create the right path for the application.
file: src={{ redmine_glob_root_dir }}/redmine-{{ redmine_version }} dest={{ redmine_glob_root_dir }}/{{ redmine_inst_dir }} state=link file: src={{ redmine_glob_root_dir }}/redmine-{{ redmine_version }} dest={{ redmine_glob_root_dir }}/{{ redmine_inst_dir }} state=link
tags: tags: redmine
- redmine
- name: Install the database configuration - name: Install the database configuration
template: src=redmine-database.yml.j2 dest={{ redmine_glob_root_dir }}/{{ redmine_inst_dir }}/config/database.yml owner=root group={{ redmine_group }} mode=0440 template: src=redmine-database.yml.j2 dest={{ redmine_glob_root_dir }}/{{ redmine_inst_dir }}/config/database.yml owner=root group={{ redmine_group }} mode=0440
tags: notify:
- redmine - apache2 reload when needed
- Reload unicorn when needed
tags: redmine
- name: Install the configuration file. Needed to send email - name: Install the configuration file. Needed to send email
copy: src=redmine-configuration.yml dest=/{{ redmine_glob_root_dir }}/{{ redmine_inst_dir }}/config/configuration.yml owner=root group={{ redmine_group }} mode=0440 copy: src=redmine-configuration.yml dest=/{{ redmine_glob_root_dir }}/{{ redmine_inst_dir }}/config/configuration.yml owner=root group={{ redmine_group }} mode=0440
notify: notify:
apache2 reload - apache2 reload when needed
tags: - Reload unicorn when needed
- redmine tags: redmine
- name: Install the gems required by redmine - name: Install the gems required by redmine
shell: cd {{ redmine_glob_root_dir }}/{{ redmine_inst_dir }}; bundle install --without development test sqlite mysql shell: cd {{ redmine_glob_root_dir }}/{{ redmine_inst_dir }}; bundle install --without development test sqlite mysql
when: redmine_install.changed tags: redmine
tags:
- redmine
- name: Generate the secret token - name: Generate the secret token
shell: cd {{ redmine_glob_root_dir }}/{{ redmine_inst_dir }}; rake generate_secret_token shell: cd {{ redmine_glob_root_dir }}/{{ redmine_inst_dir }}; rake generate_secret_token ; chmod 440 {{ redmine_glob_root_dir }}/{{ redmine_inst_dir }}/config/initializers/secret_token.rb ; chgrp {{ redmine_group }} {{ redmine_glob_root_dir }}/{{ redmine_inst_dir }}/config/initializers/secret_token.rb
when: redmine_install.changed args:
tags: creates: '{{ redmine_glob_root_dir }}/{{ redmine_inst_dir }}/config/initializers/secret_token.rb'
- redmine tags: redmine
- name: Initialize the DB - name: Initialize the DB
shell: cd {{ redmine_glob_root_dir }}/{{ redmine_inst_dir }}; RAILS_ENV=production rake db:migrate shell: cd {{ redmine_glob_root_dir }}/{{ redmine_inst_dir }}; RAILS_ENV=production rake db:migrate
when: redmine_install.changed when: redmine_install.changed
tags: tags: redmine
- redmine
- name: Install the defauld DB data - name: Install the defauld DB data
shell: cd {{ redmine_glob_root_dir }}/{{ redmine_inst_dir }}; RAILS_ENV=production REDMINE_LANG=en rake redmine:load_default_data shell: cd {{ redmine_glob_root_dir }}/{{ redmine_inst_dir }}; RAILS_ENV=production REDMINE_LANG=en rake redmine:load_default_data
when: redmine_install.changed when: redmine_install.changed
tags: tags: redmine
- redmine
- name: Install the packages needed by plugins or to build plugins required gems - name: Install the packages needed by plugins or to build plugins required gems
apt: pkg={{ item }} state=installed apt: pkg={{ item }} state=installed
with_items: with_items:
- libxslt1-dev - libxslt1-dev
tags: tags: redmine
- redmine
# The themes come from http://www.redminecrm.com/ # The themes come from http://www.redminecrm.com/
- name: Install some optional themes - name: Install some optional themes
@ -109,36 +98,30 @@
notify: notify:
- apache2 reload when needed - apache2 reload when needed
- Reload unicorn when needed - Reload unicorn when needed
tags: tags: redmine
- redmine
- name: Cron jobs that manage recurring tasks - name: Cron jobs that manage recurring tasks
template: src={{ item }}.cron.j2 dest=/etc/cron.d/{{ item }} owner=root group=root mode=0444 template: src={{ item }}.cron.j2 dest=/etc/cron.d/{{ item }} owner=root group=root mode=0444
with_items: with_items:
- redmine-recurring-tasks - redmine-recurring-tasks
- redmine-ldap-sync - redmine-ldap-sync
tags: tags: redmine
- redmine
- name: Add unicorn to the redmine Gemfile - name: Add unicorn to the redmine Gemfile
copy: dest={{ redmine_glob_root_dir }}/{{ redmine_inst_dir }}/Gemfile.local content='gem "unicorn"\n' owner={{ redmine_user }} group={{ redmine_group }} copy: dest={{ redmine_glob_root_dir }}/{{ redmine_inst_dir }}/Gemfile.local content='gem "unicorn"\n' owner={{ redmine_user }} group={{ redmine_group }}
when: ruby_use_unicorn when: ruby_use_unicorn
tags: tags: [ 'redmine', 'unicorn' ]
- redmine
- unicorn
- name: Upgrade rake to fix all the gems mess - name: Upgrade rake to fix all the gems mess
shell: cd {{ redmine_glob_root_dir }}/{{ redmine_inst_dir }}; bundle update rake shell: cd {{ redmine_glob_root_dir }}/{{ redmine_inst_dir }}; bundle update rake
tags: tags: redmine
- redmine
- name: Fix the permission of some files - name: Fix the permission of some files
file: dest={{ redmine_glob_root_dir }}/{{ redmine_inst_dir }}/{{ item }} owner={{ redmine_user }} group={{ redmine_group }} file: dest={{ redmine_glob_root_dir }}/{{ redmine_inst_dir }}/{{ item }} owner={{ redmine_user }} group={{ redmine_group }}
with_items: with_items:
- Gemfile - Gemfile
- Gemfile.lock - Gemfile.lock
tags: tags: redmine
- redmine
- name: Ensure that redmine can write into some directories - name: Ensure that redmine can write into some directories
file: dest={{ redmine_glob_root_dir }}/{{ redmine_inst_dir }}/{{ item }} state=directory owner={{ redmine_user }} group={{ redmine_group }} file: dest={{ redmine_glob_root_dir }}/{{ redmine_inst_dir }}/{{ item }} state=directory owner={{ redmine_user }} group={{ redmine_group }}
@ -149,6 +132,9 @@
- public/plugin_assets - public/plugin_assets
notify: notify:
change the redmine permissions recursively change the redmine permissions recursively
tags: tags: redmine
- redmine
- name: Install a logrotate script to take care of the ever growing production.log file
template: src=redmine-logrotate.j2 dest=/etc/logrotate.d/redmine-{{ redmine_inst_name }} owner=root group=root mode=0444
tags: [ 'redmine', 'logrotate' ]

View File

@ -1,8 +1,7 @@
--- ---
- name: Install the unicorn ruby-on-rails service - name: Install the unicorn ruby-on-rails service and its dependencies
gem: name={{ item }} state=latest gem: name={{ item }} state=latest
with_items: with_items: unicorn_gems
- unicorn
when: ruby_use_unicorn when: ruby_use_unicorn
tags: [ 'ruby', 'redmine', 'unicorn' ] tags: [ 'ruby', 'redmine', 'unicorn' ]

View File

@ -0,0 +1,6 @@
{{ redmine_glob_root_dir }}/{{ redmine_inst_dir }}/log/*.log {
missingok
notifempty
delaycompress
copytruncate
}