ื™ื ืกื˜ืึธืœื™ื ื’ ืื•ืŸ ืงืึทื ืคื™ื’ื™ืขืจ ื ืขืงืกื•ืก ืกืึธื ืึทื˜ื™ืคึผืข ื ื™ืฆืŸ ื“ื™ ื™ื ืคืจืึทืกื˜ืจืึทืงื˜ืฉืขืจ ื•ื•ื™ ืงืึธื“ ืฆื•ื’ืึทื ื’

Sonatype Nexus ืื™ื– ืึทืŸ ื™ื ืึทื’ืจื™ื™ื˜ื™ื“ ืคึผืœืึทื˜ืคืึธืจืžืข ื“ื•ืจืš ื•ื•ืึธืก ื“ืขื•ื•ืขืœืึธืคึผืขืจืก ืงืขื ืขืŸ ืคึผืจืึทืงืกื™, ืงืจืึธื ืื•ืŸ ืคื™ืจืŸ Java (Maven) ื“ื™ืคึผืขื ื“ืึทื ืกื™ื–, ื“ืึธืงืงืขืจ, ืคึผื™ื˜ื”ืึธืŸ, ืจื•ื‘ื™, NPM, Bower ื‘ื™ืœื“ืขืจ, RPM ืคึผืึทืงืึทื“ื–ืฉืึทื–, ื’ื™ื˜ืœืคืก, Apt, Go, Nuget ืื•ืŸ ืคืึทืจืฉืคึผืจื™ื™ื˜ืŸ ื–ื™ื™ืขืจ ื•ื•ื™ื™ื›ื•ื•ืืจื’ ื–ื™ื›ืขืจื”ื™ื™ื˜.

ืคืืจื•ื•ืืก ื˜ืึธืŸ ืื™ืจ ื“ืึทืจืคึฟืŸ Sonatype Nexus?

  • ืคึฟืึทืจ ืกื˜ืึธืจื™ื ื’ ืคึผืจื™ื•ื•ืึทื˜ ืึทืจื˜ืึทืคืึทืงืฅ;
  • ืคึฟืึทืจ ืงืึทื˜ืฉื™ื ื’ ืึทืจื˜ืึทืคืึทืงืฅ ื•ื•ืึธืก ื–ืขื ืขืŸ ื“ืึทื•ื ืœืึธื•ื“ื™ื“ ืคื•ืŸ ื“ื™ ืื™ื ื˜ืขืจื ืขื˜;

ืึทืจื˜ืึทืคืึทืงืฅ ื’ืขืฉื˜ื™ืฆื˜ ืื™ืŸ ื“ื™ ื™ืงืขืจื“ื™ืง Sonatype Nexus ืคึผืขืงืœ:

  • Java, Maven (ืกืœื•ื™)
  • ื“ืึธืงืงืขืจ
  • ืคึผื™ื˜ื”ืึธืŸ (ืคึผื™ืคึผ)
  • ืจื•ื‘ื™ืŸ (ื™ื™ื“ืœืฉื˜ื™ื™ืŸ)
  • ื ืคึผื
  • ื‘ืึธื•ืขืจ
  • ื™ืึทื (ืจืคึผื)
  • ื’ื™ื˜ืœืคืก
  • ืจื•ื™
  • ืืคื˜ (ื“ื‘)
  • Go
  • ื ื•ื’ืขื˜

ืงืึทืžื™ื•ื ื™ื˜ื™ ื’ืขืฉื˜ื™ืฆื˜ ืึทืจื˜ืึทืคืึทืงืฅ:

  • ืงืึธืžืคึผืึธืกืขืจ
  • ืงืึธื ืึทืŸ
  • ืงืคึผืึทืŸ
  • ELPA
  • ืจื•ื“ืขืจ
  • P2
  • R

ื™ื ืกื˜ืึธืœื™ื ื’ Sonatype Nexus ื ื™ืฆืŸ https://github.com/ansible-ThoTeam/nexus3-oss

