# How to configure nexus using the approach "infrastructure as code"?

**URL:** <https://community.sonatype.com/t/how-to-configure-nexus-using-the-approach-infrastructure-as-code/4443>\
**Category:** Sonatype Nexus Repository\
**Created:** [June 17, 2020, 11:43am UTC](https://community.sonatype.com/t/how-to-configure-nexus-using-the-approach-infrastructure-as-code/4443 "2020-06-17T11:43:07Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![podlinovav](https://avatars.discourse-cdn.com/v4/letter/p/c5a1d2/32.png) [@podlinovav](https://community.sonatype.com/u/podlinovav)\
**Post date:** [June 17, 2020, 11:43am UTC](https://community.sonatype.com/t/how-to-configure-nexus-using-the-approach-infrastructure-as-code/4443/1 "2020-06-17T11:43:08Z")

</div>

We configure nexus oss using GUI but we want to store all settings as code, is it able?  
For example teamcity can store all preferences, builds, steps in git repository useing kotlin dsl. Can i do with nexus something similar? Maybe cfg/yml file or ect

---

<div class="post-metadata">

**Author:** ![mpiggott](https://avatars.discourse-cdn.com/v4/letter/m/f0a364/32.png) [@mpiggott](https://community.sonatype.com/u/mpiggott)\
**Post date:** [June 17, 2020, 2:26pm UTC](https://community.sonatype.com/t/how-to-configure-nexus-using-the-approach-infrastructure-as-code/4443/2 "2020-06-17T14:26:41Z")

</div>

You could write a script to use the REST API to setup nexus

---

<div class="post-metadata">

**Author:** ![christian.madrigal](https://avatars.discourse-cdn.com/v4/letter/c/e495f1/32.png) [@christian.madrigal](https://community.sonatype.com/u/christian.madrigal)\
**Post date:** [June 19, 2020, 7:13pm UTC](https://community.sonatype.com/t/how-to-configure-nexus-using-the-approach-infrastructure-as-code/4443/3 "2020-06-19T19:13:52Z")

</div>

Hi, we’re actually going through this now. It will be a combination of a few things:

1. updating configuration/property files
2. using the API (you can see what is available to your version by going to the API section). note that not everything is exposed, hence the next point
3. groovy - items like base url, creating a backup task etc

If you really want a fully configured system, be ready to write a lot of tasks ;). You may even want to explore with something like:

> **[Client Challenge](https://pypi.org/project/nexus3-cli/)**

Not that clean but doable.

Hope this helps. Let me know if you need anymore details. I know some of these forums can get a bit frustrating with folks citing the not so obvious 😉

Cheers!

---

<div class="post-metadata">

**Author:** ![brett.dellegrazie](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/brett.dellegrazie/32/1123_2.png) [@brett.dellegrazie](https://community.sonatype.com/u/brett.dellegrazie)\
**Post date:** [June 19, 2020, 7:35pm UTC](https://community.sonatype.com/t/how-to-configure-nexus-using-the-approach-infrastructure-as-code/4443/4 "2020-06-19T19:35:20Z")

</div>

Hi,

There are a couple of other options too.

1. nexus3-oss Ansible role [GitHub - ansible-ThoTeam/nexus3-oss: Ansible role to install and provision sonatype nexus3-oss](https://github.com/ansible-ThoTeam/nexus3-oss)
2. Nexus casc plugin [GitHub - AdaptiveConsulting/nexus-casc-plugin: Configuration as code plugin for Sonatype Nexus Repository Manager](https://github.com/AdaptiveConsulting/nexus-casc-plugin)

Disclaimer: I’m one of the maintainers of the casc plugin.

Thanks,

Brett

---

<div class="post-metadata">

**Author:** ![mpiggott](https://avatars.discourse-cdn.com/v4/letter/m/f0a364/32.png) [@mpiggott](https://community.sonatype.com/u/mpiggott)\
**Post date:** [June 19, 2020, 7:45pm UTC](https://community.sonatype.com/t/how-to-configure-nexus-using-the-approach-infrastructure-as-code/4443/5 "2020-06-19T19:45:00Z")

</div>

I think you must be using an older version most configuration options have REST API endpoints now.

---

<div class="post-metadata">

**Author:** ![christian.madrigal](https://avatars.discourse-cdn.com/v4/letter/c/e495f1/32.png) [@christian.madrigal](https://community.sonatype.com/u/christian.madrigal)\
**Post date:** [June 19, 2020, 8:17pm UTC](https://community.sonatype.com/t/how-to-configure-nexus-using-the-approach-infrastructure-as-code/4443/6 "2020-06-19T20:17:05Z")

</div>

3.24.0

We just upgraded because there we some apis which are using that went from beta to proper.

We are using groovy for the following:

- changing the admin password
- setting the base url
- setting http proxy
- and creating the db-backup task

I

---

<div class="post-metadata">

**Author:** ![mmartz](https://avatars.discourse-cdn.com/v4/letter/m/e9bcb4/32.png) [@mmartz](https://community.sonatype.com/u/mmartz)\
**Post date:** [June 19, 2020, 8:25pm UTC](https://community.sonatype.com/t/how-to-configure-nexus-using-the-approach-infrastructure-as-code/4443/7 "2020-06-19T20:25:35Z")

</div>

FYI, our the beta rest apis are mostly marked beta in the event we need to change the interface. So far I don’t think that’s happened very often and we’ve been putting in a redirect from the beta to the v1 version so you shouldn’t even need to change your scripts when the v1 version is released.

---

<div class="post-metadata">

**Author:** ![christian.madrigal](https://avatars.discourse-cdn.com/v4/letter/c/e495f1/32.png) [@christian.madrigal](https://community.sonatype.com/u/christian.madrigal)\
**Post date:** [June 19, 2020, 8:25pm UTC](https://community.sonatype.com/t/how-to-configure-nexus-using-the-approach-infrastructure-as-code/4443/8 "2020-06-19T20:25:37Z")

</div>

The CASC looks interesting. From the looks of it, it’s more friendly to config/drift management. We already have a jenkins casc though 🙂

We may look at this soon. Thanks!

---

<div class="post-metadata">

**Author:** ![christian.madrigal](https://avatars.discourse-cdn.com/v4/letter/c/e495f1/32.png) [@christian.madrigal](https://community.sonatype.com/u/christian.madrigal)\
**Post date:** [June 19, 2020, 8:27pm UTC](https://community.sonatype.com/t/how-to-configure-nexus-using-the-approach-infrastructure-as-code/4443/9 "2020-06-19T20:27:22Z")

</div>

awesome! thank you for letting me know.

---

<div class="post-metadata">

**Author:** ![popov86s](https://avatars.discourse-cdn.com/v4/letter/p/8797f3/32.png) [@popov86s](https://community.sonatype.com/u/popov86s)\
**Post date:** [July 9, 2020, 6:41am UTC](https://community.sonatype.com/t/how-to-configure-nexus-using-the-approach-infrastructure-as-code/4443/10 "2020-07-09T06:41:19Z")

</div>

Hi! @brett.dellegrazie we try to use your casc plugin in our infra. All work fine but we can’t create S3 Blobe Store via casc plugin. We try to use following config(no configuration example in your README.md):  
- name: ibi-bucket-nexus  
type: S3  
attributes:  
s3:  
region: us-east-1  
bucket: ibi-bucket-nexus

But it not working, S3 Blob Storage not created and other (file storage) too.  
Can you help?

---

<div class="post-metadata">

**Author:** ![brett.dellegrazie](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/brett.dellegrazie/32/1123_2.png) [@brett.dellegrazie](https://community.sonatype.com/u/brett.dellegrazie)\
**Post date:** [July 9, 2020, 6:53am UTC](https://community.sonatype.com/t/how-to-configure-nexus-using-the-approach-infrastructure-as-code/4443/11 "2020-07-09T06:53:29Z")

</div>

Hi,

Please raise an issue on GitHub and I’ll take a look.

Thanks,

Brett

---

<div class="post-metadata">

**Author:** ![popov86s](https://avatars.discourse-cdn.com/v4/letter/p/8797f3/32.png) [@popov86s](https://community.sonatype.com/u/popov86s)\
**Post date:** [July 9, 2020, 8:02am UTC](https://community.sonatype.com/t/how-to-configure-nexus-using-the-approach-infrastructure-as-code/4443/12 "2020-07-09T08:02:07Z")

</div>

> [@brett.dellegrazie](#):
>
> Please raise an issue on GitHub and I’ll take a look.

@brett.dellegrazie I can’t see possibility create issue for your repo in github:

 ![image](https://canada1.discourse-cdn.com/flex047/uploads/communitysonatype/original/2X/a/a8f4224182d94b4d7c1b104e9f8a2ce7a03a6d0c.png)

---

<div class="post-metadata">

**Author:** ![brett.dellegrazie](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/brett.dellegrazie/32/1123_2.png) [@brett.dellegrazie](https://community.sonatype.com/u/brett.dellegrazie)\
**Post date:** [July 9, 2020, 8:37am UTC](https://community.sonatype.com/t/how-to-configure-nexus-using-the-approach-infrastructure-as-code/4443/13 "2020-07-09T08:37:59Z")

</div>

Silly me.  
Enabled, please go ahead and create an issue.

---

<div class="post-metadata">

**Author:** ![popov86s](https://avatars.discourse-cdn.com/v4/letter/p/8797f3/32.png) [@popov86s](https://community.sonatype.com/u/popov86s)\
**Post date:** [July 9, 2020, 9:42am UTC](https://community.sonatype.com/t/how-to-configure-nexus-using-the-approach-infrastructure-as-code/4443/14 "2020-07-09T09:42:34Z")

</div>

> [@popov86s](#):
>
> we try to use your casc plugin in our infra. All work fine but we can’t create S3 Blobe Store via casc plugin. We try to use following config(no configuration example in your README.md):
> 
> - name: ibi-bucket-nexus  
> type: S3  
> attributes:  
> s3:  
> region: us-east-1  
> bucket: ibi-bucket-nexus
> 
> But it not working, S3 Blob Storage not created and other (file storage) too.  
> Can you help?

ok. I created Issue)

---

<div class="post-metadata">

**Author:** ![brett.dellegrazie](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/brett.dellegrazie/32/1123_2.png) [@brett.dellegrazie](https://community.sonatype.com/u/brett.dellegrazie)\
**Post date:** [September 3, 2020, 10:46am UTC](https://community.sonatype.com/t/how-to-configure-nexus-using-the-approach-infrastructure-as-code/4443/15 "2020-09-03T10:46:14Z")

</div>

For reference only, the issue has been resolved and there is now a worked example configuration to use S3

---

<div class="post-metadata">

**Author:** ![syan.priyajot](https://avatars.discourse-cdn.com/v4/letter/s/dbc845/32.png) [@syan.priyajot](https://community.sonatype.com/u/syan.priyajot)\
**Post date:** [June 11, 2021, 3:57am UTC](https://community.sonatype.com/t/how-to-configure-nexus-using-the-approach-infrastructure-as-code/4443/16 "2021-06-11T03:57:17Z")

</div>

Is it possible to apply Nexus Pro License file using nexus casc plugin or using IAC approaches above?  
We are using nexus casc plugin

---

<div class="post-metadata">

**Author:** ![mpiggott](https://avatars.discourse-cdn.com/v4/letter/m/f0a364/32.png) [@mpiggott](https://community.sonatype.com/u/mpiggott)\
**Post date:** [June 11, 2021, 1:20pm UTC](https://community.sonatype.com/t/how-to-configure-nexus-using-the-approach-infrastructure-as-code/4443/17 "2021-06-11T13:20:59Z")

</div>

You can load it via the properties file, or via REST - [How to Install a Nexus Repository Manager 3 License – Sonatype Support](https://support.sonatype.com/hc/en-us/articles/115000779668-How-to-Install-a-Nexus-Repository-Manager-3-License)

---

<div class="post-metadata">

**Author:** ![rseddon](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/rseddon/32/341_2.png) [@rseddon](https://community.sonatype.com/u/rseddon)\
**Post date:** [June 11, 2021, 1:24pm UTC](https://community.sonatype.com/t/how-to-configure-nexus-using-the-approach-infrastructure-as-code/4443/18 "2021-06-11T13:24:46Z")

</div>

See here for the options available for installing a license:

> **[Log in | cx-support](https://identity.sonatype.com/u/login/identifier?state=hKFo2SByWTR2aTlaZzJIcTRpcW9rQTJSemxoVVE0aWY5RWJzYqFur3VuaXZlcnNhbC1sb2dpbqN0aWTZIGhrOUJIRmd5MkhjR0tFTzhkX1daRE0tZUE1STh2RThlo2NpZNkgemF5UXMyUHhZUUxRYUtkVmVSWGNmWEhNUUpsckljYXE)**
