ื”ืชืงื ื” ื•ื”ื’ื“ืจื” ืฉืœ Nexus Sonatype ืชื•ืš ืฉื™ืžื•ืฉ ื‘ื’ื™ืฉืช ื”ืชืฉืชื™ืช ื›ืงื•ื“

Sonatype Nexus ื”ื™ื ืคืœื˜ืคื•ืจืžื” ืžืฉื•ืœื‘ืช ืฉื‘ืืžืฆืขื•ืชื” ืžืคืชื—ื™ื ื™ื›ื•ืœื™ื ืœื™ืฆื•ืจ proxy, ืœืื—ืกืŸ ื•ืœื ื”ืœ ืชืœื•ืช ืฉืœ Java (Maven), Docker, Python, Ruby, NPM, ืชืžื•ื ื•ืช Bower, ื—ื‘ื™ืœื•ืช RPM, gitlfs, Apt, Go, Nuget, ื•ืœื”ืคื™ืฅ ืืช ืื‘ื˜ื—ืช ื”ืชื•ื›ื ื” ืฉืœื”ื.

ืœืžื” ืืชื” ืฆืจื™ืš Sonatype Nexus?

  • ืœืื—ืกื•ืŸ ื—ืคืฆื™ื ืคืจื˜ื™ื™ื;
  • ืขื‘ื•ืจ ืื—ืกื•ืŸ ื—ืคืฆื™ื ื‘ืžื˜ืžื•ืŸ ืฉื”ื•ืจื“ื• ืžื”ืื™ื ื˜ืจื ื˜;