ื‘ืื“ืขืจืคืขื ื™ืฉืŸ

  • ืœื™ื™ืขื ืขืŸ ื•ื•ืขื’ืŸ ื ื™ืฆืŸ ืึทื ืกื™ื‘ืœืข ืื•ื™ืฃ ื“ืขืจ ืื™ื ื˜ืขืจื ืขืฅ.
  • ื™ื ืกื˜ืึทืœื™ืจืŸ ืึทื ืกืึทื‘ืึทืœ pip install ansible ืื•ื™ืฃ ื“ื™ ื•ื•ืขืจืงืกื˜ื™ื™ืฉืึทืŸ ื•ื•ื• ื“ื™ ืคึผืœื™ื™ึทื‘ืึธืึธืง ืœื•ื™ืคื˜.
  • ืฉื˜ืขืœืŸ geerlingguy.java ืื•ื™ืฃ ื“ื™ ื•ื•ืขืจืงืกื˜ื™ื™ืฉืึทืŸ ื•ื•ื• ื“ื™ ืคึผืœื™ื™ึทื‘ืึธืึธืง ืœื•ื™ืคื˜.
  • ืฉื˜ืขืœืŸ geerlingguy.apache ืื•ื™ืฃ ื“ื™ ื•ื•ืขืจืงืกื˜ื™ื™ืฉืึทืŸ ื•ื•ื• ื“ื™ ืคึผืœื™ื™ึทื‘ืึธืึธืง ืœื•ื™ืคื˜.
  • ื“ื™ ืจืึธืœืข ืื™ื– ื˜ืขืกื˜ืขื“ ืื•ื™ืฃ CentOS 7, Ubuntu Xenial (16.04) ืื•ืŸ Bionic (18.04), Debian Jessie ืื•ืŸ Stretch
  • jmespath ื“ื™ ื‘ื™ื‘ืœื™ืึธื˜ืขืง ืžื•ื–ืŸ ื–ื™ื™ืŸ ืื™ื ืกื˜ืึทืœื™ืจืŸ ืื•ื™ืฃ ื“ื™ ื•ื•ืขืจืงืกื˜ื™ื™ืฉืึทืŸ ื•ื•ื• ื“ื™ ืคึผืœื™ื™ึทื‘ืึธืึธืง ืื™ื– ืคืœื™ืกื ื“ื™ืง. ืฆื• ื™ื ืกื˜ืึทืœื™ืจืŸ: sudo pip install -r requirements.txt
  • ื”ื™ื˜ ื“ื™ ืคึผืœื™ื™ึทื‘ืึธืึธืง ื˜ืขืงืข (ื‘ื™ื™ึทืฉืคึผื™ืœ ืื•ื ื˜ืŸ) ืฆื• nexus.yml ื˜ืขืงืข
  • ืœื•ื™ืคืŸ ื ืขืงืกื•ืก ื™ื ืกื˜ืึทืœื™ืจื•ื ื’ ansible-playbook -i host nexus.yml

ื‘ื™ื™ืฉืคื™ืœืŸ ืคื•ืŸ ืึทืŸ ืึทืงื˜ื™ื•ื• ืคึผืœื™ื™ึทื‘ืึธืึธืง ืคึฟืึทืจ ื™ื ืกื˜ืึธืœื™ื ื’ ื ืขืงืกื•ืก ืึธืŸ 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'] }

ืกืงืจืขืขื ืฉืึธืฅ:

ื™ื ืกื˜ืึธืœื™ื ื’ ืื•ืŸ ืงืึทื ืคื™ื’ื™ืขืจ ื ืขืงืกื•ืก ืกืึธื ืึทื˜ื™ืคึผืข ื ื™ืฆืŸ ื“ื™ ื™ื ืคืจืึทืกื˜ืจืึทืงื˜ืฉืขืจ ื•ื•ื™ ืงืึธื“ ืฆื•ื’ืึทื ื’

ื™ื ืกื˜ืึธืœื™ื ื’ ืื•ืŸ ืงืึทื ืคื™ื’ื™ืขืจ ื ืขืงืกื•ืก ืกืึธื ืึทื˜ื™ืคึผืข ื ื™ืฆืŸ ื“ื™ ื™ื ืคืจืึทืกื˜ืจืึทืงื˜ืฉืขืจ ื•ื•ื™ ืงืึธื“ ืฆื•ื’ืึทื ื’

ื•ื•ืขืจื™ืึทื‘ืึทืœ ืจืึธืœืขืก

ืจืึธืœืข ื•ื•ืขืจื™ืึทื‘ืึทืœื–

ื•ื•ืขืจื™ืึทื‘ืึทืœื– ืžื™ื˜ ืคืขืœื™ืงื™ื™ึทื˜ ื•ื•ืึทืœื•ืขืก (ื–ืขืŸ default/main.yml):

ืึทืœื’ืขืžื™ื™ื ืข ื•ื•ืขืจื™ืึทื‘ืึทืœื–

    nexus_version: ''
    nexus_timezone: 'UTC'

ื“ื•ืจืš ืคืขืœื™ืงื™ื™ึทื˜, ื“ื™ ืจืึธืœืข ื•ื•ืขื˜ ื™ื ืกื˜ืึทืœื™ืจืŸ ื“ื™ ืœืขืฆื˜ ื‘ื ื™ืžืฆื ื•ื•ืขืจืกื™ืข ืคื•ืŸ โ€‹โ€‹ื ืขืงืกื•ืก. ืื™ืจ ืงืขื ืขืŸ ืคืึทืจืจื™ื›ื˜ืŸ ื“ื™ ื•ื•ืขืจืกื™ืข ื“ื•ืจืš ื˜ืฉืึทื ื’ื™ื ื’ ื“ื™ ื‘ื™ื™ึทื˜ืขื•ื•ื“ื™ืง nexus_version. ื–ืขืŸ ื‘ื ื™ืžืฆื ื•ื•ืขืจืกื™ืขืก ื‘ื™ื™ึท https://www.sonatype.com/download-oss-sonatype.

