Skip to content

Commit 82f52af

Browse files
committed
[FIX] fixed bugs
1 parent 3997502 commit 82f52af

File tree

6 files changed

+23
-18
lines changed

6 files changed

+23
-18
lines changed

Ansible/nexus/README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ Ensure the following requirements are met before running the playbooks:
1313
- Docker installed on the target servers
1414
- Proper inventory configuration (`nexus_servers` group in your inventory)
1515

16+
```bash
17+
ansible-galaxy collection install community.docker
18+
```
19+
1620
## Playbooks
1721

1822
### `nexus_docker.yml` ⚙️
@@ -28,7 +32,7 @@ This playbook performs the following tasks:
2832
#### Usage
2933

3034
```bash
31-
ansible-playbook -i inventory nexus_docker.yml
35+
ansible-playbook -i inventory.ini nexus_docker.yml
3236
```
3337

3438

@@ -40,7 +44,7 @@ Copy code
4044

4145
This repository contains two Ansible playbooks for managing a Nexus Repository Docker container:
4246

43-
1. `nexus_docker.yml` - Sets up and starts a Nexus Repository in a Docker container.
47+
1. `install-nexus.yml` - Sets up and starts a Nexus Repository in a Docker container.
4448
2. `cleanup_nexus_docker.yml` - Stops, removes the Nexus container, its Docker image, and cleans up associated data directories.
4549

4650
## Requirements 📋
@@ -66,7 +70,7 @@ This playbook performs the following tasks:
6670
#### Usage
6771

6872
```bash
69-
ansible-playbook -i inventory nexus_docker.yml
73+
ansible-playbook -i inventory.ini nexus_docker.yml
7074
```
7175
#### Variables:
7276
|**Variable**| **Description**|
@@ -89,7 +93,7 @@ This playbook cleans up the Nexus Docker setup:
8993
#### Usage
9094

9195
```bash
92-
ansible-playbook -i inventory cleanup_nexus_docker.yml
96+
ansible-playbook -i inventory.ini cleanup_nexus_docker.yml
9397
```
9498
#### Variables:
9599
| **Variable** | **Description** |

Ansible/nexus/ansible.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[defaults]
2+
callbacks_enabled = profile_tasks

Ansible/nexus/cleanup_nexus_docker.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
---
22
- hosts: nexus_servers
33
become: yes
4-
vars:
5-
nexus_container_name: "nexus"
6-
nexus_image: "sonatype/nexus3:latest"
7-
nexus_data_dir: "/mnt/nexus/nexus-data"
4+
vars_files:
5+
- vars.yml
86
tasks:
97
- name: Stop Nexus container if exists
108
docker_container:
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
---
22
- hosts: nexus_servers
33
become: yes
4-
vars:
5-
nexus_image: "sonatype/nexus3:latest"
6-
nexus_data_dir: "/mnt/nexus/nexus-data"
7-
nexus_container_name: "nexus"
8-
nexus_port: 8081
9-
nexus_admin_password_file: "/nexus-data/admin.password"
4+
vars_files:
5+
- vars.yml
106
tasks:
117
- name: Create Nexus data directory
128
file:
@@ -37,7 +33,7 @@
3733
timeout: 300
3834

3935
- name: Retrieve Nexus admin password
40-
command: docker exec -it "{{ nexus_container_name }}" cat "{{ nexus_admin_password_file }}"
36+
command: docker exec "{{ nexus_container_name }}" cat "{{ nexus_admin_password_file }}"
4137
register: admin_password_output
4238

4339
- name: Show Nexus admin password

Ansible/nexus/invnetory.ini

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
[nexus_servers]
2-
osd1 ansible_host=137.184.107.93 ansible_user=root
3-
osd2 ansible_host=165.227.196.171 ansible_user=root
4-
osd3 ansible_host=157.230.85.171 ansible_user=root
2+
nexus-server ansible_host=159.89.94.148 ansible_user=root

Ansible/nexus/vars.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
nexus_image: "sonatype/nexus3:latest"
3+
nexus_data_dir: "/mnt/nexus/nexus-data"
4+
nexus_container_name: "nexus"
5+
nexus_port: 8081
6+
nexus_admin_password_file: "/nexus-data/admin.password"
7+
nexus_parent_dir: "/mnt/nexus"

0 commit comments

Comments
 (0)