From 44b40868d043bdb9033d76e352e0282ebd7460da Mon Sep 17 00:00:00 2001 From: Haggai Philip Zagury Date: Sun, 29 Jan 2017 07:50:14 +0200 Subject: [PATCH] Refactor templates -> files --- README.md | 5 +- defaults/main.yml | 82 ++++++++++++++++--- .../groovy/create_blobstore.groovy | 0 files/groovy/create_repo_bower_group.groovy | 30 +++++++ files/groovy/create_repo_bower_hosted.groovy | 28 +++++++ files/groovy/create_repo_bower_proxy.groovy | 49 +++++++++++ .../groovy/create_repo_docker_group.groovy | 0 .../groovy/create_repo_docker_hosted.groovy | 0 .../groovy/create_repo_docker_proxy.groovy | 0 .../groovy/create_repo_maven_group.groovy | 0 .../groovy/create_repo_maven_hosted.groovy | 0 .../groovy/create_repo_maven_proxy.groovy | 0 files/groovy/create_repo_npm_group.groovy | 30 +++++++ files/groovy/create_repo_npm_hosted.groovy | 28 +++++++ files/groovy/create_repo_npm_proxy.groovy | 49 +++++++++++ .../groovy/create_repo_pypi_group.groovy | 0 .../groovy/create_repo_pypi_hosted.groovy | 4 - .../groovy/create_repo_pypi_proxy.groovy | 0 .../groovy/create_repo_raw_group.groovy | 0 .../groovy/create_repo_raw_proxy.groovy | 0 .../groovy/create_repo_rubygems_group.groovy | 30 +++++++ .../groovy/create_repo_rubygems_hosted.groovy | 28 +++++++ .../groovy/create_repo_rubygems_proxy.groovy | 50 +++++++++++ .../groovy/create_task.groovy | 0 .../groovy/delete_blobstore.groovy | 0 .../groovy/delete_repo.groovy | 0 .../groovy/setup_anonymous_access.groovy | 0 .../groovy/setup_base_url.groovy | 0 .../groovy/setup_capability.groovy | 0 {templates => files}/groovy/setup_ldap.groovy | 0 .../groovy/setup_privilege.groovy | 0 {templates => files}/groovy/setup_role.groovy | 0 {templates => files}/groovy/setup_user.groovy | 0 .../groovy/update_admin_password.groovy | 0 tasks/create_repo_bower_group_each.yml | 5 ++ tasks/create_repo_bower_hosted_each.yml | 5 ++ tasks/create_repo_bower_proxy_each.yml | 5 ++ tasks/create_repo_npm_group_each.yml | 5 ++ tasks/create_repo_npm_hosted_each.yml | 5 ++ tasks/create_repo_npm_proxy_each.yml | 5 ++ tasks/create_repo_rubygems_group_each.yml | 5 ++ tasks/create_repo_rubygems_hosted_each.yml | 5 ++ tasks/create_repo_rubygems_proxy_each.yml | 5 ++ tasks/declare_script_each.yml | 3 +- tasks/main.yml | 33 ++++++++ tasks/nexus_install.yml | 9 ++ 46 files changed, 485 insertions(+), 18 deletions(-) rename {templates => files}/groovy/create_blobstore.groovy (100%) create mode 100644 files/groovy/create_repo_bower_group.groovy create mode 100644 files/groovy/create_repo_bower_hosted.groovy create mode 100644 files/groovy/create_repo_bower_proxy.groovy rename {templates => files}/groovy/create_repo_docker_group.groovy (100%) rename {templates => files}/groovy/create_repo_docker_hosted.groovy (100%) rename {templates => files}/groovy/create_repo_docker_proxy.groovy (100%) rename {templates => files}/groovy/create_repo_maven_group.groovy (100%) rename {templates => files}/groovy/create_repo_maven_hosted.groovy (100%) rename {templates => files}/groovy/create_repo_maven_proxy.groovy (100%) create mode 100644 files/groovy/create_repo_npm_group.groovy create mode 100644 files/groovy/create_repo_npm_hosted.groovy create mode 100644 files/groovy/create_repo_npm_proxy.groovy rename {templates => files}/groovy/create_repo_pypi_group.groovy (100%) rename {templates => files}/groovy/create_repo_pypi_hosted.groovy (83%) rename {templates => files}/groovy/create_repo_pypi_proxy.groovy (100%) rename {templates => files}/groovy/create_repo_raw_group.groovy (100%) rename {templates => files}/groovy/create_repo_raw_proxy.groovy (100%) create mode 100644 files/groovy/create_repo_rubygems_group.groovy create mode 100644 files/groovy/create_repo_rubygems_hosted.groovy create mode 100644 files/groovy/create_repo_rubygems_proxy.groovy rename {templates => files}/groovy/create_task.groovy (100%) rename {templates => files}/groovy/delete_blobstore.groovy (100%) rename {templates => files}/groovy/delete_repo.groovy (100%) rename {templates => files}/groovy/setup_anonymous_access.groovy (100%) rename {templates => files}/groovy/setup_base_url.groovy (100%) rename {templates => files}/groovy/setup_capability.groovy (100%) rename {templates => files}/groovy/setup_ldap.groovy (100%) rename {templates => files}/groovy/setup_privilege.groovy (100%) rename {templates => files}/groovy/setup_role.groovy (100%) rename {templates => files}/groovy/setup_user.groovy (100%) rename {templates => files}/groovy/update_admin_password.groovy (100%) create mode 100644 tasks/create_repo_bower_group_each.yml create mode 100644 tasks/create_repo_bower_hosted_each.yml create mode 100644 tasks/create_repo_bower_proxy_each.yml create mode 100644 tasks/create_repo_npm_group_each.yml create mode 100644 tasks/create_repo_npm_hosted_each.yml create mode 100644 tasks/create_repo_npm_proxy_each.yml create mode 100644 tasks/create_repo_rubygems_group_each.yml create mode 100644 tasks/create_repo_rubygems_hosted_each.yml create mode 100644 tasks/create_repo_rubygems_proxy_each.yml diff --git a/README.md b/README.md index 4869d7b..47e0918 100644 --- a/README.md +++ b/README.md @@ -195,12 +195,15 @@ All three repository types are combined with the following default values : write_policy: allow_once # allow_once or allow ``` -Docker, Pypi & Raw repository types: +Docker, Pypi, Raw, Rubygems, Bower, NPM repository types: see `defaults/main/yml` for three options: nexus_config_pypi: false nexus_config_docker: false nexus_config_raw: false + nexus_config_rubygems: false + nexus_config_bower: false + nexus_config_npm: false These are all false unless you override them from playbook / group_var / cli, these all utlize the same mechanisem as maven. diff --git a/defaults/main.yml b/defaults/main.yml index 4df679c..bfc9b8d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -42,10 +42,9 @@ ldap_connections: [] nexus_config_pypi: false nexus_config_docker: false nexus_config_raw: false - - - - +nexus_config_rubygems: false +nexus_config_bower: false +nexus_config_npm: false # also see _nexus_privilege_defaults below nexus_privileges: @@ -92,7 +91,6 @@ nexus_repos_maven_proxy: - name: jboss remote_url: 'https://repository.jboss.org/nexus/content/groups/public-jboss/' - # example with a login/password : # - name: secret-remote-repo # remote_url: 'https://company.com/repo/secure/private/go/away' @@ -132,10 +130,6 @@ _nexus_repos_maven_defaults: layout_policy: strict # strict or permissive write_policy: allow_once # allow_once or allow - - - - # pypi support ... _nexus_repos_pypi_defaults: blob_store: default # Note : cannot be updated once the repo has been created @@ -189,12 +183,12 @@ _nexus_repos_docker_defaults: write_policy: allow_once # allow_once or allow nexus_repos_docker_hosted: - - name: private-registry + - name: docker-hosted http_port: 9080 v1_enabled: True nexus_repos_docker_proxy: - - name: proxy-registry + - name: docker-proxy http_port: 9081 v1_enabled: True index_type: "HUB" @@ -202,8 +196,72 @@ nexus_repos_docker_proxy: use_nexus_certificates_to_access_index: false nexus_repos_docker_group: - - name: registry-group + - name: docker-group http_port: 9082 v1_enabled: True +# RubyGems support +_nexus_repos_rubygems_defaults: + blob_store: default # Note : cannot be updated once the repo has been created + strict_content_validation: true + write_policy: allow_once # allow_once or allow + +nexus_repos_rubygems_hosted: + - name: rubygems-hosted + blob_store: default + +nexus_repos_rubygems_group: + - name: rubygems + blob_store: default + member_repos: + - rubygems-hosted + - rubygems-proxy + +nexus_repos_rubygems_proxy: + - name: rubygems-proxy + blob_store: default + remote_url: https://rubygems.org + +# Bower support +_nexus_repos_bower_defaults: + blob_store: default # Note : cannot be updated once the repo has been created + strict_content_validation: true + write_policy: allow_once # allow_once or allow + +nexus_repos_bower_hosted: + - name: bower-internal + blob_store: default + +nexus_repos_bower_group: + - name: bower-all + blob_store: default + member_repos: + - bower-internal + - bower-proxy + +nexus_repos_bower_proxy: + - name: bower-proxy + blob_store: default + remote_url: http://bower.herokuapp.com + +# npm support +_nexus_repos_npm_defaults: + blob_store: default # Note : cannot be updated once the repo has been created + strict_content_validation: true + write_policy: allow_once # allow_once or allow + +nexus_repos_npm_hosted: + - name: npm-internal + blob_store: default + +nexus_repos_npm_group: + - name: npm-all + blob_store: default + member_repos: + - npm-internal + - npm-proxy +nexus_repos_npm_proxy: + - name: npm-proxy + blob_store: default + remote_url: https://registry.npmjs.org \ No newline at end of file diff --git a/templates/groovy/create_blobstore.groovy b/files/groovy/create_blobstore.groovy similarity index 100% rename from templates/groovy/create_blobstore.groovy rename to files/groovy/create_blobstore.groovy diff --git a/files/groovy/create_repo_bower_group.groovy b/files/groovy/create_repo_bower_group.groovy new file mode 100644 index 0000000..cd05044 --- /dev/null +++ b/files/groovy/create_repo_bower_group.groovy @@ -0,0 +1,30 @@ +import groovy.json.JsonSlurper +import org.sonatype.nexus.repository.config.Configuration + +parsed_args = new JsonSlurper().parseText(args) + +configuration = new Configuration( + repositoryName: parsed_args.name, + recipeName: 'bower-group', + online: true, + attributes: [ + group : [ + memberNames: parsed_args.member_repos + ], + storage: [ + blobStoreName: parsed_args.blob_store, + strictContentTypeValidation: Boolean.valueOf(parsed_args.strict_content_validation) + ] + ] +) + +def existingRepository = repository.getRepositoryManager().get(parsed_args.name) + +if (existingRepository != null) { + existingRepository.stop() + configuration.attributes['storage']['blobStoreName'] = existingRepository.configuration.attributes['storage']['blobStoreName'] + existingRepository.update(configuration) + existingRepository.start() +} else { + repository.getRepositoryManager().create(configuration) +} diff --git a/files/groovy/create_repo_bower_hosted.groovy b/files/groovy/create_repo_bower_hosted.groovy new file mode 100644 index 0000000..4f63ee9 --- /dev/null +++ b/files/groovy/create_repo_bower_hosted.groovy @@ -0,0 +1,28 @@ +import groovy.json.JsonSlurper +import org.sonatype.nexus.repository.config.Configuration + +parsed_args = new JsonSlurper().parseText(args) + +configuration = new Configuration( + repositoryName: parsed_args.name, + recipeName: 'bower-hosted', + online: true, + attributes: [ + storage: [ + writePolicy: parsed_args.write_policy.toUpperCase(), + blobStoreName: parsed_args.blob_store, + strictContentTypeValidation: Boolean.valueOf(parsed_args.strict_content_validation) + ] + ] +) + +def existingRepository = repository.getRepositoryManager().get(parsed_args.name) + +if (existingRepository != null) { + existingRepository.stop() + configuration.attributes['storage']['blobStoreName'] = existingRepository.configuration.attributes['storage']['blobStoreName'] + existingRepository.update(configuration) + existingRepository.start() +} else { + repository.getRepositoryManager().create(configuration) +} diff --git a/files/groovy/create_repo_bower_proxy.groovy b/files/groovy/create_repo_bower_proxy.groovy new file mode 100644 index 0000000..5bdb02c --- /dev/null +++ b/files/groovy/create_repo_bower_proxy.groovy @@ -0,0 +1,49 @@ +import groovy.json.JsonSlurper +import org.sonatype.nexus.repository.config.Configuration + +parsed_args = new JsonSlurper().parseText(args) + +authentication = parsed_args.remote_username == null ? null : [ + type: 'username', + username: parsed_args.remote_username, + password: parsed_args.remote_password +] + +configuration = new Configuration( + repositoryName: parsed_args.name, + recipeName: 'bower-proxy', + online: true, + attributes: [ + bower: [ + rewritePackageUrls: true + ], + proxy: [ + remoteUrl: parsed_args.remote_url, + contentMaxAge: 1440.0, + metadataMaxAge: 1440.0 + ], + httpclient: [ + blocked: false, + autoBlock: true + ], + storage: [ + blobStoreName: parsed_args.blob_store, + strictContentTypeValidation: Boolean.valueOf(parsed_args.strict_content_validation) + ], + negativeCache: [ + enabled: true, + timeToLive: 1440.0 + ] + ] +) + +def existingRepository = repository.getRepositoryManager().get(parsed_args.name) + +if (existingRepository != null) { + existingRepository.stop() + configuration.attributes['storage']['blobStoreName'] = existingRepository.configuration.attributes['storage']['blobStoreName'] + existingRepository.update(configuration) + existingRepository.start() +} else { + repository.getRepositoryManager().create(configuration) +} diff --git a/templates/groovy/create_repo_docker_group.groovy b/files/groovy/create_repo_docker_group.groovy similarity index 100% rename from templates/groovy/create_repo_docker_group.groovy rename to files/groovy/create_repo_docker_group.groovy diff --git a/templates/groovy/create_repo_docker_hosted.groovy b/files/groovy/create_repo_docker_hosted.groovy similarity index 100% rename from templates/groovy/create_repo_docker_hosted.groovy rename to files/groovy/create_repo_docker_hosted.groovy diff --git a/templates/groovy/create_repo_docker_proxy.groovy b/files/groovy/create_repo_docker_proxy.groovy similarity index 100% rename from templates/groovy/create_repo_docker_proxy.groovy rename to files/groovy/create_repo_docker_proxy.groovy diff --git a/templates/groovy/create_repo_maven_group.groovy b/files/groovy/create_repo_maven_group.groovy similarity index 100% rename from templates/groovy/create_repo_maven_group.groovy rename to files/groovy/create_repo_maven_group.groovy diff --git a/templates/groovy/create_repo_maven_hosted.groovy b/files/groovy/create_repo_maven_hosted.groovy similarity index 100% rename from templates/groovy/create_repo_maven_hosted.groovy rename to files/groovy/create_repo_maven_hosted.groovy diff --git a/templates/groovy/create_repo_maven_proxy.groovy b/files/groovy/create_repo_maven_proxy.groovy similarity index 100% rename from templates/groovy/create_repo_maven_proxy.groovy rename to files/groovy/create_repo_maven_proxy.groovy diff --git a/files/groovy/create_repo_npm_group.groovy b/files/groovy/create_repo_npm_group.groovy new file mode 100644 index 0000000..0b5d08e --- /dev/null +++ b/files/groovy/create_repo_npm_group.groovy @@ -0,0 +1,30 @@ +import groovy.json.JsonSlurper +import org.sonatype.nexus.repository.config.Configuration + +parsed_args = new JsonSlurper().parseText(args) + +configuration = new Configuration( + repositoryName: parsed_args.name, + recipeName: 'npm-group', + online: true, + attributes: [ + group : [ + memberNames: parsed_args.member_repos + ], + storage: [ + blobStoreName: parsed_args.blob_store, + strictContentTypeValidation: Boolean.valueOf(parsed_args.strict_content_validation) + ] + ] +) + +def existingRepository = repository.getRepositoryManager().get(parsed_args.name) + +if (existingRepository != null) { + existingRepository.stop() + configuration.attributes['storage']['blobStoreName'] = existingRepository.configuration.attributes['storage']['blobStoreName'] + existingRepository.update(configuration) + existingRepository.start() +} else { + repository.getRepositoryManager().create(configuration) +} diff --git a/files/groovy/create_repo_npm_hosted.groovy b/files/groovy/create_repo_npm_hosted.groovy new file mode 100644 index 0000000..21cb2ee --- /dev/null +++ b/files/groovy/create_repo_npm_hosted.groovy @@ -0,0 +1,28 @@ +import groovy.json.JsonSlurper +import org.sonatype.nexus.repository.config.Configuration + +parsed_args = new JsonSlurper().parseText(args) + +configuration = new Configuration( + repositoryName: parsed_args.name, + recipeName: 'npm-hosted', + online: true, + attributes: [ + storage: [ + writePolicy: parsed_args.write_policy.toUpperCase(), + blobStoreName: parsed_args.blob_store, + strictContentTypeValidation: Boolean.valueOf(parsed_args.strict_content_validation) + ] + ] +) + +def existingRepository = repository.getRepositoryManager().get(parsed_args.name) + +if (existingRepository != null) { + existingRepository.stop() + configuration.attributes['storage']['blobStoreName'] = existingRepository.configuration.attributes['storage']['blobStoreName'] + existingRepository.update(configuration) + existingRepository.start() +} else { + repository.getRepositoryManager().create(configuration) +} diff --git a/files/groovy/create_repo_npm_proxy.groovy b/files/groovy/create_repo_npm_proxy.groovy new file mode 100644 index 0000000..f1df350 --- /dev/null +++ b/files/groovy/create_repo_npm_proxy.groovy @@ -0,0 +1,49 @@ +import groovy.json.JsonSlurper +import org.sonatype.nexus.repository.config.Configuration + +parsed_args = new JsonSlurper().parseText(args) + +authentication = parsed_args.remote_username == null ? null : [ + type: 'username', + username: parsed_args.remote_username, + password: parsed_args.remote_password +] + +configuration = new Configuration( + repositoryName: parsed_args.name, + recipeName: 'npm-proxy', + online: true, + attributes: [ + proxy : [ + remoteUrl: parsed_args.remote_url, + contentMaxAge: 1440.0, + metadataMaxAge: 1440.0 + ], + httpclient: [ + blocked: false, + autoBlock: true, + connection: [ + useTrustStore: false + ] + ], + storage: [ + blobStoreName: parsed_args.blob_store, + strictContentTypeValidation: Boolean.valueOf(parsed_args.strict_content_validation) + ], + negativeCache: [ + enabled: true, + timeToLive: 1440.0 + ] + ] +) + +def existingRepository = repository.getRepositoryManager().get(parsed_args.name) + +if (existingRepository != null) { + existingRepository.stop() + configuration.attributes['storage']['blobStoreName'] = existingRepository.configuration.attributes['storage']['blobStoreName'] + existingRepository.update(configuration) + existingRepository.start() +} else { + repository.getRepositoryManager().create(configuration) +} diff --git a/templates/groovy/create_repo_pypi_group.groovy b/files/groovy/create_repo_pypi_group.groovy similarity index 100% rename from templates/groovy/create_repo_pypi_group.groovy rename to files/groovy/create_repo_pypi_group.groovy diff --git a/templates/groovy/create_repo_pypi_hosted.groovy b/files/groovy/create_repo_pypi_hosted.groovy similarity index 83% rename from templates/groovy/create_repo_pypi_hosted.groovy rename to files/groovy/create_repo_pypi_hosted.groovy index a24ec1c..c98e66c 100644 --- a/templates/groovy/create_repo_pypi_hosted.groovy +++ b/files/groovy/create_repo_pypi_hosted.groovy @@ -8,10 +8,6 @@ configuration = new Configuration( recipeName: 'pypi-hosted', online: true, attributes: [ - maven : [ - versionPolicy: parsed_args.version_policy.toUpperCase(), - layoutPolicy : parsed_args.layout_policy.toUpperCase() - ], storage: [ writePolicy: parsed_args.write_policy.toUpperCase(), blobStoreName: parsed_args.blob_store, diff --git a/templates/groovy/create_repo_pypi_proxy.groovy b/files/groovy/create_repo_pypi_proxy.groovy similarity index 100% rename from templates/groovy/create_repo_pypi_proxy.groovy rename to files/groovy/create_repo_pypi_proxy.groovy diff --git a/templates/groovy/create_repo_raw_group.groovy b/files/groovy/create_repo_raw_group.groovy similarity index 100% rename from templates/groovy/create_repo_raw_group.groovy rename to files/groovy/create_repo_raw_group.groovy diff --git a/templates/groovy/create_repo_raw_proxy.groovy b/files/groovy/create_repo_raw_proxy.groovy similarity index 100% rename from templates/groovy/create_repo_raw_proxy.groovy rename to files/groovy/create_repo_raw_proxy.groovy diff --git a/files/groovy/create_repo_rubygems_group.groovy b/files/groovy/create_repo_rubygems_group.groovy new file mode 100644 index 0000000..7bc9f42 --- /dev/null +++ b/files/groovy/create_repo_rubygems_group.groovy @@ -0,0 +1,30 @@ +import groovy.json.JsonSlurper +import org.sonatype.nexus.repository.config.Configuration + +parsed_args = new JsonSlurper().parseText(args) + +configuration = new Configuration( + repositoryName: parsed_args.name, + recipeName: 'rubygems-group', + online: true, + attributes: [ + group : [ + memberNames: parsed_args.member_repos + ], + storage: [ + blobStoreName: parsed_args.blob_store, + strictContentTypeValidation: Boolean.valueOf(parsed_args.strict_content_validation) + ] + ] +) + +def existingRepository = repository.getRepositoryManager().get(parsed_args.name) + +if (existingRepository != null) { + existingRepository.stop() + configuration.attributes['storage']['blobStoreName'] = existingRepository.configuration.attributes['storage']['blobStoreName'] + existingRepository.update(configuration) + existingRepository.start() +} else { + repository.getRepositoryManager().create(configuration) +} \ No newline at end of file diff --git a/files/groovy/create_repo_rubygems_hosted.groovy b/files/groovy/create_repo_rubygems_hosted.groovy new file mode 100644 index 0000000..823f322 --- /dev/null +++ b/files/groovy/create_repo_rubygems_hosted.groovy @@ -0,0 +1,28 @@ +import groovy.json.JsonSlurper +import org.sonatype.nexus.repository.config.Configuration + +parsed_args = new JsonSlurper().parseText(args) + +configuration = new Configuration( + repositoryName: parsed_args.name, + recipeName: 'rubygems-hosted', + online: true, + attributes: [ + storage: [ + writePolicy: parsed_args.write_policy.toUpperCase(), + blobStoreName: parsed_args.blob_store, + strictContentTypeValidation: Boolean.valueOf(parsed_args.strict_content_validation) + ] + ] +) + +def existingRepository = repository.getRepositoryManager().get(parsed_args.name) + +if (existingRepository != null) { + existingRepository.stop() + configuration.attributes['storage']['blobStoreName'] = existingRepository.configuration.attributes['storage']['blobStoreName'] + existingRepository.update(configuration) + existingRepository.start() +} else { + repository.getRepositoryManager().create(configuration) +} \ No newline at end of file diff --git a/files/groovy/create_repo_rubygems_proxy.groovy b/files/groovy/create_repo_rubygems_proxy.groovy new file mode 100644 index 0000000..f1526c6 --- /dev/null +++ b/files/groovy/create_repo_rubygems_proxy.groovy @@ -0,0 +1,50 @@ +import groovy.json.JsonSlurper +import org.sonatype.nexus.repository.config.Configuration + +parsed_args = new JsonSlurper().parseText(args) + +authentication = parsed_args.remote_username == null ? null : [ + type: 'username', + username: parsed_args.remote_username, + password: parsed_args.remote_password +] + +configuration = new Configuration( + repositoryName: parsed_args.name, + recipeName: 'rubygems-proxy', + online: true, + attributes: [ + proxy : [ + remoteUrl: parsed_args.remote_url, + contentMaxAge: 1440.0, + metadataMaxAge: 1440.0 + ], + httpclient: [ + blocked: false, + autoBlock: true, + authentication: authentication, + connection: [ + useTrustStore: false + ] + ], + storage: [ + blobStoreName: parsed_args.blob_store, + strictContentTypeValidation: Boolean.valueOf(parsed_args.strict_content_validation) + ], + negativeCache: [ + enabled: true, + timeToLive: 1440.0 + ] + ] +) + +def existingRepository = repository.getRepositoryManager().get(parsed_args.name) + +if (existingRepository != null) { + existingRepository.stop() + configuration.attributes['storage']['blobStoreName'] = existingRepository.configuration.attributes['storage']['blobStoreName'] + existingRepository.update(configuration) + existingRepository.start() +} else { + repository.getRepositoryManager().create(configuration) +} diff --git a/templates/groovy/create_task.groovy b/files/groovy/create_task.groovy similarity index 100% rename from templates/groovy/create_task.groovy rename to files/groovy/create_task.groovy diff --git a/templates/groovy/delete_blobstore.groovy b/files/groovy/delete_blobstore.groovy similarity index 100% rename from templates/groovy/delete_blobstore.groovy rename to files/groovy/delete_blobstore.groovy diff --git a/templates/groovy/delete_repo.groovy b/files/groovy/delete_repo.groovy similarity index 100% rename from templates/groovy/delete_repo.groovy rename to files/groovy/delete_repo.groovy diff --git a/templates/groovy/setup_anonymous_access.groovy b/files/groovy/setup_anonymous_access.groovy similarity index 100% rename from templates/groovy/setup_anonymous_access.groovy rename to files/groovy/setup_anonymous_access.groovy diff --git a/templates/groovy/setup_base_url.groovy b/files/groovy/setup_base_url.groovy similarity index 100% rename from templates/groovy/setup_base_url.groovy rename to files/groovy/setup_base_url.groovy diff --git a/templates/groovy/setup_capability.groovy b/files/groovy/setup_capability.groovy similarity index 100% rename from templates/groovy/setup_capability.groovy rename to files/groovy/setup_capability.groovy diff --git a/templates/groovy/setup_ldap.groovy b/files/groovy/setup_ldap.groovy similarity index 100% rename from templates/groovy/setup_ldap.groovy rename to files/groovy/setup_ldap.groovy diff --git a/templates/groovy/setup_privilege.groovy b/files/groovy/setup_privilege.groovy similarity index 100% rename from templates/groovy/setup_privilege.groovy rename to files/groovy/setup_privilege.groovy diff --git a/templates/groovy/setup_role.groovy b/files/groovy/setup_role.groovy similarity index 100% rename from templates/groovy/setup_role.groovy rename to files/groovy/setup_role.groovy diff --git a/templates/groovy/setup_user.groovy b/files/groovy/setup_user.groovy similarity index 100% rename from templates/groovy/setup_user.groovy rename to files/groovy/setup_user.groovy diff --git a/templates/groovy/update_admin_password.groovy b/files/groovy/update_admin_password.groovy similarity index 100% rename from templates/groovy/update_admin_password.groovy rename to files/groovy/update_admin_password.groovy diff --git a/tasks/create_repo_bower_group_each.yml b/tasks/create_repo_bower_group_each.yml new file mode 100644 index 0000000..ca520c5 --- /dev/null +++ b/tasks/create_repo_bower_group_each.yml @@ -0,0 +1,5 @@ +--- +- include: call_script.yml + vars: + script_name: create_repo_bower_group + args: "{{ _nexus_repos_bower_defaults|combine(item) }}" \ No newline at end of file diff --git a/tasks/create_repo_bower_hosted_each.yml b/tasks/create_repo_bower_hosted_each.yml new file mode 100644 index 0000000..68e6c2e --- /dev/null +++ b/tasks/create_repo_bower_hosted_each.yml @@ -0,0 +1,5 @@ +--- +- include: call_script.yml + vars: + script_name: create_repo_bower_hosted + args: "{{ _nexus_repos_bower_defaults|combine(item) }}" \ No newline at end of file diff --git a/tasks/create_repo_bower_proxy_each.yml b/tasks/create_repo_bower_proxy_each.yml new file mode 100644 index 0000000..289fcc1 --- /dev/null +++ b/tasks/create_repo_bower_proxy_each.yml @@ -0,0 +1,5 @@ +--- +- include: call_script.yml + vars: + script_name: create_repo_bower_proxy + args: "{{ _nexus_repos_bower_defaults|combine(item) }}" \ No newline at end of file diff --git a/tasks/create_repo_npm_group_each.yml b/tasks/create_repo_npm_group_each.yml new file mode 100644 index 0000000..2d902a0 --- /dev/null +++ b/tasks/create_repo_npm_group_each.yml @@ -0,0 +1,5 @@ +--- +- include: call_script.yml + vars: + script_name: create_repo_npm_group + args: "{{ _nexus_repos_npm_defaults|combine(item) }}" \ No newline at end of file diff --git a/tasks/create_repo_npm_hosted_each.yml b/tasks/create_repo_npm_hosted_each.yml new file mode 100644 index 0000000..105ae3b --- /dev/null +++ b/tasks/create_repo_npm_hosted_each.yml @@ -0,0 +1,5 @@ +--- +- include: call_script.yml + vars: + script_name: create_repo_npm_hosted + args: "{{ _nexus_repos_npm_defaults|combine(item) }}" \ No newline at end of file diff --git a/tasks/create_repo_npm_proxy_each.yml b/tasks/create_repo_npm_proxy_each.yml new file mode 100644 index 0000000..282caa6 --- /dev/null +++ b/tasks/create_repo_npm_proxy_each.yml @@ -0,0 +1,5 @@ +--- +- include: call_script.yml + vars: + script_name: create_repo_npm_proxy + args: "{{ _nexus_repos_npm_defaults|combine(item) }}" \ No newline at end of file diff --git a/tasks/create_repo_rubygems_group_each.yml b/tasks/create_repo_rubygems_group_each.yml new file mode 100644 index 0000000..3d94eae --- /dev/null +++ b/tasks/create_repo_rubygems_group_each.yml @@ -0,0 +1,5 @@ +--- +- include: call_script.yml + vars: + script_name: create_repo_rubygems_group + args: "{{ _nexus_repos_rubygems_defaults|combine(item) }}" \ No newline at end of file diff --git a/tasks/create_repo_rubygems_hosted_each.yml b/tasks/create_repo_rubygems_hosted_each.yml new file mode 100644 index 0000000..0ea32f3 --- /dev/null +++ b/tasks/create_repo_rubygems_hosted_each.yml @@ -0,0 +1,5 @@ +--- +- include: call_script.yml + vars: + script_name: create_repo_rubygems_hosted + args: "{{ _nexus_repos_rubygems_defaults|combine(item) }}" \ No newline at end of file diff --git a/tasks/create_repo_rubygems_proxy_each.yml b/tasks/create_repo_rubygems_proxy_each.yml new file mode 100644 index 0000000..f9415e3 --- /dev/null +++ b/tasks/create_repo_rubygems_proxy_each.yml @@ -0,0 +1,5 @@ +--- +- include: call_script.yml + vars: + script_name: create_repo_rubygems_proxy + args: "{{ _nexus_repos_rubygems_defaults|combine(item) }}" \ No newline at end of file diff --git a/tasks/declare_script_each.yml b/tasks/declare_script_each.yml index 5f230a6..49e5ccc 100644 --- a/tasks/declare_script_each.yml +++ b/tasks/declare_script_each.yml @@ -20,4 +20,5 @@ body: name: "{{ item }}" type: 'groovy' - content: "{{ lookup('template', 'groovy/' + item + '.groovy') }}" + content: "{{ lookup('file', 'groovy/' + item + '.groovy') }}" + diff --git a/tasks/main.yml b/tasks/main.yml index 3a1f1ae..ab7364a 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -78,6 +78,39 @@ with_items: "{{ nexus_repos_raw_group }}" when: nexus_config_raw +- block: + - include: create_repo_rubygems_proxy_each.yml + with_items: "{{ nexus_repos_rubygems_proxy }}" + + - include: create_repo_rubygems_hosted_each.yml + with_items: "{{ nexus_repos_rubygems_hosted }}" + + - include: create_repo_rubygems_group_each.yml + with_items: "{{ nexus_repos_rubygems_group }}" + when: nexus_config_rubygems + +- block: + - include: create_repo_bower_proxy_each.yml + with_items: "{{ nexus_repos_bower_proxy }}" + + - include: create_repo_bower_hosted_each.yml + with_items: "{{ nexus_repos_bower_hosted }}" + + - include: create_repo_bower_group_each.yml + with_items: "{{ nexus_repos_bower_group }}" + when: nexus_config_bower + +- block: + - include: create_repo_npm_proxy_each.yml + with_items: "{{ nexus_repos_npm_proxy }}" + + - include: create_repo_npm_hosted_each.yml + with_items: "{{ nexus_repos_npm_hosted }}" + + - include: create_repo_npm_group_each.yml + with_items: "{{ nexus_repos_npm_group }}" + when: nexus_config_npm + - include: call_script.yml vars: script_name: setup_anonymous_access diff --git a/tasks/nexus_install.yml b/tasks/nexus_install.yml index b04e948..d85be0b 100644 --- a/tasks/nexus_install.yml +++ b/tasks/nexus_install.yml @@ -208,4 +208,13 @@ - create_repo_pypi_group - create_repo_raw_proxy - create_repo_raw_group + - create_repo_rubygems_hosted + - create_repo_rubygems_proxy + - create_repo_rubygems_group + - create_repo_bower_hosted + - create_repo_bower_proxy + - create_repo_bower_group + - create_repo_npm_hosted + - create_repo_npm_proxy + - create_repo_npm_group - create_task