ืื•ื™ื‘ ืื™ืจ ื˜ื•ื™ืฉืŸ ืฆื• ืึท ื ื™ื™ึทืขืจ ื•ื•ืขืจืกื™ืข, ื“ื™ ืจืึธืœืข ื•ื•ืขื˜ ืคึผืจื•ื•ื•ืŸ ืฆื• ื“ืขืจื”ื™ื™ึทื ื˜ื™ืงืŸ ื“ื™ื™ืŸ ื ืขืงืกื•ืก ื™ื ืกื˜ืึทืœื™ืจื•ื ื’.

ืื•ื™ื‘ ืื™ืจ ื ื•ืฆืŸ ืึทืŸ ืขืœื˜ืขืจืข ื•ื•ืขืจืกื™ืข ืคื•ืŸ โ€‹โ€‹โ€‹โ€‹ื ืขืงืกื•ืก ื•ื•ื™ ื“ื™ ืœืขืฆื˜ืข, ืื™ืจ ื–ืึธืœ ืขื ืฉื•ืจ ืึทื– ืื™ืจ ื˜ืึธืŸ ื ื™ื˜ ื ื•ืฆืŸ ืคึฟืขื™ึดืงื™ื™ื˜ืŸ ื•ื•ืึธืก ื–ืขื ืขืŸ ื ื™ืฉื˜ ื‘ื ื™ืžืฆื ืื™ืŸ ื“ื™ ืื™ื ืกื˜ืึทืœื™ืจืŸ ืžืขืœื“ื•ื ื’ (ืœืžืฉืœ, ื”ืึธืกื˜ื™ื ื’ ื™ืึทื ืจื™ืคึผืึทื–ืึทื˜ืึธืจื™ื– ืื™ื– ื‘ื ื™ืžืฆื ืคึฟืึทืจ ื ืขืงืกื•ืก ืžืขืจ ื•ื•ื™ 3.8.0, git lfs repo ืคึฟืึทืจ ื ืขืงืกื•ืก ื”ืขื›ืขืจ ื•ื•ื™ 3.3.0 ืขื˜ืง.)

nexus timezone ืื™ื– ื“ืขืจ ื ืึธืžืขืŸ ืคื•ืŸ ื“ื™ ื–'ืื‘ื ืฆื™ื™ื˜ ื–ืึธื ืข, ื•ื•ืึธืก ืงืขื ืขืŸ ื–ื™ื™ืŸ ื ื•ืฆื™ืง ืื™ืŸ ืงืึธืžื‘ื™ื ืึทืฆื™ืข ืžื™ื˜ ื“ื™ ืคืืœื’ืขื ื“ืข ืงืจืึทืŸ ืื•ื™ืกื“ืจื•ืงืŸ ืคึฟืึทืจ Nexus_scheduled ื˜ืึทืกืงืก.

ื ืขืงืกื•ืก ืคึผืึธืจื˜ ืื•ืŸ ืงืึธื ื˜ืขืงืกื˜ ื“ืจืš

    nexus_default_port: 8081
    nexus_default_context_path: '/'

ื“ื™ ืคึผืึธืจื˜ ืื•ืŸ ืงืึธื ื˜ืขืงืกื˜ ื“ืจืš ืคื•ืŸ ื“ื™ Java ืงืฉืจ ืคึผืจืึธืฆืขืก. nexus_default_context_path ืžื•ื–ืŸ ืึทื ื˜ื”ืึทืœื˜ืŸ ืึท ืคืึธืจื•ื™ืก ืฆืขื”ืึทืงืŸ ื•ื•ืขืŸ ืขืก ืื™ื– ื‘ืึทืฉื˜ื™ืžื˜, ืœืžืฉืœ: nexus_default_context_path: '/nexus/'.

ื ืขืงืกื•ืก ืึทืก ื‘ืึทื ื™ืฆืขืจ ืื•ืŸ ื’ืจื•ืคึผืข

    nexus_os_group: 'nexus'
    nexus_os_user: 'nexus'

