mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-19 22:35:50 +00:00
ansible setup added
This commit is contained in:
parent
44cc836418
commit
d3c7f6599b
10 changed files with 73 additions and 0 deletions
11
cicd/ansible_setup/README.md
Normal file
11
cicd/ansible_setup/README.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
# Ansible CI/CD Setup
|
||||
|
||||
This Ansible playbook provisions Jenkins, Nexus for a local CI/CD pipeline.
|
||||
|
||||
## How to Use
|
||||
|
||||
1. Install Ansible: `sudo apt install ansible`.
|
||||
2. Run the playbook: `ansible-playbook -i inventory/local site.yml`.
|
||||
3. Verify:
|
||||
- Jenkins: http://localhost:8080
|
||||
- Nexus: http://localhost:8081
|
5
cicd/ansible_setup/group_vars/all.yml
Normal file
5
cicd/ansible_setup/group_vars/all.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
java_version: applejdk-17
|
||||
jenkins_url: "http://localhost:8080"
|
||||
ansible_become_password: <password>
|
||||
|
2
cicd/ansible_setup/inventory/local
Normal file
2
cicd/ansible_setup/inventory/local
Normal file
|
@ -0,0 +1,2 @@
|
|||
[local]
|
||||
localhost ansible_connection=local
|
10
cicd/ansible_setup/roles/jenkins_agent/tasks/main.yml
Normal file
10
cicd/ansible_setup/roles/jenkins_agent/tasks/main.yml
Normal file
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
|
||||
- name: Start Jenkins agent
|
||||
shell: |
|
||||
curl -sO {{ jenkins_url }}/jnlpJars/agent.jar;
|
||||
java -jar agent.jar -url {{ jenkins_url }} -secret {{ jenkins_agent_secret }} -name agent1 -webSocket -workDir "{{ jenkins_agent_dir }}"
|
||||
args:
|
||||
become: true
|
||||
async: 60
|
||||
poll: 0
|
3
cicd/ansible_setup/roles/jenkins_agent/vars/main.yml
Normal file
3
cicd/ansible_setup/roles/jenkins_agent/vars/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
jenkins_agent_dir: "/tmp/jenkins-agent"
|
||||
jenkins_agent_secret: <jenkins-secret-token>
|
13
cicd/ansible_setup/roles/jenkins_master/tasks/main.yml
Normal file
13
cicd/ansible_setup/roles/jenkins_master/tasks/main.yml
Normal file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
- name: Install Jenkins
|
||||
homebrew:
|
||||
name: jenkins-lts
|
||||
state: present
|
||||
|
||||
- name: Start Jenkins Controller
|
||||
shell: |
|
||||
nohup /opt/homebrew/opt/openjdk@21/bin/java -Dmail.smtp.starttls.enable\=true -jar /opt/homebrew/opt/jenkins-lts/libexec/jenkins.war --httpListenAddress\=127.0.0.1 --httpPort\=8080
|
||||
become: true
|
||||
async: 60
|
||||
poll: 0
|
||||
ignore_errors: true
|
2
cicd/ansible_setup/roles/jenkins_master/vars/main.yml
Normal file
2
cicd/ansible_setup/roles/jenkins_master/vars/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
jenkins_dir: "/Users/moleksiienko/devopstest/jenkins"
|
18
cicd/ansible_setup/roles/nexus/tasks/main.yml
Normal file
18
cicd/ansible_setup/roles/nexus/tasks/main.yml
Normal file
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
- name: Unarchive Nexus package
|
||||
unarchive:
|
||||
src: "{{ nexus_dir }}/nexus.tar.gz"
|
||||
dest: "/opt"
|
||||
remote_src: yes
|
||||
creates: "{{ nexus_dir }}/nexus-3.43.0-01"
|
||||
|
||||
- name: Start Nexus repository
|
||||
shell: |
|
||||
nohup {{ nexus_dir }}/nexus-3.43.0-01/bin/nexus run
|
||||
become: true
|
||||
async: 60
|
||||
poll: 0
|
||||
ignore_errors: true
|
||||
|
||||
|
||||
|
2
cicd/ansible_setup/roles/nexus/vars/main.yml
Normal file
2
cicd/ansible_setup/roles/nexus/vars/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
nexus_dir: "/Users/moleksiienko/devopstest/nexus"
|
7
cicd/ansible_setup/site.yml
Normal file
7
cicd/ansible_setup/site.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
- hosts: local
|
||||
roles:
|
||||
- jenkins_master
|
||||
- jenkins_agent
|
||||
- nexus
|
||||
|
Loading…
Reference in a new issue