ఇన్‌ఫ్రాస్ట్రక్చర్‌ను కోడ్ విధానంగా ఉపయోగించి Nexus Sonatypeని ఇన్‌స్టాల్ చేయడం మరియు కాన్ఫిగర్ చేయడం

Sonatype Nexus అనేది సమీకృత ప్లాట్‌ఫారమ్, దీని ద్వారా డెవలపర్‌లు జావా (మావెన్) డిపెండెన్సీలు, డాకర్, పైథాన్, రూబీ, NPM, బోవర్ చిత్రాలు, RPM ప్యాకేజీలు, gitlfs, Apt, Go, Nuget ప్రాక్సీ, నిల్వ మరియు నిర్వహించవచ్చు మరియు వారి సాఫ్ట్‌వేర్ భద్రతను పంపిణీ చేయవచ్చు.

మీకు సోనాటైప్ నెక్సస్ ఎందుకు అవసరం?

  • ప్రైవేట్ కళాఖండాలను నిల్వ చేయడానికి;
  • ఇంటర్నెట్ నుండి డౌన్‌లోడ్ చేయబడిన కళాఖండాలను కాషింగ్ చేయడానికి;

ప్రాథమిక Sonatype Nexus ప్యాకేజీలో మద్దతు ఉన్న కళాఖండాలు:

  • జావా, మావెన్ (జార్)
  • డాకర్
  • పైథాన్ (పిప్)
  • రూబీ (రత్నం)
  • npm
  • బోవెర్
  • యమ్ (rpm)
  • gitlfs
  • రా
  • ఆప్ట్ (డెబ్)
  • Go
  • నుగేట్

సంఘం మద్దతు ఉన్న కళాఖండాలు:

  • కంపోజర్
  • కోనన్
  • CPAN
  • ELPA
  • హెల్మ్
  • P2
  • R

ఉపయోగించి Sonatype Nexusని ఇన్‌స్టాల్ చేస్తోంది https://github.com/ansible-ThoTeam/nexus3-oss

అవసరాలు

  • ఇంటర్నెట్‌లో అన్సిబుల్ ఉపయోగించడం గురించి చదవండి.
  • యాన్సిబుల్‌ను ఇన్‌స్టాల్ చేయండి pip install ansible ప్లేబుక్ నడుస్తున్న వర్క్‌స్టేషన్‌లో.
  • ఇన్స్టాల్ geerlingguy.java ప్లేబుక్ నడుస్తున్న వర్క్‌స్టేషన్‌లో.
  • ఇన్స్టాల్ geerlingguy.apache ప్లేబుక్ నడుస్తున్న వర్క్‌స్టేషన్‌లో.
  • ఈ పాత్ర సెంటొస్ 7, ఉబుంటు జెనియల్ (16.04) మరియు బయోనిక్ (18.04), డెబియన్ జెస్సీ మరియు స్ట్రెచ్‌లలో పరీక్షించబడింది
  • jmespath ప్లేబుక్ నడుస్తున్న వర్క్‌స్టేషన్‌లో లైబ్రరీ తప్పనిసరిగా ఇన్‌స్టాల్ చేయబడాలి. ఇన్‌స్టాల్ చేయడానికి: sudo pip install -r requirements.txt
  • ప్లేబుక్ ఫైల్‌ను (క్రింద ఉదాహరణ) nexus.yml ఫైల్‌లో సేవ్ చేయండి
  • నెక్సస్ ఇన్‌స్టాలేషన్‌ను అమలు చేయండి ansible-playbook -i host nexus.yml

Maven (java), Docker, Python, Ruby, NPM, Bower, RPM మరియు gitlfs రిపోజిటరీలతో LDAP లేకుండా నెక్సస్‌ని ఇన్‌స్టాల్ చేయడానికి ఉదాహరణ ansible-playbook.