ื“ืขืจ ื‘ืึทื ื™ืฆืขืจ ืื•ืŸ ื’ืจื•ืคึผืข ื’ืขื ื™ืฆื˜ ืฆื• ืคืึทืจืžืึธื’ืŸ ื ืขืงืกื•ืก ื˜ืขืงืขืก ืื•ืŸ ืœื•ื™ืคืŸ ื“ื™ ื“ื™ื ืกื˜ ื•ื•ืขื˜ ื–ื™ื™ืŸ ื‘ืืฉืืคืŸ ื“ื•ืจืš ื“ื™ ืจืึธืœืข ืื•ื™ื‘ ืื™ื™ื ืขืจ ืื™ื– ืคืขืœื ื“ื™ืง.

    nexus_os_user_home_dir: '/home/nexus'

ืœืึธื–ืŸ ื˜ืฉืึทื ื’ื™ื ื’ ื“ื™ ืคืขืœื™ืงื™ื™ึทื˜ ื”ื™ื™ื ื•ื•ืขื’ื•ื•ื™ื™ึทื–ืขืจ ืคึฟืึทืจ ื“ื™ ื ืขืงืกื•ืก ื‘ืึทื ื™ืฆืขืจ

ื ืขืงืกื•ืก ื‘ื™ื™ึทืฉืคึผื™ืœ ื“ื™ืจืขืงื˜ืขืจื™ื–

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

ื ืขืงืกื•ืก ืงืึทื˜ืึทืœืึทื’ื–.

  • nexus_installation_dir ื›ึผื•ืœืœ ืื™ื ืกื˜ืึทืœื™ืจืŸ ืขืงืกืขืงื•ื˜ืึทื‘ืœืข ื˜ืขืงืขืก
  • nexus_data_dir ื›ึผื•ืœืœ ืึทืœืข ืงืึทื ืคื™ื’ื™ืขืจื™ื™ืฉืึทืŸ, ืจื™ืคึผืึทื–ืึทื˜ืึธืจื™ื– ืื•ืŸ ื“ืึทื•ื ืœืึธื•ื“ื™ื“ ืึทืจื˜ืึทืคืึทืงืฅ. ืžื ื”ื’ ื‘ืœืึธื‘ืกื˜ืึธืจืข ืคึผืึทื˜ืก nexus_data_dir ืงืขื ืขืŸ ื–ื™ื™ืŸ ืงืึทืกื˜ืึทืžื™ื™ื–ื“, ื–ืขืŸ ืื•ื ื˜ืŸ nexus_blobstores.
  • nexus_tmp_dir ื›ึผื•ืœืœ ืึทืœืข ืฆื™ื™ื˜ื•ื•ื™ื™ืœื™ื’ืข ื˜ืขืงืขืก. ื“ื™ ืคืขืœื™ืงื™ื™ึทื˜ ื“ืจืš ืคึฟืึทืจ ืจืขื“ื”ืึทื˜ ืื™ื– ืืจื™ื‘ืขืจื’ืขืคืืจืŸ ืคื•ืŸ /tmp ืฆื• ื‘ืึทืงื•ืžืขืŸ ืคึผืึธื˜ืขื ืฆื™ืขืœ ืคึผืจืึธื‘ืœืขืžืก ืžื™ื˜ ืึธื˜ืึทืžืึทื˜ื™ืง ืจื™ื™ื ื™ืงื•ื ื’ ืคึผืจืึธื•ืกื™ื“ื–ืฉืขืจื–. ื–ืขืŸ # 168 .

ืงืึทื ืคื™ื’ื™ืขืจ Nexus JVM ื–ื›ึผืจื•ืŸ ื‘ืึทื ื™ืฅ

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

ื“ืึธืก ื–ืขื ืขืŸ ื“ื™ ืคืขืœื™ืงื™ื™ึทื˜ ืกืขื˜ื˜ื™ื ื’ืก ืคึฟืึทืจ ื ืขืงืกื•ืก. ื‘ื™ื˜ืข ื˜ืึธืŸ ื ื™ื˜ ื˜ื•ื™ืฉืŸ ื“ื™ ื•ื•ืึทืœื•ืขืก ืื•ื™ื‘ ืื™ืจ ื”ืึธื˜ ื ื™ืฉื˜ ืœื™ื™ืขื ืขืŸ ื ืขืงืกื•ืก ืกื™ืกื˜ืขื ืจืขืงื•ื•ื™ืจืขืžืขื ืฅ ื–ื›ึผืจื•ืŸ ืึธืคึผื˜ื™ื™ืœื•ื ื’ ืื•ืŸ ืคืืจืฉื˜ื™ื™ ื ื™ืฉื˜ ื•ื•ืืก ื–ื™ื™ ื˜ื•ืขืŸ.

ืืœืก ืฆื•ื•ื™ื™ื˜ืข ื•ื•ืืจืขื ื•ื ื’ ืื™ื– ื“ื ืืŸ ืื•ื™ืกืฆื•ื’ ืคื•ืŸ ื“ืขื ืื•ื™ื‘ื ื“ืขืจืžืื ื˜ืŸ ื“ืืงื•ืžืขื ื˜:

