- /roles/gitlab/tasks/main.yml - /roles/gitlab/templates/docker-compose.gitlab.yml.j2 - /olimp-deploy.yml - /inventories/hosts
48 lines
1.2 KiB
YAML
48 lines
1.2 KiB
YAML
---
|
|
- 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 |