Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- - name: "Installing required package for nexus-3 cli"
- yum:
- name: python3-pip
- state: present
- tags:
- - nexus
- - never
- - name: "Installing nexus3-cli using pip"
- pip:
- name: nexus3-cli
- tags:
- - nexus
- - never
- - name: "Adding a required setting in {{nexus_dir}}"
- lineinfile:
- path: "{{nexus_dir}}/nexus-default.properties"
- insertafter: "nexus.hazelcast.discovery.isEnabled=true"
- line: nexus.scripts.allowCreation=true
- register: script_status
- tags:
- - run_once
- - never
- - name: "Nexus service restart required"
- when: script_status.changed
- service:
- name: nexus
- state: restarted
- tags:
- - run_once
- - never
- - name: "Waiting for 90 sec for nexus to initiate"
- when: script_status.changed
- wait_for:
- timeout: 90
- tags:
- - run_once
- - never
- - name: "Nexus login through nexus3-cli"
- shell: "nexus3 login -U {{ nexus_url }} -u {{ nexus_user }} -p {{ nexus_passwd }} --x509_verify"
- tags:
- - nexus
- - never
- - name: "Creating a yum proxy nexus repository"
- when: rpm_package == ""
- shell: "nexus3 repository create proxy yum --strict-content --health-check {{ nexus_repo_name }} {{ remote_url }}"
- tags:
- - nexus
- - never
- register: proxy_status
- - name: "Copying to remote location"
- when: proxy_status.changed == false
- copy:
- src: "/var/lib/jenkins/workspace/nexus-project/package.rpm"
- dest: "/tmp/{{ rpm_package }}.rpm"
- tags:
- - nexus
- - never
- - name: "Creating a nexus yum hosted repository"
- when: proxy_status.changed == false
- shell: "nexus3 repository create hosted yum {{ nexus_repo_name }}"
- tags:
- - nexus
- - never
- - name: "Uploading rpm package to nexus yum repo"
- when: proxy_status.changed == false
- shell: "nexus3 upload /tmp/{{ rpm_package }}.rpm {{ nexus_repo_name }}"
- tags:
- - nexus
- - never
- - name: "Cleaning rpm file in nexus server"
- when: proxy_status.changed == false
- file:
- path: "/tmp/{{ rpm_package }}.rpm"
- state: absent
- tags:
- - nexus
- - never
- #- name: "Copying package to a temporary location"
- # when: proxy_status.changed == false
- # delegate_to: "{{ host }}"
- # get_url:
- # url: "{{ nexus_url }}/repository/{{ nexus_repo_name }}/{{ nexus_repo_name }}.rpm"
- # dest: /tmp/
- # url_username: "{{ nexus_user }}"
- # url_password: "{{ nexus_passwd }}"
- # tags:
- # - nexus
- # - never
- #- name: "Installing the rpm package using yum"
- # when: proxy_status.changed == false
- # delegate_to: "{{ host }}"
- # yum:
- # name: "/tmp/{{ nexus_repo_name }}.rpm"
- # disable_gpg_check: true
- # state: present
- # tags:
- # - nexus
- # - never
- #
- #- name: "Creating a repo in yum.repo.d"
- # when: host != "" and proxy_status.changed
- # delegate_to: "{{ host }}"
- # template:
- # src: main.j2
- # dest: "/etc/yum.repos.d/{{ nexus_repo_name }}.nexus.repo"
- # tags:
- # - nexus
- # - never
- - name: "Disabling the scripting feauture in {{nexus_dir}}"
- when: script_status.changed
- lineinfile:
- path: "{{nexus_dir}}/nexus-default.properties"
- regexp: "^nexus.scripts.allowCreation=true"
- state: absent
- tags:
- - run_once
- - never
- - name: "Nexus service restart required"
- when: script_status.changed
- service:
- name: nexus
- state: restarted
- tags:
- - run_once
- - never
Advertisement
Add Comment
Please, Sign In to add comment