ืขืก ืื™ื– ื ื™ืฉื˜ ืจืขืงืึทืžืขื ื“ื™ื“ ืฆื• ืคืึทืจื’ืจืขืกืขืจืŸ ื“ื™ JVM ืงื•ืคึผืข ื–ื›ึผืจื•ืŸ ื•ื•ื™ื™ึทื˜ืขืจ ืคื•ืŸ ื“ื™ ืจืขืงืึทืžืขื ื“ื™ื“ ื•ื•ืึทืœื•ืขืก ืื™ืŸ ืึทืŸ ืคึผืจื•ื•ื•ืŸ ืฆื• ืคึฟืึทืจื‘ืขืกืขืจืŸ ืคืึธืจืฉื˜ืขืœื•ื ื’. ื“ืึธืก ืงืขืŸ ืึทืงืฉืœื™ ื”ืึธื‘ืŸ ื“ื™ ืคืึทืจืงืขืจื˜ ื•ื•ื™ืจืงื•ื ื’, ืจื™ื–ืึทืœื˜ื™ื ื’ ืื™ืŸ ื•ืžื ื™ื™ื˜ื™ืง ืึทืจื‘ืขื˜ ืคึฟืึทืจ ื“ื™ ืึธืคึผืขืจื™ื™ื˜ื™ื ื’ ืกื™ืกื˜ืขื.

ืึทื“ืžื™ื ื™ืกื˜ืจืึทื˜ืึธืจ ืคึผืึทืจืึธืœ

    nexus_admin_password: 'changeme'

ื“ื™ "ืึทื“ืžื™ืŸ" ื—ืฉื‘ื•ืŸ ืคึผืึทืจืึธืœ ืคึฟืึทืจ ืกืขื˜ืึทืคึผ. ื“ืึธืก ืึทืจื‘ืขื˜ ื‘ืœื•ื™ื– ืื•ื™ืฃ ื“ืขืจ ืขืจืฉื˜ืขืจ ืคืขืœื™ืงื™ื™ึทื˜ ื™ื ืกื˜ืึทืœื™ืจื•ื ื’. ื‘ื™ื˜ืข ื–ืขืŸ [ื˜ื•ื™ืฉืŸ ืึทื“ืžื™ืŸ ืคึผืึทืจืึธืœ ื ืึธืš ืขืจืฉื˜ืขืจ ื™ื™ึทื ืžืึธื ื˜ื™ืจื•ื ื’] (# ื˜ื•ื™ืฉืŸ-admin-password-after-first-install) ืื•ื™ื‘ ืื™ืจ ื•ื•ื™ืœืŸ ืฆื• ื˜ื•ื™ืฉืŸ ืขืก ืฉืคึผืขื˜ืขืจ ื ื™ืฆืŸ ืึท ืจืึธืœืข.

ืขืก ืื™ื– ืฉื˜ืืจืง ืจืขืงืึทืžืขื ื“ื™ื“ ื ื™ืฉื˜ ืฆื• ืงืจืึธื ื“ื™ื™ืŸ ืคึผืึทืจืึธืœ ืื™ืŸ ืงืœืึธืจ ื˜ืขืงืกื˜ ืื™ืŸ ื“ื™ ืคึผืœื™ื™ึทื‘ืึธืึธืง, ืึธื‘ืขืจ ืฆื• ื ื•ืฆืŸ [ืึทื ืกื™ื‘ืœืข-ื•ื•ืึธืœื˜ ืขื ืงืจื™ืคึผืฉืึทืŸ] (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_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, ืึทื–ื•ื™ ืงื™ื™ืŸ ื’ืœื™ื™ืš ืฆื•ื˜ืจื™ื˜ืœืขืš ื“ื•ืจืš ื”ื˜ื˜ืคึผ ืคึผืึธืจื˜ 8081 ืคึฟื•ืŸ ื“ื™ ืคื•ื ื“ืจื•ื™ืกื ื“ื™ืง IP ืึทื“ืจืขืก.

ื“ื™ ืคืขืœื™ืงื™ื™ึทื˜ ื”ืึธืกื˜ื ืึทืžืข ื’ืขื ื™ืฆื˜ ืื™ื– nexus_public_hostname. ืื•ื™ื‘ ืื™ืจ ื“ืึทืจืคึฟืŸ ืคืึทืจืฉื™ื“ืขื ืข ื ืขืžืขืŸ ืคึฟืึทืจ ืขื˜ืœืขื›ืข ืกื™ื‘ื”, ืื™ืจ ืงืขื ืขืŸ ืฉื˜ืขืœืŸ httpd_server_name ืžื™ื˜ ืืŸ ืื ื“ืขืจ ื˜ื™ื™ึทื˜ืฉ.

ะก httpd_copy_ssl_files: true (ื“ื•ืจืš ืคืขืœื™ืงื™ื™ึทื˜) ื“ื™ ืื•ื™ื‘ืŸ ืกืขืจื˜ื™ืคื™ืงืึทืฅ ื–ืึธืœ ืขืงืกื™ืกื˜ื™ืจืŸ ืื™ืŸ ื“ื™ื™ืŸ ืคึผืœื™ื™ึทื‘ืึธืึธืง ื•ื•ืขื’ื•ื•ื™ื™ึทื–ืขืจ ืื•ืŸ ื•ื•ืขื˜ ื–ื™ื™ืŸ ืงืึทืคึผื™ื“ ืฆื• ื“ื™ ืกืขืจื•ื•ืขืจ ืื•ืŸ ืงืึทื ืคื™ื’ื™ืขืจื“ ืื™ืŸ ืึทืคึผืึทื˜ืฉื™.

ืื•ื™ื‘ ืื™ืจ ื•ื•ื™ืœืŸ ืฆื• ื ื•ืฆืŸ ื™ื’ื–ื™ืกื˜ื™ื ื’ ืกืขืจื˜ื™ืคื™ืงืึทืฅ ืื•ื™ืฃ ื“ื™ ืกืขืจื•ื•ืขืจ, ื™ื ืกื˜ืึทืœื™ืจืŸ 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_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) ื™ื•ื–ืขืจื– / ืึทืงืึทื•ื ืฅ ืจืฉื™ืžื” ืฆื• ืฉืึทืคึฟืŸ ืื™ืŸ ื ืขืงืกื•ืก.

ืจืฉื™ืžื” ืคื•ืŸ ื”ื™ื’ืข (ื ื™ื˜-LDAP) ื™ื•ื–ืขืจื– / ืึทืงืึทื•ื ืฅ ืฆื• ืฉืึทืคึฟืŸ ืื™ืŸ ื ืขืงืกื•ืก.

      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_data_dir ืื™ื– ื“ื™ื˜ืขืงื˜ืึทื“ ืœื™ื™ื“ื™ืง).