ื—ืคืฆื™ื ื ืชืžื›ื™ื ื‘ื—ื‘ื™ืœืช Sonatype Nexus ื”ื‘ืกื™ืกื™ืช:

  • Java, Maven (ืฆื ืฆื ืช)
  • ืกึทื•ึธืจ
  • Python (pip)
  • ืจื•ื‘ื™ (ืคื ื™ื ื”)
  • NPM
  • ื‘ึตึผื™ืช ืงึทื™ึดื˜
  • ื™ืื (ืกืœ"ื“)
  • gitlfs
  • ื—ื™
  • Apt (ื“ื‘)
  • Go
  • ื ืื’ื˜

ื—ืคืฆื™ื ื ืชืžื›ื™ื ืขืœ ื™ื“ื™ ืงื”ื™ืœื”:

  • ืžืœื—ื™ืŸ
  • ืงื•ื ืืŸ
  • CPAN
  • ELPA
  • ื”ื’ื”
  • P2
  • R

ื”ืชืงื ืช Sonatype Nexus ื‘ืืžืฆืขื•ืช https://github.com/ansible-ThoTeam/nexus3-oss

ื“ืจื™ืฉื•ืช

  • ืงืจืื• ืขืœ ืฉื™ืžื•ืฉ ื‘- ansible ื‘ืื™ื ื˜ืจื ื˜.
  • ื”ืชืงืŸ ืื ืกื™ื‘ืœ pip install ansible ื‘ืชื—ื ืช ื”ืขื‘ื•ื“ื” ืฉื‘ื” ืคื•ืขืœ ืกืคืจ ื”ืžืฉื—ืงื™ื.
  • ืœื”ืชืงื™ืŸ geerlingguy.java ื‘ืชื—ื ืช ื”ืขื‘ื•ื“ื” ืฉื‘ื” ืคื•ืขืœ ืกืคืจ ื”ืžืฉื—ืงื™ื.
  • ืœื”ืชืงื™ืŸ geerlingguy.apache ื‘ืชื—ื ืช ื”ืขื‘ื•ื“ื” ืฉื‘ื” ืคื•ืขืœ ืกืคืจ ื”ืžืฉื—ืงื™ื.
  • ืชืคืงื™ื“ ื–ื” ื ื‘ื“ืง ื‘-CentOS 7, ืื•ื‘ื•ื ื˜ื• Xenial (16.04) ื•ื‘-Bionic (18.04), ื“ื‘ื™ืืŸ ื’'ืกื™ ื•-Stretch
  • jmespath ื”ืกืคืจื™ื™ื” ื—ื™ื™ื‘ืช ืœื”ื™ื•ืช ืžื•ืชืงื ืช ื‘ืชื—ื ืช ื”ืขื‘ื•ื“ื” ืฉื‘ื” ืคื•ืขืœ ืกืคืจ ื”ื”ืคืขืœื”. ืœื”ืชืงื™ืŸ: sudo pip install -r requirements.txt
  • ืฉืžื•ืจ ืืช ืงื•ื‘ืฅ ื”-Playbook (ื“ื•ื’ืžื” ืœืžื˜ื”) ื‘ืงื•ื‘ืฅ nexus.yml
  • ื”ืคืขืœ ืืช ื”ืชืงื ืช nexus ansible-playbook -i host nexus.yml

ื“ื•ื’ืžื” ืœ- ansible-playbook ืœื”ืชืงื ืช nexus ืœืœื LDAP ืขื ืžืื’ืจื™ Maven (Java), Docker, Python, Ruby, NPM, Bower, RPM ื•-gitlfs.

---
- name: Nexus
  hosts: nexus
  become: yes

  vars:
    nexus_timezone: 'Asia/Omsk'
    nexus_admin_password: "admin123"
    nexus_public_hostname: 'apatsev-nexus-playbook'
    httpd_setup_enable: false
    nexus_privileges:
      - name: all-repos-read
        description: 'Read & Browse access to all repos'
        repository: '*'
        actions:
          - read
          - browse
      - name: company-project-deploy
        description: 'Deployments to company-project'
        repository: company-project
        actions:
          - add
          - edit
    nexus_roles:
      - id: Developpers # maps to the LDAP group
        name: developers
        description: All developers
        privileges:
          - nx-search-read
          - all-repos-read
          - company-project-deploy
        roles: []
    nexus_local_users:
      - username: jenkins # used as key to update
        first_name: Jenkins
        last_name: CI
        email: [email protected]
        password: "s3cr3t"
        roles:
          - Developpers # role ID here
    nexus_blobstores:
      - name: company-artifacts
        path: /var/nexus/blobs/company-artifacts
    nexus_scheduled_tasks:
      - name: compact-blobstore
        cron: '0 0 22 * * ?'
        typeId: blobstore.compact
        taskProperties:
          blobstoreName: 'company-artifacts'

    nexus_repos_maven_proxy:
      - name: central
        remote_url: 'https://repo1.maven.org/maven2/'
        layout_policy: permissive
      - name: jboss
        remote_url: 'https://repository.jboss.org/nexus/content/groups/public-jboss/'
      - name: vaadin-addons
        remote_url: 'https://maven.vaadin.com/vaadin-addons/'
      - name: jaspersoft
        remote_url: 'https://jaspersoft.artifactoryonline.com/jaspersoft/jaspersoft-repo/'
        version_policy: mixed
    nexus_repos_maven_hosted:
      - name: company-project
        version_policy: mixed
        write_policy: allow
        blob_store: company-artifacts
    nexus_repos_maven_group:
      - name: public
        member_repos:
          - central
          - jboss
          - vaadin-addons
          - jaspersoft

    # Yum. Change nexus_config_yum to true for create yum repository
    nexus_config_yum: true
    nexus_repos_yum_hosted:
      - name: private_yum_centos_7
        repodata_depth: 1
    nexus_repos_yum_proxy:
      - name: epel_centos_7_x86_64
        remote_url: http://download.fedoraproject.org/pub/epel/7/x86_64
        maximum_component_age: -1
        maximum_metadata_age: -1
        negative_cache_ttl: 60
      - name: centos-7-os-x86_64
        remote_url: http://mirror.centos.org/centos/7/os/x86_64/
        maximum_component_age: -1
        maximum_metadata_age: -1
        negative_cache_ttl: 60
    nexus_repos_yum_group:
      - name: yum_all
        member_repos:
          - private_yum_centos_7
          - epel_centos_7_x86_64

    # NPM. Change nexus_config_npm to true for create npm repository
    nexus_config_npm: true
    nexus_repos_npm_hosted: []
    nexus_repos_npm_group:
      - name: npm-public
        member_repos:
          - npm-registry
    nexus_repos_npm_proxy:
      - name: npm-registry
        remote_url: https://registry.npmjs.org/
        negative_cache_enabled: false

    # Docker. Change nexus_config_docker to true for create docker repository
    nexus_config_docker: true
    nexus_repos_docker_hosted:
      - name: docker-hosted
        http_port: "{{ nexus_docker_hosted_port }}"
        v1_enabled: True
    nexus_repos_docker_proxy:
      - name: docker-proxy
        http_port: "{{ nexus_docker_proxy_port }}"
        v1_enabled: True
        index_type: "HUB"
        remote_url: "https://registry-1.docker.io"
        use_nexus_certificates_to_access_index: false
        maximum_component_age: 1440
        maximum_metadata_age: 1440
        negative_cache_enabled: true
        negative_cache_ttl: 1440
    nexus_repos_docker_group:
      - name: docker-group
        http_port: "{{ nexus_docker_group_port }}"
        v1_enabled: True
        member_repos:
          - docker-hosted
          - docker-proxy

    # Bower. Change nexus_config_bower to true for create bower repository
    nexus_config_bower: true
    nexus_repos_bower_hosted:
      - name: bower-hosted
    nexus_repos_bower_proxy:
      - name: bower-proxy
        index_type: "proxy"
        remote_url: "https://registry.bower.io"
        use_nexus_certificates_to_access_index: false
        maximum_component_age: 1440
        maximum_metadata_age: 1440
        negative_cache_enabled: true
        negative_cache_ttl: 1440
    nexus_repos_bower_group:
      - name: bower-group
        member_repos:
          - bower-hosted
          - bower-proxy

    # Pypi. Change nexus_config_pypi to true for create pypi repository
    nexus_config_pypi: true
    nexus_repos_pypi_hosted:
      - name: pypi-hosted
    nexus_repos_pypi_proxy:
      - name: pypi-proxy
        index_type: "proxy"
        remote_url: "https://pypi.org/"
        use_nexus_certificates_to_access_index: false
        maximum_component_age: 1440
        maximum_metadata_age: 1440
        negative_cache_enabled: true
        negative_cache_ttl: 1440
    nexus_repos_pypi_group:
      - name: pypi-group
        member_repos:
          - pypi-hosted
          - pypi-proxy

    # rubygems. Change nexus_config_rubygems to true for create rubygems repository
    nexus_config_rubygems: true
    nexus_repos_rubygems_hosted:
      - name: rubygems-hosted
    nexus_repos_rubygems_proxy:
      - name: rubygems-proxy
        index_type: "proxy"
        remote_url: "https://rubygems.org"
        use_nexus_certificates_to_access_index: false
        maximum_component_age: 1440
        maximum_metadata_age: 1440
        negative_cache_enabled: true
        negative_cache_ttl: 1440
    nexus_repos_rubygems_group:
      - name: rubygems-group
        member_repos:
          - rubygems-hosted
          - rubygems-proxy

    # gitlfs. Change nexus_config_gitlfs to true for create gitlfs repository
    nexus_config_gitlfs: true
    nexus_repos_gitlfs_hosted:
      - name: gitlfs-hosted

  roles:
    - { role: geerlingguy.java }
    # Debian/Ubuntu only
    # - { role: geerlingguy.apache, apache_create_vhosts: no, apache_mods_enabled: ["proxy_http.load", "headers.load"], apache_remove_default_vhost: true, tags: ["geerlingguy.apache"] }
    # RedHat/CentOS only
    - { role: geerlingguy.apache, apache_create_vhosts: no, apache_remove_default_vhost: true, tags: ["geerlingguy.apache"] }
    - { role: ansible-thoteam.nexus3-oss, tags: ['ansible-thoteam.nexus3-oss'] }

ืฆื™ืœื•ืžื™ ืžืกืš:

ื”ืชืงื ื” ื•ื”ื’ื“ืจื” ืฉืœ Nexus Sonatype ืชื•ืš ืฉื™ืžื•ืฉ ื‘ื’ื™ืฉืช ื”ืชืฉืชื™ืช ื›ืงื•ื“

ื”ืชืงื ื” ื•ื”ื’ื“ืจื” ืฉืœ Nexus Sonatype ืชื•ืš ืฉื™ืžื•ืฉ ื‘ื’ื™ืฉืช ื”ืชืฉืชื™ืช ื›ืงื•ื“

ืชืคืงื™ื“ื™ื ืžืฉืชื ื™ื

ืžืฉืชื ื™ ืชืคืงื™ื“ื™ื

ืžืฉืชื ื™ื ืขื ืขืจื›ื™ ื‘ืจื™ืจืช ืžื—ื“ืœ (ืจืื” default/main.yml):

ืžืฉืชื ื™ื ื›ืœืœื™ื™ื

    nexus_version: ''
    nexus_timezone: 'UTC'

ื›ื‘ืจื™ืจืช ืžื—ื“ืœ, ื”ืชืคืงื™ื“ ื™ืชืงื™ืŸ ืืช ื”ื’ืจืกื” ื”ืื—ืจื•ื ื” ื”ื–ืžื™ื ื” ืฉืœ Nexus. ืืชื” ื™ื›ื•ืœ ืœืชืงืŸ ืืช ื”ื’ืจืกื” ืขืœ ื™ื“ื™ ืฉื™ื ื•ื™ ื”ืžืฉืชื ื” nexus_version. ืจืื” ื’ืจืกืื•ืช ื–ืžื™ื ื•ืช ื‘ https://www.sonatype.com/download-oss-sonatype.

ืื ืชืฉื ื” ืœื’ืจืกื” ื—ื“ืฉื” ื™ื•ืชืจ, ื”ืชืคืงื™ื“ ื™ื ืกื” ืœืขื“ื›ืŸ ืืช ื”ืชืงื ืช ื”-Nexus ืฉืœืš.

ืื ืืชื” ืžืฉืชืžืฉ ื‘ื’ืจืกื” ื™ืฉื ื” ื™ื•ืชืจ ืฉืœ Nexus ืžื”ื’ืจืกื” ื”ืื—ืจื•ื ื”, ืขืœื™ืš ืœื•ื•ื“ื ืฉืื™ื ืš ืžืฉืชืžืฉ ื‘ืชื›ื•ื ื•ืช ืฉืื™ื ืŸ ื–ืžื™ื ื•ืช ื‘ืžื”ื“ื•ืจื” ื”ืžื•ืชืงื ืช (ืœื“ื•ื’ืžื”, ืื™ืจื•ื— ืžืื’ืจื™ yum ื–ืžื™ืŸ ืขื‘ื•ืจ nexus ื’ื“ื•ืœ ืž-3.8.0, git lfs repo ืขื‘ื•ืจ nexus ื’ื“ื•ืœ ืž-3.3.0 ื•ื›ื•')

nexus timezone ื”ื•ื ื”ืฉื ืฉืœ ืื–ื•ืจ ื”ื–ืžืŸ ืฉืœ Java, ืฉื™ื›ื•ืœ ืœื”ื™ื•ืช ืฉื™ืžื•ืฉื™ ื‘ืฉื™ืœื•ื‘ ืขื ื‘ื™ื˜ื•ื™ื™ ื”-cron ื”ื‘ืื™ื ืขื‘ื•ืจ ืžืฉื™ืžื•ืช nexus_scheduled.

ื™ืฆื™ืืช Nexus ื•ื ืชื™ื‘ ื”ืงืฉืจ

    nexus_default_port: 8081
    nexus_default_context_path: '/'

ื”ื™ืฆื™ืื” ื•ื ืชื™ื‘ ื”ื”ืงืฉืจ ืฉืœ ืชื”ืœื™ืš ื—ื™ื‘ื•ืจ Java. nexus_default_context_path ื—ื™ื™ื‘ ืœื”ื›ื™ืœ ืœื•ื›ืกืŸ ืงื“ื™ืžื” ื›ืืฉืจ ื”ื•ื ืžื•ื’ื“ืจ, ืœืžืฉืœ: nexus_default_context_path: '/nexus/'.

ืžืฉืชืžืฉ ื•ืงื‘ื•ืฆื” ืฉืœ Nexus OS

    nexus_os_group: 'nexus'
    nexus_os_user: 'nexus'

ื”ืžืฉืชืžืฉ ื•ื”ืงื‘ื•ืฆื” ื”ืžืฉืžืฉื™ื ืœื‘ืขืœื•ืช ืงื‘ืฆื™ Nexus ื•ืœื”ืคืขื™ืœ ืืช ื”ืฉื™ืจื•ืช ื™ื™ื•ื•ืฆืจื• ืขืœ ื™ื“ื™ ื”ืชืคืงื™ื“ ืื ืื—ื“ ื—ืกืจ.

    nexus_os_user_home_dir: '/home/nexus'

ืืคืฉืจ ืœืฉื ื•ืช ืืช ืกืคืจื™ื™ืช ื”ื‘ื™ืช ื”ืžื•ื’ื“ืจืช ื›ื‘ืจื™ืจืช ืžื—ื“ืœ ืขื‘ื•ืจ ืžืฉืชืžืฉ nexus

ืกืคืจื™ื•ืช ืžื•ืคืขื™ื ืฉืœ Nexus

    nexus_installation_dir: '/opt'
    nexus_data_dir: '/var/nexus'
    nexus_tmp_dir: "{{ (ansible_os_family == 'RedHat') | ternary('/var/nexus-tmp', '/tmp/nexus') }}"

ืงื˜ืœื•ื’ื™ื ืฉืœ Nexus.

  • nexus_installation_dir ืžื›ื™ืœ ืงื‘ืฆื™ ื”ืคืขืœื” ืžื•ืชืงื ื™ื
  • nexus_data_dir ืžื›ื™ืœ ืืช ื›ืœ ื”ืชืฆื•ืจื”, ื”ืžืื’ืจื™ื ื•ื”ื—ืคืฆื™ื ืฉื”ื•ืจื“ืช. ื ืชื™ื‘ื™ื ืžื•ืชืืžื™ื ืื™ืฉื™ืช ืฉืœ blobstore nexus_data_dir ื ื™ืชืŸ ืœื”ืชืื™ื ืื™ืฉื™ืช, ืจืื” ืœื”ืœืŸ nexus_blobstores.
  • nexus_tmp_dir ืžื›ื™ืœ ืืช ื›ืœ ื”ืงื‘ืฆื™ื ื”ื–ืžื ื™ื™ื. ื ืชื™ื‘ ื‘ืจื™ืจืช ื”ืžื—ื“ืœ ืฉืœ redhat ื”ื•ืขื‘ืจ /tmp ื›ื“ื™ ืœื”ืชื’ื‘ืจ ืขืœ ื‘ืขื™ื•ืช ืคื•ื˜ื ืฆื™ืืœื™ื•ืช ืขื ื”ืœื™ื›ื™ ื ื™ืงื•ื™ ืื•ื˜ื•ืžื˜ื™ื™ื. ืจืื” ืžืก' 168.

ื”ื’ื“ืจืช ืฉื™ืžื•ืฉ ื‘ื–ื™ื›ืจื•ืŸ ืฉืœ Nexus JVM

    nexus_min_heap_size: "1200M"
    nexus_max_heap_size: "{{ nexus_min_heap_size }}"
    nexus_max_direct_memory: "2G"

ืืœื• ื”ืŸ ื”ื’ื“ืจื•ืช ื‘ืจื™ืจืช ื”ืžื—ื“ืœ ืขื‘ื•ืจ Nexus. ื ื ืœื ืœืฉื ื•ืช ืขืจื›ื™ื ืืœื• ืื ืœื ืงืจืืช ืกืขื™ืฃ ื–ื™ื›ืจื•ืŸ ื“ืจื™ืฉื•ืช ืžืขืจื›ืช nexus ื•ืœื ืžื‘ื™ื ื™ื ืžื” ื”ื ืขื•ืฉื™ื.

ื›ืื–ื”ืจื” ืฉื ื™ื™ื”, ื”ื ื” ืงื˜ืข ืžื”ืžืกืžืš ืœืขื™ืœ:

ืœื ืžื•ืžืœืฅ ืœื”ื’ื“ื™ืœ ืืช ื–ื™ื›ืจื•ืŸ ืขืจื™ืžืช ื”-JVM ืžืขื‘ืจ ืœืขืจื›ื™ื ื”ืžื•ืžืœืฆื™ื ื‘ื ื™ืกื™ื•ืŸ ืœืฉืคืจ ืืช ื”ื‘ื™ืฆื•ืขื™ื. ื–ื” ืขืฉื•ื™ ืœื”ืฉืคื™ืข ืœืžืขืฉื” ื”ืคื•ืš, ื•ื›ืชื•ืฆืื” ืžื›ืš ืขื‘ื•ื“ื” ืžื™ื•ืชืจืช ืขื‘ื•ืจ ืžืขืจื›ืช ื”ื”ืคืขืœื”.

ืกื™ืกืžืช ืžื ื”ืœ

    nexus_admin_password: 'changeme'

ืกื™ืกืžืช ื—ืฉื‘ื•ืŸ "ืžื ื”ืœ" ืœื”ื’ื“ืจื”. ื–ื” ืขื•ื‘ื“ ืจืง ื‘ื”ืชืงื ืช ื‘ืจื™ืจืช ื”ืžื—ื“ืœ ื”ืจืืฉื•ื ื”. ืื ื ืจืื” [ืฉื ื” ืกื™ืกืžืช ืžื ื”ืœ ืœืื—ืจ ื”ืชืงื ื” ืจืืฉื•ื ื”](# change-admin-password-after-first-install) ืื ื‘ืจืฆื•ื ืš ืœืฉื ื•ืช ืื•ืชื” ืžืื•ื—ืจ ื™ื•ืชืจ ื‘ืืžืฆืขื•ืช ืชืคืงื™ื“.

ืžื•ืžืœืฅ ื‘ื—ื•ื ืœื ืœืื—ืกืŸ ืืช ื”ืกื™ืกืžื” ืฉืœืš ื‘ื˜ืงืกื˜ ื‘ืจื•ืจ ื‘ืกืคืจ ื”ืžืฉื—ืงื™ื, ืืœื ืœื”ืฉืชืžืฉ ื‘[ื”ืฆืคื ืช ื›ืกืคืช ansible] (https://docs.ansible.com/ansible/latest/user_guide/vault.html) (ื‘ื™ืŸ ืื ื‘ืฉื•ืจื” ืื• ื‘ืงื•ื‘ืฅ ื ืคืจื“ ืฉื ื˜ืขืŸ ืขื, ืœืžืฉืœ, include_vars)

ื’ื™ืฉื” ืื ื•ื ื™ืžื™ืช ื›ื‘ืจื™ืจืช ืžื—ื“ืœ

    nexus_anonymous_access: false

ื’ื™ืฉื” ืื ื•ื ื™ืžื™ืช ืžื•ืฉื‘ืชืช ื›ื‘ืจื™ืจืช ืžื—ื“ืœ. ืงืจื ืขื•ื“ ืขืœ ื’ื™ืฉื” ืื ื•ื ื™ืžื™ืช.

ืฉื ืžืืจื— ืฆื™ื‘ื•ืจื™

    nexus_public_hostname: 'nexus.vm'
    nexus_public_scheme: https

ืฉื ื”ื“ื•ืžื™ื™ืŸ ื•ื”ืกื›ื™ืžื” ื”ืžืœืื” (https ืื• http) ืฉืœืคื™ื”ื ืžื•ืคืข ื”-Nexus ื™ื”ื™ื” ื–ืžื™ืŸ ืœืœืงื•ื—ื•ืชื™ื•.

ื’ื™ืฉืช API ืขื‘ื•ืจ ืชืคืงื™ื“ ื–ื”

    nexus_api_hostname: localhost
    nexus_api_scheme: http
    nexus_api_validate_certs: "{{ nexus_api_scheme == 'https' }}"
    nexus_api_context_path: "{{ nexus_default_context_path }}"
    nexus_api_port: "{{ nexus_default_port }}"

ืžืฉืชื ื™ื ืืœื” ืฉื•ืœื˜ื™ื ื›ื™ืฆื“ ื”ืชืคืงื™ื“ ืžืชื—ื‘ืจ ืœ-Nexus API ืœืฆื•ืจืš ื”ืงืฆืื”.
ืœืžืฉืชืžืฉื™ื ืžืชืงื“ืžื™ื ื‘ืœื‘ื“. ืืชื” ื›ื ืจืื” ืœื ืจื•ืฆื” ืœืฉื ื•ืช ืืช ื”ื’ื“ืจื•ืช ื‘ืจื™ืจืช ื”ืžื—ื“ืœ ื”ืืœื”

ื”ื’ื“ืจืช ืคืจื•ืงืกื™ ื”ืคื•ืš

    httpd_setup_enable: false
    httpd_server_name: "{{ nexus_public_hostname }}"
    httpd_default_admin_email: "[email protected]"
    httpd_ssl_certificate_file: 'files/nexus.vm.crt'
    httpd_ssl_certificate_key_file: 'files/nexus.vm.key'
    # httpd_ssl_certificate_chain_file: "{{ httpd_ssl_certificate_file }}"
    httpd_copy_ssl_files: true

ืœื”ืชืงื™ืŸ ืคืจื•ืงืกื™ ื”ืคื•ืš SSL.
ืœืฉื ื›ืš ืขืœื™ืš ืœื”ืชืงื™ืŸ httpd. ื”ืขืจื”: ืžืชื™ ืขื‘ื•ืจ httpd_setup_enable ื”ื’ื“ืจ ืขืจืštrue, ืงืฉืจื™ ืงืฉืจ 127.0.0.1:8081, ืœืคื™ื›ืš ืœื ื ื’ื™ืฉ ื™ืฉื™ืจื•ืช ื“ืจืš ื™ืฆื™ืืช HTTP 8081 ืžื›ืชื•ื‘ืช ื”-IP ื”ื—ื™ืฆื•ื ื™ืช.

ื‘ืจื™ืจืช ื”ืžื—ื“ืœ ืฉืœ ืฉื ื”ืžืืจื— ื‘ืฉื™ืžื•ืฉ ื”ื•ื nexus_public_hostname. ืื ืืชื” ืฆืจื™ืš ืฉืžื•ืช ืฉื•ื ื™ื ืžืกื™ื‘ื” ื›ืœืฉื”ื™, ืืชื” ื™ื›ื•ืœ ืœื”ื’ื“ื™ืจ httpd_server_name ืขื ืžืฉืžืขื•ืช ืื—ืจืช.

ะก httpd_copy_ssl_files: true (ื›ื‘ืจื™ืจืช ืžื—ื“ืœ) ื”ืื™ืฉื•ืจื™ื ืฉืœืขื™ืœ ืฆืจื™ื›ื™ื ืœื”ืชืงื™ื™ื ื‘ืกืคืจื™ื™ืช ื”-Playbook ืฉืœืš ื•ื™ื•ืขืชืงื• ืœืฉืจืช ื•ื™ื•ื’ื“ืจื• ื‘-apache.

ืื ื‘ืจืฆื•ื ืš ืœื”ืฉืชืžืฉ ื‘ืชืขื•ื“ื•ืช ืงื™ื™ืžื•ืช ื‘ืฉืจืช, ื”ืชืงืŸ httpd_copy_ssl_files: false ื•ืกืคืง ืืช ื”ืžืฉืชื ื™ื ื”ื‘ืื™ื:

    # These specifies to the vhost where to find on the remote server file
    # system the certificate files.
    httpd_ssl_cert_file_location: "/etc/pki/tls/certs/wildcard.vm.crt"
    httpd_ssl_cert_key_location: "/etc/pki/tls/private/wildcard.vm.key"
    # httpd_ssl_cert_chain_file_location: "{{ httpd_ssl_cert_file_location }}"

httpd_ssl_cert_chain_file_location ื”ื•ื ืื•ืคืฆื™ื•ื ืœื™ ื•ื™ืฉ ืœื ืœื”ื’ื“ื™ืจ ืื•ืชื• ืื ืื™ื ืš ืจื•ืฆื” ืœื”ืชืื™ื ืื™ืฉื™ืช ืืช ืงื•ื‘ืฅ ื”ืฉืจืฉืจืช

    httpd_default_admin_email: "[email protected]"

ื”ื’ื“ืจ ื›ืชื•ื‘ืช ื“ื•ื"ืœ ืœืžื ื”ืœ ื‘ืจื™ืจืช ืžื—ื“ืœ

ืชืฆื•ืจืช LDAP

ื—ื™ื‘ื•ืจื™ LDAP ื•ืชื—ื•ื ื”ืื‘ื˜ื—ื” ืžื•ืฉื‘ืชื™ื ื›ื‘ืจื™ืจืช ืžื—ื“ืœ

    nexus_ldap_realm: false
    ldap_connections: []

ื—ื™ื‘ื•ืจื™ LDAP, ื›ืœ ืจื›ื™ื‘ ื ืจืื” ื›ืš:

    nexus_ldap_realm: true
    ldap_connections:
      - ldap_name: 'My Company LDAP' # used as a key to update the ldap config
        ldap_protocol: 'ldaps' # ldap or ldaps
        ldap_hostname: 'ldap.mycompany.com'
        ldap_port: 636
        ldap_use_trust_store: false # Wether or not to use certs in the nexus trust store
        ldap_search_base: 'dc=mycompany,dc=net'
        ldap_auth: 'none' # or simple
        ldap_auth_username: 'username' # if auth = simple
        ldap_auth_password: 'password' # if auth = simple
        ldap_user_base_dn: 'ou=users'
        ldap_user_filter: '(cn=*)' # (optional)
        ldap_user_object_class: 'inetOrgPerson'
        ldap_user_id_attribute: 'uid'
        ldap_user_real_name_attribute: 'cn'
        ldap_user_email_attribute: 'mail'
        ldap_user_subtree: false
        ldap_map_groups_as_roles: false
        ldap_group_base_dn: 'ou=groups'
        ldap_group_object_class: 'posixGroup'
        ldap_group_id_attribute: 'cn'
        ldap_group_member_attribute: 'memberUid'
        ldap_group_member_format: '${username}'
        ldap_group_subtree: false

ื“ื•ื’ืžื” ืœืชืฆื•ืจืช LDAP ืขื‘ื•ืจ ืื™ืžื•ืช ืื ื•ื ื™ืžื™ (ื›ืจื™ื›ื” ืื ื•ื ื™ืžื™ืช), ื–ื• ื’ื ืชืฆื•ืจื” "ืžื™ื ื™ืžืœื™ืช":

    nexus_ldap_realm: true
    ldap_connection:
      - ldap_name: 'Simplest LDAP config'
        ldap_protocol: 'ldaps'
        ldap_hostname: 'annuaire.mycompany.com'
        ldap_search_base: 'dc=mycompany,dc=net'
        ldap_port: 636
        ldap_use_trust_store: false
        ldap_user_id_attribute: 'uid'
        ldap_user_real_name_attribute: 'cn'
        ldap_user_email_attribute: 'mail'
        ldap_user_object_class: 'inetOrgPerson'

ื“ื•ื’ืžื” ืœืชืฆื•ืจืช LDAP ืขื‘ื•ืจ ืื™ืžื•ืช ืคืฉื•ื˜ (ื‘ืืžืฆืขื•ืช ื—ืฉื‘ื•ืŸ DSA):

    nexus_ldap_realm: true
    ldap_connections:
      - ldap_name: 'LDAP config with DSA'
        ldap_protocol: 'ldaps'
        ldap_hostname: 'annuaire.mycompany.com'
        ldap_port: 636
        ldap_use_trust_store: false
        ldap_auth: 'simple'
        ldap_auth_username: 'cn=mynexus,ou=dsa,dc=mycompany,dc=net'
        ldap_auth_password: "{{ vault_ldap_dsa_password }}" # better keep passwords in an ansible vault
        ldap_search_base: 'dc=mycompany,dc=net'
        ldap_user_base_dn: 'ou=users'
        ldap_user_object_class: 'inetOrgPerson'
        ldap_user_id_attribute: 'uid'
        ldap_user_real_name_attribute: 'cn'
        ldap_user_email_attribute: 'mail'
        ldap_user_subtree: false

ื“ื•ื’ืžื” ืœืชืฆื•ืจืช LDAP ืขื‘ื•ืจ ืื™ืžื•ืช ืคืฉื•ื˜ (ื‘ืืžืฆืขื•ืช ื—ืฉื‘ื•ืŸ DSA) + ืงื‘ื•ืฆื•ืช ืžืžื•ืคื” ื›ืชืคืงื™ื“ื™ื:

    nexus_ldap_realm: true
    ldap_connections
      - ldap_name: 'LDAP config with DSA'
        ldap_protocol: 'ldaps'
        ldap_hostname: 'annuaire.mycompany.com'
        ldap_port: 636
        ldap_use_trust_store: false
        ldap_auth: 'simple'
        ldap_auth_username: 'cn=mynexus,ou=dsa,dc=mycompany,dc=net'
        ldap_auth_password: "{{ vault_ldap_dsa_password }}" # better keep passwords in an ansible vault
        ldap_search_base: 'dc=mycompany,dc=net'
        ldap_user_base_dn: 'ou=users'
        ldap_user_object_class: 'inetOrgPerson'
        ldap_user_id_attribute: 'uid'
        ldap_user_real_name_attribute: 'cn'
        ldap_user_email_attribute: 'mail'
        ldap_map_groups_as_roles: true
        ldap_group_base_dn: 'ou=groups'
        ldap_group_object_class: 'groupOfNames'
        ldap_group_id_attribute: 'cn'
        ldap_group_member_attribute: 'member'
        ldap_group_member_format: 'uid=${username},ou=users,dc=mycompany,dc=net'
        ldap_group_subtree: false

ื“ื•ื’ืžื” ืœืชืฆื•ืจืช LDAP ืขื‘ื•ืจ ืื™ืžื•ืช ืคืฉื•ื˜ (ื‘ืืžืฆืขื•ืช ื—ืฉื‘ื•ืŸ DSA) + ืงื‘ื•ืฆื•ืช ื”ืžืžื•ืคื•ืช ื‘ืื•ืคืŸ ื“ื™ื ืžื™ ื›ืชืคืงื™ื“ื™ื:

    nexus_ldap_realm: true
    ldap_connections:
      - ldap_name: 'LDAP config with DSA'
        ldap_protocol: 'ldaps'
        ldap_hostname: 'annuaire.mycompany.com'
        ldap_port: 636
        ldap_use_trust_store: false
        ldap_auth: 'simple'
        ldap_auth_username: 'cn=mynexus,ou=dsa,dc=mycompany,dc=net'
        ldap_auth_password: "{{ vault_ldap_dsa_password }}" # better keep passwords in an ansible vault
        ldap_search_base: 'dc=mycompany,dc=net'
        ldap_user_base_dn: 'ou=users'
        ldap_user_object_class: 'inetOrgPerson'
        ldap_user_id_attribute: 'uid'
        ldap_user_real_name_attribute: 'cn'
        ldap_user_email_attribute: 'mail'
        ldap_map_groups_as_roles: true
        ldap_map_groups_as_roles_type: 'dynamic'
        ldap_user_memberof_attribute: 'memberOf'

ื–ึฐื›ื•ึผืช

    nexus_privileges:
      - name: all-repos-read # used as key to update a privilege
        # type: <one of application, repository-admin, repository-content-selector, repository-view, script or wildcard>
        description: 'Read & Browse access to all repos'
        repository: '*'
        actions: # can be add, browse, create, delete, edit, read or  * (all)
          - read
          - browse
        # pattern: pattern
        # domain: domain
        # script_name: name

ืจืฉื™ืžื” ื”ืจืฉืื•ืช ืœื”ื’ื“ืจื•ืช. ืขื™ื™ืŸ ื‘ืชื™ืขื•ื“ ื•ื‘-GUI ื›ื“ื™ ืœื‘ื“ื•ืง ืื™ืœื• ืžืฉืชื ื™ื ื™ืฉ ืœื”ื’ื“ื™ืจ ื‘ื”ืชืื ืœืกื•ื’ ื”ื”ืจืฉืื”.

ืืœืžื ื˜ื™ื ืืœื” ืžืฉื•ืœื‘ื™ื ืขื ืขืจื›ื™ ื‘ืจื™ืจืช ื”ืžื—ื“ืœ ื”ื‘ืื™ื:

    _nexus_privilege_defaults:
      type: repository-view
      format: maven2
      actions:
        - read

ืชืคืงื™ื“ื™ื (ื‘ืชื•ืš Nexus ื–ื” ืื•ืžืจ)

    nexus_roles:
      - id: Developpers # can map to a LDAP group id, also used as a key to update a role
        name: developers
        description: All developers
        privileges:
          - nx-search-read
          - all-repos-read
        roles: [] # references to other role names

ืจืฉื™ืžื” ืชืคืงื™ื“ื™ื ืœื”ื’ื“ืจื•ืช.

ื—ื‘ืจื™ื

    nexus_local_users: []
      # - username: jenkins # used as key to update
      #   state: present # default value if ommited, use 'absent' to remove user
      #   first_name: Jenkins
      #   last_name: CI
      #   email: [email protected]
      #   password: "s3cr3t"
      #   roles:
      #     - developers # role ID

ืจืฉื™ืžืช ืžืฉืชืžืฉื™ื/ื—ืฉื‘ื•ื ื•ืช ืžืงื•ืžื™ื™ื (ืฉืื™ื ื LDAP) ืœื™ืฆื™ืจื” ื‘-nexus.

ืจืฉื™ืžืช ืžืฉืชืžืฉื™ื/ื—ืฉื‘ื•ื ื•ืช ืžืงื•ืžื™ื™ื (ืฉืื™ื ื LDAP) ืœื™ืฆื™ืจื” ื‘-Nexus.

      nexus_ldap_users: []
      # - username: j.doe
      #   state: present
      #   roles:
      #     - "nx-admin"

ืžื™ืคื•ื™ Ldap ืฉืœ ืžืฉืชืžืฉื™ื/ืชืคืงื™ื“ื™ื. ืžื“ื™ื ื” absent ื™ืกื™ืจ ืชืคืงื™ื“ื™ื ืžืžืฉืชืžืฉ ืงื™ื™ื ืื ื›ื‘ืจ ืงื™ื™ื.
ืžืฉืชืžืฉื™ Ldap ืื™ื ื ื ืžื—ืงื™ื. ื ื™ืกื™ื•ืŸ ืœื”ื’ื“ื™ืจ ืชืคืงื™ื“ ืขื‘ื•ืจ ืžืฉืชืžืฉ ืœื ืงื™ื™ื ื™ื’ืจื•ื ืœืฉื’ื™ืื”.

ื‘ื•ืจืจื™ ืชื•ื›ืŸ

  nexus_content_selectors:
  - name: docker-login
    description: Selector for docker login privilege
    search_expression: format=="docker" and path=~"/v2/"

ืœืžื™ื“ืข ื ื•ืกืฃ ืขืœ ื‘ื•ืจืจ ื”ืชื•ื›ืŸ, ืจืื” ืชื™ืขื•ื“.

ื›ื“ื™ ืœื”ืฉืชืžืฉ ื‘ื‘ื•ืจืจ ื”ืชื•ื›ืŸ, ื”ื•ืกืฃ ื”ืจืฉืื” ื—ื“ืฉื” ืขื type: repository-content-selector ื•ืจืœื•ื•ื ื˜ื™contentSelector

- name: docker-login-privilege
  type: repository-content-selector
  contentSelector: docker-login
  description: 'Login to Docker registry'
  repository: '*'
  actions:
  - read
  - browse

ืžืื’ืจื™ื ื•ืžืื’ืจื™ื

    nexus_delete_default_repos: false

ืžื—ืง ืืช ื”ืžืื’ืจื™ื ืžืชืฆื•ืจืช ื‘ืจื™ืจืช ื”ืžื—ื“ืœ ื”ืจืืฉื•ื ื™ืช ืฉืœ ื”ืชืงื ืช nexus. ืฉืœื‘ ื–ื” ืžื‘ื•ืฆืข ืจืง ื‘ื”ืชืงื ื” ื‘ืคืขื ื”ืจืืฉื•ื ื” (ืžืชื™ nexus_data_dir ื–ื•ื”ื” ืจื™ืง).

ื”ืกืจืช ืžืื’ืจื™ื ืžืชืฆื•ืจืช ื‘ืจื™ืจืช ื”ืžื—ื“ืœ ืขื‘ื•ืจ Nexus. ืฉืœื‘ ื–ื” ืžื‘ื•ืฆืข ืจืง ื‘ืžื”ืœืš ื”ื”ืชืงื ื” ื”ืจืืฉื•ื ื” (ืžืชื™ nexus_data_dir ืจื™ืง).

    nexus_delete_default_blobstore: false

ืžื—ืง ืืช ื‘ืจื™ืจืช ื”ืžื—ื“ืœ blobstore ืžืชืฆื•ืจืช ื‘ืจื™ืจืช ื”ืžื—ื“ืœ ื”ืจืืฉื•ื ื™ืช ืฉืœ ื”ืชืงื ืช nexus. ื–ื” ื™ื›ื•ืœ ืœื”ื™ืขืฉื•ืช ืจืง ืื nexus_delete_default_repos: true ื•ืœื›ืœ ื”ืžืื’ืจื™ื ื”ืžื•ื’ื“ืจื™ื (ืจืื” ืœื”ืœืŸ) ื™ืฉ ืžืคื•ืจืฉ blob_store: custom. ืฉืœื‘ ื–ื” ืžื‘ื•ืฆืข ืจืง ื‘ื”ืชืงื ื” ื‘ืคืขื ื”ืจืืฉื•ื ื” (ืžืชื™ nexus_data_dir ื–ื•ื”ื” ืจื™ืง).

ื”ืกืจืช ืื—ืกื•ืŸ ื‘ืœืื‘ (ื—ืคืฆื™ื ื‘ื™ื ืืจื™ื™ื) ืžื•ืฉื‘ืชืช ื›ื‘ืจื™ืจืช ืžื—ื“ืœ ืžื”ืชืฆื•ืจื” ื”ืจืืฉื•ื ื™ืช. ื›ื“ื™ ืœื”ืกื™ืจ ืื—ืกื•ืŸ ื›ืชืžื™ื (ื—ืคืฆื™ื ื‘ื™ื ืืจื™ื™ื), ื›ื‘ื” nexus_delete_default_repos: true. ืฉืœื‘ ื–ื” ืžื‘ื•ืฆืข ืจืง ื‘ืžื”ืœืš ื”ื”ืชืงื ื” ื”ืจืืฉื•ื ื” (ืžืชื™ nexus_data_dir ืจื™ืง).

    nexus_blobstores: []
    # example blobstore item :
    # - name: separate-storage
    #   type: file
    #   path: /mnt/custom/path
    # - name: s3-blobstore
    #   type: S3
    #   config:
    #     bucket: s3-blobstore
    #     accessKeyId: "{{ VAULT_ENCRYPTED_KEY_ID }}"
    #     secretAccessKey: "{{ VAULT_ENCRYPTED_ACCESS_KEY }}"

ื—ื ื•ื™ื•ืช ื‘ืœื•ื‘ ืœื™ืฆื•ืจ. ืœื ื ื™ืชืŸ ืœืขื“ื›ืŸ ื ืชื™ื‘ blobstore ื•-repository blobstore ืœืื—ืจ ื”ื™ืฆื™ืจื” ื”ืจืืฉื•ื ื™ืช (ื™ืชืขืœื ืžื›ืœ ืขื“ื›ื•ืŸ ื›ืืŸ ื‘ืขืช โ€‹โ€‹ื”ืงืฆืื” ืžื—ื“ืฉ).

ืงื‘ื™ืขืช ื”ืชืฆื•ืจื” ืฉืœ blobstore ื‘-S3 ื ื™ืชื ืช ืžื˜ืขืžื™ ื ื•ื—ื•ืช ื•ืื™ื ื” ื—ืœืง ืžื”ื‘ื“ื™ืงื•ืช ื”ืื•ื˜ื•ืžื˜ื™ื•ืช ืฉืื ื• ืžืจื™ืฆื™ื ื‘-travis. ืฉื™ื ืœื‘ ืฉืื—ืกื•ืŸ ื‘-S3 ืžื•ืžืœืฅ ืจืง ืขื‘ื•ืจ ืžืงืจื™ื ืฉื ืคืจืกื• ื‘-AWS.

ื™ืฆื™ืจื” ื—ื ื•ื™ื•ืช ื‘ืœื•ื‘. ืœื ื ื™ืชืŸ ืœืขื“ื›ืŸ ืืช ื ืชื™ื‘ ื”ืื—ืกื•ืŸ ื•ืžืื’ืจ ื”ืื—ืกื•ืŸ ืœืื—ืจ ื”ื™ืฆื™ืจื” ื”ืจืืฉื•ื ื™ืช (ื›ืœ ืขื“ื›ื•ืŸ ื›ืืŸ ื™ืชืขืœื ื›ืืฉืจ ื™ื•ืชืงืŸ ืฉื•ื‘).

ื”ื’ื“ืจืช ืื—ืกื•ืŸ ื›ืชืžื™ื ื‘-S3 ืžืกื•ืคืงืช ืœื ื•ื—ื™ื•ืชื›ื. ืฉื™ื ืœื‘ ืฉืื—ืกื•ืŸ S3 ืžื•ืžืœืฅ ืจืง ืขื‘ื•ืจ ืžืงืจื™ื ื”ืคืจื•ืกื™ื ื‘-AWS.

    nexus_repos_maven_proxy:
      - name: central
        remote_url: 'https://repo1.maven.org/maven2/'
        layout_policy: permissive
        # maximum_component_age: -1
        # maximum_metadata_age: 1440
        # negative_cache_enabled: true
        # negative_cache_ttl: 1440
      - name: jboss
        remote_url: 'https://repository.jboss.org/nexus/content/groups/public-jboss/'
        # maximum_component_age: -1
        # maximum_metadata_age: 1440
        # negative_cache_enabled: true
        # negative_cache_ttl: 1440
    # example with a login/password :
    # - name: secret-remote-repo
    #   remote_url: 'https://company.com/repo/secure/private/go/away'
    #   remote_username: 'username'
    #   remote_password: 'secret'
    #   # maximum_component_age: -1
    #   # maximum_metadata_age: 1440
    #   # negative_cache_enabled: true
    #   # negative_cache_ttl: 1440

ืœืžืขืœื” ื”ื™ื ืชืฆื•ืจื” ืœื“ื•ื’ืžื” ืฉืจืช ืคืจื•ืงืกื™ ืžื™ื™ื‘ืŸ.

    nexus_repos_maven_hosted:
      - name: private-release
        version_policy: release
        write_policy: allow_once  # one of "allow", "allow_once" or "deny"

Maven ืžืื’ืจื™ื ืžืชืืจื—ื™ื ืชึฐืฆื•ึผืจึธื”. ืชืฆื•ืจืช ืžื˜ืžื•ืŸ ืฉืœื™ืœื™ืช ื”ื™ื ืื•ืคืฆื™ื•ื ืœื™ืช ื•ืชื”ื™ื” ื‘ืจื™ืจืช ื”ืžื—ื“ืœ ืœืขืจื›ื™ื ืฉืœืขื™ืœ ืื ืžื•ืฉืžื˜.

ืชึฐืฆื•ึผืจึธื” ืžืื’ืจื™ื ืžืชืืจื—ื™ื ืžื™ื™ื‘ืŸ. ืชืฆื•ืจืช ื”ืžื˜ืžื•ืŸ ื”ืฉืœื™ืœื™ (-1) ื”ื™ื ืื•ืคืฆื™ื•ื ืœื™ืช ื•ืชื”ื™ื” ื‘ืจื™ืจืช ื”ืžื—ื“ืœ ืœืขืจื›ื™ื ืฉืœืขื™ืœ ืื ืœื ืฆื•ื™ืŸ.

    nexus_repos_maven_group:
      - name: public
        member_repos:
          - central
          - jboss

ืชึฐืฆื•ึผืจึธื” ืงื‘ื•ืฆื•ืช ืžื™ื™ื‘ืŸ.

ื›ืœ ืฉืœื•ืฉืช ืกื•ื’ื™ ื”ืžืื’ืจื™ื ืžืฉื•ืœื‘ื™ื ืขื ืขืจื›ื™ ื‘ืจื™ืจืช ื”ืžื—ื“ืœ ื”ื‘ืื™ื:

    _nexus_repos_maven_defaults:
      blob_store: default # Note : cannot be updated once the repo has been created
      strict_content_validation: true
      version_policy: release # release, snapshot or mixed
      layout_policy: strict # strict or permissive
      write_policy: allow_once # one of "allow", "allow_once" or "deny"
      maximum_component_age: -1  # Nexus gui default. For proxies only
      maximum_metadata_age: 1440  # Nexus gui default. For proxies only
      negative_cache_enabled: true # Nexus gui default. For proxies only
      negative_cache_ttl: 1440 # Nexus gui default. For proxies only

ืกื•ื’ื™ื ืฉืœ Docker, Pypi, Raw, Rubygems, Bower, NPM, Git-LFS ื•-yum:
ืœึดืจึฐืื•ึนืช defaults/main.yml ืขื‘ื•ืจ ืืคืฉืจื•ื™ื•ืช ืืœื”:

ืžืื’ืจื™ Docker, Pypi, Raw, Rubygems, Bower, NPM, Git-LFS ื•-yum ืžื•ืฉื‘ืชื™ื ื›ื‘ืจื™ืจืช ืžื—ื“ืœ:
ืœืจืื•ืช defaults/main.yml ืขื‘ื•ืจ ืืคืฉืจื•ื™ื•ืช ืืœื”:

      nexus_config_pypi: false
      nexus_config_docker: false
      nexus_config_raw: false
      nexus_config_rubygems: false
      nexus_config_bower: false
      nexus_config_npm: false
      nexus_config_gitlfs: false
      nexus_config_yum: false

ืฉื™ื ืœื‘ ืฉื™ื™ืชื›ืŸ ืฉืชืฆื˜ืจืš ืœื”ืคืขื™ืœ ื”ื™ืงืคื™ ืื‘ื˜ื—ื” ืžืกื•ื™ืžื™ื ืื ืืชื” ืจื•ืฆื” ืœื”ืฉืชืžืฉ ื‘ืกื•ื’ื™ื ืื—ืจื™ื ืฉืœ ืžืื’ืจื™ื ืžืœื‘ื“ maven. ื–ื” ืฉืงืจ ื›ื‘ืจื™ืจืช ืžื—ื“ืœ

nexus_nuget_api_key_realm: false
nexus_npm_bearer_token_realm: false
nexus_docker_bearer_token_realm: false  # required for docker anonymous access

ื ื™ืชืŸ ืœื”ืคืขื™ืœ ืืช ืชื—ื•ื ื”ืžืฉืชืžืฉื™ื ื”ืžืจื•ื—ืง ื‘ืืžืฆืขื•ืช

nexus_rut_auth_realm: true

ื•ื ื™ืชืŸ ืœื”ืชืื™ื ืื™ืฉื™ืช ืืช ื”ื›ื•ืชืจืช ืขืœ ื™ื“ื™ ื”ื’ื“ืจื”

nexus_rut_auth_header: "CUSTOM_HEADER"

ืžืฉื™ืžื•ืช ืžืชื•ื–ืžื ื•ืช

    nexus_scheduled_tasks: []
    #  #  Example task to compact blobstore :
    #  - name: compact-docker-blobstore
    #    cron: '0 0 22 * * ?'
    #    typeId: blobstore.compact
    #    task_alert_email: [email protected]  # optional
    #    taskProperties:
    #      blobstoreName: {{ nexus_blob_names.docker.blob }} # all task attributes are stored as strings by nexus internally
    #  #  Example task to purge maven snapshots
    #  - name: Purge-maven-snapshots
    #    cron: '0 50 23 * * ?'
    #    typeId: repository.maven.remove-snapshots
    #    task_alert_email: [email protected]  # optional
    #    taskProperties:
    #      repositoryName: "*"  # * for all repos. Change to a repository name if you only want a specific one
    #      minimumRetained: "2"
    #      snapshotRetentionDays: "2"
    #      gracePeriodInDays: "2"
    #    booleanTaskProperties:
    #      removeIfReleased: true
    #  #  Example task to purge unused docker manifest and images
    #  - name: Purge unused docker manifests and images
    #    cron: '0 55 23 * * ?'
    #    typeId: "repository.docker.gc"
    #    task_alert_email: [email protected]  # optional
    #    taskProperties:
    #      repositoryName: "*"  # * for all repos. Change to a repository name if you only want a specific one
    #  #  Example task to purge incomplete docker uploads
    #  - name: Purge incomplete docker uploads
    #    cron: '0 0 0 * * ?'
    #    typeId: "repository.docker.upload-purge"
    #    task_alert_email: [email protected]  # optional
    #    taskProperties:
    #      age: "24"

ืžืฉื™ืžื•ืช ืžืชื•ื–ืžื ื•ืช ืœื”ื’ื“ืจื•ืช. typeId ื•ืกืคืฆื™ืคื™ืช ืœืžืฉื™ืžื”taskProperties/booleanTaskProperties ืืชื” ื™ื›ื•ืœ ืœื ื—ืฉ ืื•:

  • ืžื”ื™ืจืจื›ื™ื™ืช ืกื•ื’ื™ Java org.sonatype.nexus.scheduling.TaskDescriptorSupport
  • ื‘ื“ื™ืงืช ื˜ื•ืคืก ื™ืฆื™ืจืช ืžืฉื™ืžื•ืช HTML ื‘ื“ืคื“ืคืŸ ืฉืœืš
  • ืžืฆืคื™ื™ื” ื‘ื‘ืงืฉื•ืช AJAX ื‘ื“ืคื“ืคืŸ ื‘ืขืช โ€‹โ€‹ื”ื’ื“ืจื” ื™ื“ื ื™ืช ืฉืœ ืžืฉื™ืžื”.

ื™ืฉ ืœื”ืฆื”ื™ืจ ืขืœ ืžืืคื™ื™ื ื™ ื”ืžืฉื™ืžื” ื‘ื‘ืœื•ืง yaml ื”ื ื›ื•ืŸ ื‘ื”ืชืื ืœืกื•ื’ ืฉืœื”ื:

  • taskProperties ืขื‘ื•ืจ ื›ืœ ืžืืคื™ื™ื ื™ ื”ืžื—ืจื•ื–ืช (ื›ืœื•ืžืจ ืฉืžื•ืช ืžืื’ืจ, ืฉืžื•ืช ืžืื’ืจ, ืคืจืงื™ ื–ืžืŸ...).
  • booleanTaskProperties ืขื‘ื•ืจ ื›ืœ ื”ืžืืคื™ื™ื ื™ื ื”ืœื•ื’ื™ื™ื (ื›ืœื•ืžืจ, ื‘ืขื™ืงืจ ืชื™ื‘ื•ืช ืกื™ืžื•ืŸ ื‘-GUI ืฉืœ ืžืฉื™ืžืช ื™ืฆื™ืจืช ื”ืงืฉืจ).

ื’ื™ื‘ื•ื™ื™ื

      nexus_backup_configure: false
      nexus_backup_cron: '0 0 21 * * ?'  # See cron expressions definition in nexus create task gui
      nexus_backup_dir: '/var/nexus-backup'
      nexus_restore_log: '{{ nexus_backup_dir }}/nexus-restore.log'
      nexus_backup_rotate: false
      nexus_backup_rotate_first: false
      nexus_backup_keep_rotations: 4  # Keep 4 backup rotation by default (current + last 3)

ื’ื™ื‘ื•ื™ ืœื ื™ื•ื’ื“ืจ ืขื“ ืฉืชื—ืœื™ืฃ nexus_backup_configure ะฒ true.
ื‘ืžืงืจื” ื–ื”, ืžืฉื™ืžืช ื”ืกืงืจื™ืคื˜ ื”ืžืชื•ื–ืžื ืช ืชื•ื’ื“ืจ ืœื”ืคืขืœื” ื‘-Nexus
ื‘ืžืจื•ื•ื— ืฉืฆื•ื™ืŸ ื‘ nexus_backup_cron (ื‘ืจื™ืจืช ืžื—ื“ืœ 21:00 ื›ืœ ื™ื•ื).
ืจืื” [ืชื‘ื ื™ืช ื’ืจื•ื‘ื™ ืœืžืฉื™ืžื” ื–ื•](templates/backup.groovy.j2) ืœืคืจื˜ื™ื.
ืžืฉื™ืžื” ืžืชื•ื–ืžื ืช ื–ื• ืื™ื ื” ืชืœื•ื™ื” ื‘ืื—ืจื™ื nexus_scheduled_tasksืืฉืจ ืืชื”
ื”ื›ืจื™ื– ื‘ืกืคืจ ื”ืžืฉื—ืงื™ื ืฉืœืš.

ืื ื‘ืจืฆื•ื ืš ืœืกื•ื‘ื‘/ืœืžื—ื•ืง ื’ื™ื‘ื•ื™ื™ื, ื”ืชืงืŸ nexus_backup_rotate: true ื•ืœื”ื’ื“ื™ืจ ืืช ืžืกืคืจ ื”ื’ื™ื‘ื•ื™ื™ื ืฉื‘ื”ื ืชืจืฆื” ืœืฉืžื•ืจ ื‘ืืžืฆืขื•ืชื nexus_backup_keep_rotations (ื‘ืจื™ืจืช ืžื—ื“ืœ 4).

ื‘ืขืช ืฉื™ืžื•ืฉ ื‘ืกื™ื‘ื•ื‘, ืื ื‘ืจืฆื•ื ืš ืœื—ืกื•ืš ืฉื˜ื— ื“ื™ืกืง ื ื•ืกืฃ ื‘ืžื”ืœืš ืชื”ืœื™ืš ื”ื’ื™ื‘ื•ื™,
ืืชื” ื™ื›ื•ืœ ืœื”ืชืงื™ืŸ nexus_backup_rotate_first: true. ืคืขื•ืœื” ื–ื• ืชื’ื“ื™ืจ ืกื™ื‘ื•ื‘/ืžื—ื™ืงื” ืžืจืืฉ ืœืคื ื™ ื”ื’ื™ื‘ื•ื™. ื›ื‘ืจื™ืจืช ืžื—ื“ืœ, ื”ืกื™ื‘ื•ื‘ ืžืชืจื—ืฉ ืœืื—ืจ ื™ืฆื™ืจืช ื’ื™ื‘ื•ื™. ืฉื™ืžื• ืœื‘ ืฉื‘ืžืงืจื” ื–ื” ื”ื’ื™ื‘ื•ื™ื™ื ื”ื™ืฉื ื™ื
ื™ื™ืžื—ืง ืœืคื ื™ ื‘ื™ืฆื•ืข ื”ื’ื™ื‘ื•ื™ ื”ื ื•ื›ื—ื™.

ื”ืœื™ืš ื”ื—ืœืžื”

ื”ืคืขืœ ืืช ืกืคืจ ื”ืžืฉื—ืงื™ื ืขื ืคืจืžื˜ืจ -e nexus_restore_point=<YYYY-MM-dd-HH-mm-ss>
(ืœื“ื•ื’ืžื”, 2017-12-17-21-00-00 ืขื‘ื•ืจ 17 ื‘ื“ืฆืžื‘ืจ 2017 ื‘ืฉืขื” 21:00

ื”ืกืจืช ืงืฉืจ

ืื–ื”ืจื”: ืคืขื•ืœื” ื–ื• ืชืžื—ืง ืœื—ืœื•ื˜ื™ืŸ ืืช ื”ื ืชื•ื ื™ื ื”ื ื•ื›ื—ื™ื™ื ืฉืœืš. ื”ืงืคื“ ืœื‘ืฆืข ื’ื™ื‘ื•ื™ ืžื•ืงื“ื ื™ื•ืชืจ ื‘ืžื™ื“ืช ื”ืฆื•ืจืš

ื”ืฉืชืžืฉ ื‘ืžืฉืชื ื” nexus_purgeืื ืืชื” ืฆืจื™ืš ืœื”ืคืขื™ืœ ืžื—ื“ืฉ ืžืืคืก ื•ืœื”ืชืงื™ืŸ ืžื—ื“ืฉ ืืช ืžื•ืคืข ื”-nexus ืขื ื›ืœ ื”ื ืชื•ื ื™ื ืฉื”ื•ืกืจื•.

ansible-playbook -i your/inventory.ini your_nexus_playbook.yml -e nexus_purge=true

ืฉื ื” ืืช ืกื™ืกืžืช ื”ืžื ื”ืœ ืœืื—ืจ ื”ื”ืชืงื ื” ื”ืจืืฉื•ื ื”

    nexus_default_admin_password: 'admin123'

ืื™ืŸ ืœืฉื ื•ืช ื–ืืช ื‘ืกืคืจ ื”ืžืฉื—ืงื™ื ืฉืœืš. ืžืฉืชื ื” ื–ื” ืžืื•ื›ืœืก ื‘ืกื™ืกืžืช ืžื ื”ืœ ื‘ืจื™ืจืช ื”ืžื—ื“ืœ ืฉืœ Nexus ื‘ืขืช ื”ื”ืชืงื ื” ื”ืจืืฉื•ื ื” ื•ืžื‘ื˜ื™ื— ืฉื ื•ื›ืœ ืœืฉื ื•ืช ืืช ืกื™ืกืžืช ื”ืžื ื”ืœ ืœ- nexus_admin_password.

ืื ื‘ืจืฆื•ื ืš ืœืฉื ื•ืช ืืช ืกื™ืกืžืช ื”ืžื ื”ืœ ืœืื—ืจ ื”ื”ืชืงื ื” ื”ืจืืฉื•ื ื”, ืชื•ื›ืœ ืœืฉื ื•ืช ืื•ืชื” ื‘ืื•ืคืŸ ื–ืžื ื™ ืœืกื™ืกืžื” ื”ื™ืฉื ื” ืžืฉื•ืจืช ื”ืคืงื•ื“ื”. ืœืื—ืจ ืฉื™ื ื•ื™ nexus_admin_password ื‘ืกืคืจ ื”ืžืฉื—ืงื™ื ืฉืœืš ืืชื” ื™ื›ื•ืœ ืœื”ืจื™ืฅ:

ansible-playbook -i your/inventory.ini your_playbook.yml -e nexus_default_admin_password=oldPassword

ืขืจื•ืฅ ื˜ืœื’ืจื ื‘-Nexus Sonatype: https://t.me/ru_nexus_sonatype

ืจืง ืžืฉืชืžืฉื™ื ืจืฉื•ืžื™ื ื™ื›ื•ืœื™ื ืœื”ืฉืชืชืฃ ื‘ืกืงืจ. ืœื”ืชื—ื‘ืจื‘ื‘ืงืฉื”.

ื‘ืื™ืœื• ืžืื’ืจื™ ื—ืคืฆื™ื ืืชื” ืžืฉืชืžืฉ?

  • Sonatype Nexus ื”ื•ื ื‘ื—ื™ื ื

  • Sonatype Nexus ื‘ืชืฉืœื•ื

  • Artifactory ื‘ื—ื™ื ื

  • Artifactory ืฉื™ืœื

  • ื ืžืœ

  • ืฆื™ืคื”

9 ืžืฉืชืžืฉื™ื ื”ืฆื‘ื™ืขื•. 3 ืžืฉืชืžืฉื™ื ื ืžื ืขื•.

ืžืงื•ืจ: www.habr.com

ื”ื•ืกืคืช ืชื’ื•ื‘ื”