Update 4 files
- /roles/gitlab/tasks/main.yml - /roles/gitlab/templates/docker-compose.gitlab.yml.j2 - /olimp-deploy.yml - /inventories/hosts
This commit is contained in:
parent
56d5e6d761
commit
64ff956221
@ -9,7 +9,7 @@ talk ansible_host=192.168.1.206 int_ip=192.168.1.206 ansible_python_i
|
|||||||
games ansible_host=192.168.1.207 int_ip=192.168.1.207 ansible_python_interpreter=/usr/bin/python3
|
games ansible_host=192.168.1.207 int_ip=192.168.1.207 ansible_python_interpreter=/usr/bin/python3
|
||||||
manage ansible_host=192.168.1.208 int_ip=192.168.1.208 ansible_python_interpreter=/usr/bin/python3
|
manage ansible_host=192.168.1.208 int_ip=192.168.1.208 ansible_python_interpreter=/usr/bin/python3
|
||||||
git ansible_host=192.168.1.209 int_ip=192.168.1.209 ansible_python_interpreter=/usr/bin/python3
|
git ansible_host=192.168.1.209 int_ip=192.168.1.209 ansible_python_interpreter=/usr/bin/python3
|
||||||
ansible ansible_host=192.168.1.210 int_ip=192.168.1.192.168.1.210 ansible_python_interpreter=/usr/bin/python3
|
ansible ansible_host=192.168.1.210 int_ip=192.168.1.210 ansible_python_interpreter=/usr/bin/python3
|
||||||
#gitlab ansible_host=192.168.1.229 int_ip=192.168.1.229 ansible_python_interpreter=/usr/bin/python3
|
#gitlab ansible_host=192.168.1.229 int_ip=192.168.1.229 ansible_python_interpreter=/usr/bin/python3
|
||||||
|
|
||||||
[pve-server]
|
[pve-server]
|
||||||
@ -30,8 +30,17 @@ photo
|
|||||||
[talk-server]
|
[talk-server]
|
||||||
talk
|
talk
|
||||||
|
|
||||||
|
#[cloud-server]
|
||||||
|
#cloud
|
||||||
|
|
||||||
[games-server]
|
[games-server]
|
||||||
games
|
games
|
||||||
|
|
||||||
[manage-server]
|
[manage-server]
|
||||||
manage
|
manage
|
||||||
|
|
||||||
|
[git-server]
|
||||||
|
git
|
||||||
|
|
||||||
|
[ansible-server]
|
||||||
|
ansible
|
||||||
@ -58,4 +58,10 @@
|
|||||||
- { role: docker, tags: deploy_docker }
|
- { role: docker, tags: deploy_docker }
|
||||||
- { role: meshcentral, tags: deploy_meshcentral }
|
- { role: meshcentral, tags: deploy_meshcentral }
|
||||||
- { role: grafana, tags: deploy_grafana }
|
- { role: grafana, tags: deploy_grafana }
|
||||||
- { role: loki, tags: deploy_loki }
|
- { role: loki, tags: deploy_loki }
|
||||||
|
- hosts: git-server
|
||||||
|
roles:
|
||||||
|
- { role: base_setup, tags: deploy_base }
|
||||||
|
- { role: docker, tags: deploy_docker }
|
||||||
|
- { role: gitlab, tags: deploy_gitlab }
|
||||||
|
- { role: promtail, tags: deploy_promtail }
|
||||||
48
roles/gitlab/tasks/main.yml
Normal file
48
roles/gitlab/tasks/main.yml
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
---
|
||||||
|
- name: Create GitLab directories
|
||||||
|
file:
|
||||||
|
path: "{{ item }}"
|
||||||
|
state: directory
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: '0755'
|
||||||
|
loop:
|
||||||
|
- "{{ gitlab_config_dir }}"
|
||||||
|
- "{{ gitlab_logs_dir }}"
|
||||||
|
- "{{ gitlab_data_dir }}"
|
||||||
|
- "{{ gitlab_backup_dir }}"
|
||||||
|
|
||||||
|
- name: Deploy Docker Compose file for GitLab
|
||||||
|
template:
|
||||||
|
src: docker-compose.gitlab.yml.j2
|
||||||
|
dest: "{{ gitlab_base_dir }}/docker-compose.yml"
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
- name: Start GitLab container
|
||||||
|
community.docker.docker_compose:
|
||||||
|
project_src: "{{ gitlab_base_dir }}"
|
||||||
|
build: no
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Wait for GitLab to be ready (first boot can take 5-10 minutes)
|
||||||
|
wait_for:
|
||||||
|
host: "{{ ansible_host }}"
|
||||||
|
port: "{{ gitlab_http_port }}"
|
||||||
|
timeout: 600
|
||||||
|
state: started
|
||||||
|
delay: 30
|
||||||
|
|
||||||
|
- name: Check GitLab status
|
||||||
|
uri:
|
||||||
|
url: "http://{{ ansible_host }}:{{ gitlab_http_port }}/users/sign_in"
|
||||||
|
status_code: 200
|
||||||
|
timeout: 30
|
||||||
|
register: gitlab_status
|
||||||
|
until: gitlab_status.status == 200
|
||||||
|
retries: 20
|
||||||
|
delay: 30
|
||||||
|
|
||||||
|
- name: Show GitLab status
|
||||||
|
debug:
|
||||||
|
msg: "GitLab is running and accessible at http://{{ ansible_host }}:{{ gitlab_http_port }}"
|
||||||
|
when: gitlab_status.status == 200
|
||||||
37
roles/gitlab/templates/docker-compose.gitlab.yml.j2
Normal file
37
roles/gitlab/templates/docker-compose.gitlab.yml.j2
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
version: '3.8'
|
||||||
|
services:
|
||||||
|
gitlab:
|
||||||
|
image: gitlab/gitlab-ce:{{ gitlab_version }}
|
||||||
|
container_name: gitlab
|
||||||
|
restart: always
|
||||||
|
hostname: '{{ gitlab_hostname }}'
|
||||||
|
environment:
|
||||||
|
GITLAB_OMNIBUS_CONFIG: |
|
||||||
|
external_url '{{ gitlab_external_url }}'
|
||||||
|
gitlab_rails['gitlab_shell_ssh_port'] = {{ gitlab_ssh_port }}
|
||||||
|
nginx['listen_port'] = 80
|
||||||
|
nginx['listen_https'] = false
|
||||||
|
letsencrypt['enable'] = false
|
||||||
|
gitlab_rails['initial_root_password'] = '{{ gitlab_root_password }}'
|
||||||
|
gitlab_rails['time_zone'] = '{{ timezone }}'
|
||||||
|
# Отключаем встроенный мониторинг для экономии ресурсов
|
||||||
|
prometheus_monitoring['enable'] = false
|
||||||
|
node_exporter['enable'] = false
|
||||||
|
redis_exporter['enable'] = false
|
||||||
|
postgres_exporter['enable'] = false
|
||||||
|
gitaly['prometheus_listen_addr'] = false
|
||||||
|
ports:
|
||||||
|
- "{{ gitlab_http_port }}:80"
|
||||||
|
- "{{ gitlab_ssh_port }}:22"
|
||||||
|
volumes:
|
||||||
|
- '{{ gitlab_config_dir }}:/etc/gitlab'
|
||||||
|
- '{{ gitlab_logs_dir }}:/var/log/gitlab'
|
||||||
|
- '{{ gitlab_data_dir }}:/var/opt/gitlab'
|
||||||
|
- '{{ gitlab_backup_dir }}:/var/opt/gitlab/backups'
|
||||||
|
shm_size: '256m'
|
||||||
|
networks:
|
||||||
|
- gitlab-network
|
||||||
|
|
||||||
|
networks:
|
||||||
|
gitlab-network:
|
||||||
|
driver: bridge
|
||||||
Loading…
Reference in New Issue
Block a user