ืจื™ืžื•ื•ื•ื™ื ื’ ืจื™ืคึผืึทื–ืึทื˜ืึธืจื™ื– ืคื•ืŸ ื“ื™ ืคืขืœื™ืงื™ื™ึทื˜ ืคืขืœื™ืงื™ื™ึทื˜ ืงืึทื ืคื™ื’ื™ืขืจื™ื™ืฉืึทืŸ ืคึฟืึทืจ ื ืขืงืกื•ืก. ื“ืขืจ ืฉืจื™ื˜ ืื™ื– ื‘ืœื•ื™ื– ื“ื•ืจื›ื’ืขืงืึธื›ื˜ ื‘ืขืฉืึทืก ื“ืขืจ ืขืจืฉื˜ืขืจ ื™ื ืกื˜ืึทืœื™ืจื•ื ื’ (ื•ื•ืขืŸ nexus_data_dir ืœื™ื™ื“ื™ืง).

    nexus_delete_default_blobstore: false

ื•ื™ืกืžืขืงืŸ ื“ื™ ืคืขืœื™ืงื™ื™ึทื˜ ื‘ืœืึธื‘ืกื˜ืึธืจืข ืคึฟื•ืŸ ื“ื™ ืขืจืฉื˜ ืคืขืœื™ืงื™ื™ึทื˜ ืงืึทื ืคื™ื’ื™ืขืจื™ื™ืฉืึทืŸ ืคื•ืŸ ื ืขืงืกื•ืก ื™ื ืกื˜ืึทืœื™ืจืŸ. ื“ืึธืก ืงืขืŸ ื–ื™ื™ืŸ ื’ืขื˜ืืŸ ื‘ืœื•ื™ื– ืื•ื™ื‘ 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 }}"

ื‘ืœืึธื‘ืกื˜ืึธืจืขืก ืฆื• ืฉืึทืคึฟืŸ. ื ื‘ืœืึธื‘ืกื˜ืึธืจืข ื“ืจืš ืื•ืŸ ืึท ืจื™ืคึผืึทื–ืึทื˜ืึธืจื™ ื‘ืœืึธื‘ืกื˜ืึธืจืข ืงืขื ืขืŸ ื ื™ื˜ ื–ื™ื™ืŸ ื“ืขืจื”ื™ื™ึทื ื˜ื™ืงื˜ ื ืึธืš ืขืจืฉื˜ ืฉืึทืคื•ื ื’ (ื™ืขื“ืขืจ ื“ืขืจื”ื™ื™ึทื ื˜ื™ืงืŸ ื“ืึธ ื•ื•ืขื˜ ื–ื™ื™ืŸ ืื™ื’ื ืึธืจื™ืจื˜ ืื•ื™ืฃ ืฉื™ื™ึทืขืš-ืคึผืจืึทื•ื•ื™ื–ืฉืึทืŸ).

