--- - block: - name: Create a user for the Nexus OSS service user: name={{ nexus_user }} home=/dev/null createhome=no shell=/usr/sbin/nologin system=yes - name: Create the nexus logs directory file: dest={{ nexus_logdir }} state=directory owner={{ nexus_user }} group={{ nexus_user }} mode=0755 - name: Install the systemd unit template: src=nexus.service.j2 dest=/etc/systemd/system/nexus.service owner=root group=root mode='0644' notify: Reload the systemd data - meta: flush_handlers tags: [ 'nexus', 'nexus_oss' ] - name: Manage the nexus distribution file block: - name: Download the nexus OSS distribution unarchive: src: '{{ nexus_download_url }}' dest: '{{ nexus_install_basedir }}' group: '{{ nexus_user }}' remote_src: yes creates: '{{ nexus_distribution_dir }}/LICENSE.txt' owner: '{{ nexus_user }}' register: nexus_new_version - name: Link to the latest version file: src={{ nexus_distribution_dir }} dest={{ nexus_webapp_dir }} state=link when: nexus_new_version is defined and nexus_new_version is changed notify: Restart Nexus tags: [ 'nexus', 'nexus_oss' ] - block: - name: Create the nexus wrapper log and prefs directories file: dest={{ item }} state=directory owner={{ nexus_user }} group={{ nexus_user }} mode=0755 with_items: - '{{ nexus_wrapper_logdir }}' - '{{ nexus_wrapper_prefs_root }}' - name: Install the nexus wrapper configuration template: src=wrapper.conf.j2 dest={{ nexus_wrapper_conf_dir }}/wrapper.conf owner=root group=root mode='0644' notify: Restart Nexus - name: Install the nexus base config template: src=nexus.properties.j2 dest={{ nexus_webapp_dir }}/conf/nexus.properties owner=root group=root mode='0644' notify: Restart Nexus - name: Install the nexus access logs configuration template: src=logback-access.xml.j2 dest={{ nexus_webapp_dir }}/conf/logback-access.xml owner=root group=root mode='0644' when: nexus_major_version == '2' tags: [ 'nexus', 'nexus_oss' ] - block: - meta: flush_handlers tags: [ 'nexus', 'nexus_oss' ] - block: - name: Ensure that the Nexus service is started and enabled service: name=nexus state=started enabled=yes tags: [ 'nexus', 'nexus_oss' ]