---
- 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 రిపోజిటరీలను హోస్ట్ చేయడం 3.8.0 కంటే ఎక్కువ, git lfs repo nexus కోసం అందుబాటులో ఉంది 3.3.0 కంటే ఎక్కువ నెక్సస్ కోసం మొదలైనవి)

nexus timezone జావా టైమ్ జోన్ పేరు, ఇది nexus_షెడ్యూల్డ్ టాస్క్‌ల కోసం క్రింది క్రాన్ ఎక్స్‌ప్రెషన్‌లతో కలిపి ఉపయోగపడుతుంది.

Nexus పోర్ట్ మరియు సందర్భ మార్గం

    nexus_default_port: 8081
    nexus_default_context_path: '/'

జావా కనెక్షన్ ప్రక్రియ యొక్క పోర్ట్ మరియు సందర్భ మార్గం. 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_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 అన్ని కాన్ఫిగరేషన్, రిపోజిటరీలు మరియు డౌన్‌లోడ్ చేయబడిన కళాఖండాలను కలిగి ఉంటుంది. కస్టమ్ బ్లాబ్‌స్టోర్ మార్గాలు 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-vault encryption] (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, ఆ విధంగా కాదు బాహ్య IP చిరునామా నుండి HTTP పోర్ట్ 8081 ద్వారా నేరుగా యాక్సెస్ చేయవచ్చు.

ఉపయోగించిన డిఫాల్ట్ హోస్ట్ పేరు 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 లోపల దీని అర్థం)

    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_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 కోసం డిఫాల్ట్ డిఫాల్ట్ కాన్ఫిగరేషన్ నుండి రిపోజిటరీలను తొలగిస్తోంది. ఈ దశ మొదటి ఇన్‌స్టాలేషన్ సమయంలో మాత్రమే నిర్వహించబడుతుంది (ఎప్పుడు 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లో బ్లాబ్‌స్టోర్‌ను కాన్ఫిగర్ చేయడం సౌలభ్యం కోసం అందించబడింది మరియు మేము ట్రావిస్‌లో అమలు చేసే ఆటోమేటెడ్ పరీక్షల్లో భాగం కాదు. దయచేసి AWSలో అమలు చేయబడిన సందర్భాల్లో మాత్రమే S3లో నిల్వ చేయడం సిఫార్సు చేయబడుతుందని గమనించండి.

సృష్టి బ్లాబ్‌స్టోర్స్. ప్రాథమిక సృష్టి తర్వాత నిల్వ మార్గం మరియు నిల్వ రిపోజిటరీ నవీకరించబడవు (మళ్లీ ఇన్‌స్టాల్ చేసినప్పుడు ఇక్కడ ఏదైనా నవీకరణ విస్మరించబడుతుంది).

S3లో బొట్టు నిల్వను సెటప్ చేయడం సౌకర్యంగా అందించబడింది. AWSలో అమలు చేయబడిన సందర్భాల్లో మాత్రమే S3 నిల్వ సిఫార్సు చేయబడుతుందని దయచేసి గమనించండి.

    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

డాకర్, పైపి, రా, రూబీజెమ్స్, బోవర్, 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 మీరు ఏదైనా ఊహించవచ్చు:

  • జావా రకం సోపానక్రమం నుండి 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లో అమలు చేయడానికి కాన్ఫిగర్ చేయబడుతుంది
లో పేర్కొన్న విరామంలో nexus_backup_cron (డిఫాల్ట్ 21:00 ప్రతి రోజు).
వివరాల కోసం [ఈ టాస్క్ కోసం గ్రూవీ టెంప్లేట్](టెంప్లేట్లు/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 చెల్లించబడింది

  • ఆర్టిఫ్యాక్టరీ ఉచితం

  • ఆర్టిఫ్యాక్టరీ చెల్లించబడింది

  • నౌకాశ్రయం

  • పల్ప్

9 మంది వినియోగదారులు ఓటు వేశారు. 3 వినియోగదారులు దూరంగా ఉన్నారు.

మూలం: www.habr.com

ఒక వ్యాఖ్యను జోడించండి