ืงืึทื ืคื™ื’ื™ืขืจื™ื ื’ ื‘ืœืึธื‘ืกื˜ืึธืจืข ืื•ื™ืฃ S3 ืื™ื– ืฆื•ื’ืขืฉื˜ืขืœื˜ ื•ื•ื™ ืึท ืงืึทื ื•ื•ื™ื ื™ืึทื ืก ืื•ืŸ ืื™ื– ื ื™ืฉื˜ ื˜ื™ื™ืœ ืคื•ืŸ ื“ื™ ืึธื˜ืึทืžื™ื™ื˜ื™ื“ ื˜ืขืกืฅ ืžื™ืจ ืœื•ื™ืคืŸ ืื•ื™ืฃ ื˜ืจืึทื•ื•ื™ืก. ื‘ื™ื˜ืข ื˜ืึธืŸ ืึทื– ืกื˜ืึธืจื™ื ื’ ืื•ื™ืฃ 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"

ืžืึทื•ื•ืึทืŸ ื›ืึธื•ืกื˜ื™ื“ ืจื™ืคึผืึทื–ืึทื˜ืึธืจื™ื– ืงืึทื ืคื™ื’ื™ืขืจื™ื™ืฉืึทืŸ. ื ืขื’ืึทื˜ื™ื•ื• ืงืึทืฉ ืงืึทื ืคื™ื’ื™ืขืจื™ื™ืฉืึทืŸ ืื™ื– ืึทืคึผืฉืึทื ืึทืœ ืื•ืŸ ื•ื•ืขื˜ ืคืขืœื™ืงื™ื™ึทื˜ ืฆื• ื“ื™ ืื•ื™ื‘ืŸ ื•ื•ืึทืœื•ืขืก ืื•ื™ื‘ ืื™ื‘ืขืจื’ืขื”ื™ืคึผืขืจื˜.

