|  | 
|  | 1 | +--- | 
|  | 2 | +order: 44 | 
|  | 3 | +xref: c4b-ansible-upgrading-nexus | 
|  | 4 | +title: Upgrading Nexus | 
|  | 5 | +description: A guide to upgrading Sonatype Nexus in the Chocolatey for Business Ansible Environment | 
|  | 6 | +--- | 
|  | 7 | +import Callout from '@choco/components/Callout.astro'; | 
|  | 8 | +import Iframe from '@choco/components/Iframe.astro'; | 
|  | 9 | +import Xref from '@components/Xref.astro'; | 
|  | 10 | + | 
|  | 11 | +## Upgrade Nexus in the Ansible Environment | 
|  | 12 | + | 
|  | 13 | +This document outlines the process for upgrading Nexus running inside our Ansible Environment. | 
|  | 14 | + | 
|  | 15 | +If your server is restricted from access to the Chocolatey Community Repository, <Xref title="internalize the package to your internal repository" value="package-internalizer" />. | 
|  | 16 | + | 
|  | 17 | +## Instructions | 
|  | 18 | + | 
|  | 19 | +1. Internalize the nexus-repository package and push to your internal repository | 
|  | 20 | +2. choco upgrade the nexus-repository package (Example command provided below) | 
|  | 21 | + | 
|  | 22 | +### Example Upgrade Command: | 
|  | 23 | + | 
|  | 24 | +```yaml | 
|  | 25 | +--- | 
|  | 26 | +- name: Upgrade Nexus | 
|  | 27 | +    hosts: "{{ c4b_nexus_nodes }}" | 
|  | 28 | +    gather_facts: true | 
|  | 29 | +    vars_prompt: | 
|  | 30 | +    - name: nexus_fqdn | 
|  | 31 | +        prompt: "FQDN to access Nexus, e.g. nexus.example.com" | 
|  | 32 | +        private: no | 
|  | 33 | +    tasks: | 
|  | 34 | +    - name: Upgrade Sonatype Nexus | 
|  | 35 | +    chocolatey.chocolatey.win_chocolatey: | 
|  | 36 | +        name: nexus-repository | 
|  | 37 | +        state: latest | 
|  | 38 | +        params: "/Port:8443 /FQDN:{{ nexus_fqdn }} /BackupSslConfig" | 
|  | 39 | +... | 
|  | 40 | +``` | 
|  | 41 | + | 
|  | 42 | +After saving the example playbook to a file, e.g. `nexus-upgrade.yml`, you can run it with one of the following commands: | 
|  | 43 | + | 
|  | 44 | +```powershell | 
|  | 45 | +# This will install to all available hosts. Be careful! | 
|  | 46 | +ansible-playbook /path/to/nexus-upgrade.yml --extra-vars "c4b_nexus_nodes='*'" | 
|  | 47 | +
 | 
|  | 48 | +# You could specify an inventory to use, or be more specific when defining c4b_nexus_nodes. | 
|  | 49 | +ansible-playbook /path/to/nexus-upgrade.yml --inventory /path/to/hosts.yml --extra-vars "c4b_nexus_nodes='nexus_servers'" | 
|  | 50 | +``` | 
|  | 51 | + | 
|  | 52 | +## Upgrading to Nexus Repository 3.71.* and Higher | 
|  | 53 | + | 
|  | 54 | +Sonatype's upgrade to Nexus Repository 3.71.* came with several breaking changes, including the requirement to migrate your OSS instance from OrientDb to H2 before upgrading. | 
|  | 55 | + | 
|  | 56 | +Full details are available [here](https://help.sonatype.com/en/orient-pre-3-70-java-8-or-11.html), but to upgrade via Ansible you could run something like this playbook after pushing the modified copy of the `nexus-repository` package to your repository: | 
|  | 57 | + | 
|  | 58 | +```yaml | 
|  | 59 | +--- | 
|  | 60 | +- name: Upgrade Nexus | 
|  | 61 | +    hosts: "{{ c4b_nexus_nodes }}" | 
|  | 62 | +    gather_facts: true | 
|  | 63 | +    vars_prompt: | 
|  | 64 | +    - name: nexus_fqdn | 
|  | 65 | +        prompt: "FQDN to access Nexus, e.g. nexus.example.com" | 
|  | 66 | +        private: no | 
|  | 67 | +    tasks: | 
|  | 68 | + | 
|  | 69 | +    - name: Upgrade Sonatype Nexus to Migration Version | 
|  | 70 | +    chocolatey.chocolatey.win_chocolatey: | 
|  | 71 | +        name: nexus-repository | 
|  | 72 | +        state: upgrade | 
|  | 73 | +        version: 3.70.1.2 | 
|  | 74 | +        params: "/Port:8443 /FQDN:{{ nexus_fqdn }} /BackupSslConfig" | 
|  | 75 | + | 
|  | 76 | +    - name: Upgrade Sonatype Nexus | 
|  | 77 | +    chocolatey.chocolatey.win_chocolatey: | 
|  | 78 | +        name: nexus-repository | 
|  | 79 | +        state: upgrade | 
|  | 80 | +        version: 3.71.0.6 | 
|  | 81 | +        params: "/Port:8443 /FQDN:{{ nexus_fqdn }} /BackupSslConfig" | 
|  | 82 | +... | 
|  | 83 | +``` | 
|  | 84 | + | 
|  | 85 | +This should result in a successful migration and upgrade. | 
0 commit comments