--- - block: - name: Install the unicorn package apt: pkg=unicorn state=present cache_valid_time=1800 tags: [ 'ruby', 'redmine', 'unicorn', 'unicorn_nginx' ] when: ansible_distribution_version is version_compare('18.04', '==') - block: - name: Create the unicorn log directory file: dest={{ unicorn_log_dir }} state=directory owner={{ redmine_user }} group={{ redmine_user }} mode=0750 - name: Install the unicorn defaults file template: src=unicorn-redmine.default.j2 dest=/etc/default/unicorn-{{ redmine_inst_name }} owner=root group=root mode=0644 notify: Reload unicorn when needed - name: Install the unicorn logrotate file template: src=unicorn-logrotate.j2 dest=/etc/logrotate.d/unicorn-{{ redmine_inst_name }} owner=root group=root mode=0644 - name: Install the unicorn config template: src=unicorn.conf.rb.j2 dest={{ redmine_glob_root_dir }}/{{ redmine_inst_dir }}/config/unicorn.conf.rb owner=root group=root mode=0644 - name: Install the systemd unit that globally manages the unicorn service template: src: systemd_unicorn.service.j2 dest: '/lib/systemd/system/unicorn@.service' #dest: '{{ redmine_glob_root_dir }}/{{ redmine_inst_dir }}/config/unicorn@.service' notify: Reload systemd after the system unit installation # - name: Link the systemd unit that globally manages the unicorn service # file: # src: '{{ redmine_glob_root_dir }}/{{ redmine_inst_dir }}/config/unicorn@.service' # dest: '/lib/systemd/system/unicorn@.service' # state: link # notify: Reload systemd after the system unit installation - name: Add the systemd instance for the specific service file: src: '{{ redmine_glob_root_dir }}/{{ redmine_inst_dir }}/config/unicorn@.service' dest: '/lib/systemd/system/unicorn@{{ redmine_inst_name }}.service' state: link notify: Reload systemd after the system unit installation - name: Reload systemd after the system unit installation meta: flush_handlers - name: Ensure that the unicorn service for redmine is started and enabled service: name={{ redmine_systemd_service_name }} state=started enabled=yes ignore_errors: True tags: [ 'ruby', 'redmine', 'unicorn' ] when: ruby_use_unicorn