ืงืึธื ืคื™ื’ื•ืจืึทื˜ื™ืึธืŸ ื›ืึธื•ืกื˜ื™ื“ ืจื™ืคึผืึทื–ืึทื˜ืึธืจื™ื– ืžืึทื•ื•ืขืŸ. ื“ื™ ื ืขื’ืึทื˜ื™ื•ื• ืงืึทืฉ ืงืึทื ืคื™ื’ื™ืขืจื™ื™ืฉืึทืŸ (-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

ื‘ื™ื˜ืข ื˜ืึธืŸ ืึทื– ืื™ืจ ืงืขืŸ ื“ืึทืจืคึฟืŸ ืฆื• ื’ืขื‘ืŸ ื–ื™ื›ืขืจ ื–ื™ื›ืขืจื”ื™ื™ื˜ ืกืงืึธืคึผืขืก ืื•ื™ื‘ ืื™ืจ ื•ื•ื™ืœืŸ ืฆื• ื ื•ืฆืŸ ืื ื“ืขืจืข ื˜ื™ื™ืคึผืก ืคื•ืŸ ืจื™ืคึผืึทื–ืึทื˜ืึธืจื™ื– ื•ื•ื™ ืžืึทื•ื•ืขืŸ. ื“ืขื ืื™ื– ืคืึทืœืฉ ื“ื•ืจืš ืคืขืœื™ืงื™ื™ึทื˜

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 ืจื™ืงื•ื•ืขืก ืื™ืŸ ื“ืขื ื‘ืœืขื˜ืขืจืขืจ ื•ื•ืขืŸ ืžืึทื ื™ื•ืึทืœื™ ื‘ืึทืฉื˜ืขื˜ื™ืงืŸ ืึท ืึทืจื‘ืขื˜.

ืึทืจื‘ืขื˜ ืคึผืจืึธืคึผืขืจื˜ื™ืขืก ืžื•ื–ืŸ ื–ื™ื™ืŸ ื“ืขืจืงืœืขืจื˜ ืื™ืŸ ื“ื™ ืจื™ื›ื˜ื™ืง ื™ืึทืžืœ ื‘ืœืึธืง ื“ื™ืคึผืขื ื“ื™ื ื’ ืื•ื™ืฃ ื–ื™ื™ืขืจ ื˜ื™ืคึผ:

  • 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_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ืื•ื™ื‘ ืื™ืจ ื“ืึทืจืคึฟืŸ ืฆื• ืจื™ืกื˜ืึทืจื˜ ืคึฟื•ืŸ ืงืจืึทืฆืŸ ืื•ืŸ ืจื™ื™ื ืกื˜ืึทืœ ื“ื™ ื ืขืงืกื•ืก ื‘ื™ื™ึทืฉืคึผื™ืœ ืžื™ื˜ ืึทืœืข ื“ืึทื˜ืŸ ืึทื•ื•ืขืงื’ืขื ื•ืžืขืŸ.

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

ื˜ื•ื™ืฉืŸ ืึทื“ืžื™ื ื™ืกื˜ืจืึทื˜ืึธืจ ืคึผืึทืจืึธืœ ื ืึธืš ื“ืขืจ ืขืจืฉื˜ืขืจ ื™ื ืกื˜ืึทืœื™ืจื•ื ื’

    nexus_default_admin_password: 'admin123'

ื“ืึธืก ื–ืึธืœ ื ื™ื˜ ื–ื™ื™ืŸ ื’ืขื‘ื™ื˜ืŸ ืื™ืŸ ื“ื™ื™ืŸ ืคึผืœื™ื™ึทื‘ืึธืึธืง. ื“ืขืจ ื•ื•ืขืจื™ืึทื‘ืึทืœ ืื™ื– ืคึผืึทืคึผื™ืึทืœื™ื™ื˜ืึทื“ ืžื™ื˜ ื“ื™ ืคืขืœื™ืงื™ื™ึทื˜ ื ืขืงืกื•ืก ืึทื“ืžื™ืŸ ืคึผืึทืจืึธืœ ื•ื•ืขืŸ ืขืจืฉื˜ืขืจ ืื™ื ืกื˜ืึทืœื™ืจืŸ ืื•ืŸ ื™ื ืฉื•ืจื– ืึทื– ืžื™ืจ ืงืขื ืขืŸ ื˜ื•ื™ืฉืŸ ื“ื™ ืึทื“ืžื™ืŸ ืคึผืึทืจืึธืœ ืฆื• nexus_admin_password.

ืื•ื™ื‘ ืื™ืจ ื•ื•ื™ืœืŸ ืฆื• ื˜ื•ื™ืฉืŸ ื“ื™ ืึทื“ืžื™ื ื™ืกื˜ืจืึทื˜ืึธืจ ืคึผืึทืจืึธืœ ื ืึธืš ื“ืขืจ ืขืจืฉื˜ืขืจ ื™ื™ึทื ืžืึธื ื˜ื™ืจื•ื ื’, ืื™ืจ ืงืขื ืขืŸ ื˜ืขืžืคึผืขืจืขืจืึทืœื™ ื˜ื•ื™ืฉืŸ ืขืก ืฆื• ื“ื™ ืึทืœื˜ ืคึผืึทืจืึธืœ ืคึฟื•ืŸ ื“ื™ ื‘ืึทืคึฟืขืœืŸ ืฉื•ืจื”. ื ืึธืš ื˜ื•ื™ืฉืŸ nexus_admin_password ืื™ืŸ ื“ื™ื™ืŸ ืคึผืœื™ื™ึทื‘ืึธืึธืง ืื™ืจ ืงืขื ืขืŸ ืœื•ื™ืคืŸ:

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

ื˜ืขืœืขื’ืจืึทื ืงืึทื ืึทืœ ืื•ื™ืฃ ื ืขืงืกื•ืก ืกืึธื ืึทื˜ื™ืคึผืข: https://t.me/ru_nexus_sonatype

ื‘ืœื•ื™ื– ืจืขื’ื™ืกื˜ืจื™ืจื˜ ื ื™ืฆืขืจืก ืงืขื ืขืŸ ืึธื ื˜ื™ื™ืœ ื ืขืžืขืŸ ืื™ืŸ ื“ื™ ื™ื‘ืขืจื‘ืœื™ืง. ืกื™ื™ืŸ ืืจื™ื™ืŸื‘ื™ื˜ืข.

ื•ื•ืึธืก ืึทืจื˜ืึทืคืึทืงื˜ ืจื™ืคึผืึทื–ืึทื˜ืึธืจื™ื– ื˜ืึธืŸ ืื™ืจ ื ื•ืฆืŸ?

  • Sonatype Nexus ืื™ื– ืคืจื™ื™

  • ืกืึธื ืึทื˜ื™ืคึผืข ื ืขืงืกื•ืก ื‘ืึทืฆืึธืœื˜

  • ืึทืจื˜ื™ืคืึทืงื˜ืึธืจื™ ืื™ื– ืคืจื™ื™

  • ืึทืจื˜ื™ืคืึทืงื˜ืึธืจื™ ื‘ืึทืฆืึธืœื˜

  • ืคึผืึธืจื˜

  • ืคึผืึทืคึผ

9 ื‘ืื ื•ืฆืขืจ ื”ืื‘ืŸ ื’ืขืฉื˜ื™ืžื˜. 3 ื‘ืื ื•ืฆืขืจ ื”ืื‘ืŸ ื–ื™ืš ืืคื’ืขื”ืืœื˜ืŸ.

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

ืœื™ื™ื’ืŸ ืึท ื‘ืึทืžืขืจืงื•ื ื’