Getting Started
Installing the collection
ansible-galaxy collection install cloudkrafter.nexus
Initial setup and using the nexus_oss role
|
|
Running desired-state configurations
config_api
role uses a different approach to set defaults. If you override the _nexus_repos_maven_defaults
variable for example, make sure you apply the same defaults to the nexus_repos_global_defaults
, nexus_repos_type_defaults
and nexus_repos_format_defaults
dictionaries! See role defaults for the full dictionaries.Once you have a working Nexus instance, you can execute most configuration tasks without rebooting your Nexus instance.
config_api
role will ensure a desired state. For example repositories not defined in nexus_repos_*_*
will be DELETED in your Nexus instance. If you don’t want this, stick with the nexus_oss
role.
|
|
You can also use both roles in one play:
|
|
Using tags for an execution strategy
All tasks are tagged to allow certain parts to be executed.
Available tags:
--tags="repositories,maven-hosted"
to configure hosted maven repositories only.
or --tags="roles,users"
to configure roles and users.When no tags are specified, all tasks will be executed.
*-group
tags! Groups are always depending on either hosted or proxy repos. Therefore group repos can be configured using the format tag of a group, for example --tags="repositories,maven"
Dry run
Sometimes you want to see what will be changed before proceeding. By setting the nexus_config_dry_run: true
variable, the role will still show you what would have been changed upon a regular playbook run, without making any changes to your repositories.
To only show changed items in your Ansible logs you can do the following:
[defaults]
display_skipped_hosts = false
display_ok_hosts = false
or in your terminal session:
# Only show possible changes
export ANSIBLE_DISPLAY_SKIPPED_HOSTS=false
export ANSIBLE_DISPLAY_OK_HOSTS=false
ansible-playbook -i all playbook.yml -e nexus_config_dry_run=true
Examples for execution strategies
# Only configure cleanup policies
ansible-playbook -i all --tags cleanup-policies playbook.yml
[Optional] Enabling Nexus Repository Manager Pro
If you want to enable the Pro features, please note that you have to provide your own license.
If your Nexus instance is already running on the Pro version, you still need the nexus_enable_pro_version
variable set to be true
, otherwise the nexus_enable_pro_version
will default to false
resulting in disabling Pro features and removing your license, to comply with desired-state principles.
If you set nexus_enable_pro_version
to true
, you must provide a base64 encoded license file.
Either by setting the NEXUS_LICENSE_B64
environment variable on the system that executes your playbook or by providing a base64 encoded license string in your vars.
|
|
Next
When ready, explore the role capabilities and configurations: