feat(core-git): каркас машины CT 904 под Gitea до миграции
ansible-core-git / deploy (push) Successful in 27s
ansible-core-mon / deploy (push) Successful in 24s
ansible-core-net / deploy (push) Successful in 54s
ansible-core-secrets / deploy (push) Successful in 18s
ansible-ger-nod-02 / deploy (push) Successful in 1m15s
ansible-opnsense / deploy (push) Successful in 6s
ansible-rus-central / deploy (push) Successful in 50s
ansible-core-git / deploy (push) Successful in 27s
ansible-core-mon / deploy (push) Successful in 24s
ansible-core-net / deploy (push) Successful in 54s
ansible-core-secrets / deploy (push) Successful in 18s
ansible-ger-nod-02 / deploy (push) Successful in 1m15s
ansible-opnsense / deploy (push) Successful in 6s
ansible-rus-central / deploy (push) Successful in 50s
Добавляет terraform/ansible/CI и scrape cAdvisor. Стек Gitea без POSTGRES_PASSWORD в Infisical не поднимается — данные придут с CT 109. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
090a92174b
commit
c507ed1fdb
15 files changed
+315
-11
No files matched your search
@@ -0,0 +1,63 @@
|
||||
---
|
||||
- name: Есть ли данные Postgres (после миграции)
|
||||
ansible.builtin.stat:
|
||||
path: "{{ gitea_dir }}/postgres/PG_VERSION"
|
||||
register: gitea_postgres_data
|
||||
|
||||
- name: Есть ли уже регистрация runner
|
||||
ansible.builtin.stat:
|
||||
path: "{{ gitea_dir }}/runner-data/.runner"
|
||||
register: gitea_runner_file
|
||||
|
||||
- name: Нужен ли пароль для запуска стека
|
||||
ansible.builtin.set_fact:
|
||||
gitea_stack_ready: "{{ (gitea_postgres_password | default('') | length > 0) }}"
|
||||
|
||||
- name: Без пароля стек не поднимаем (ожидается миграция)
|
||||
ansible.builtin.debug:
|
||||
msg: "GITEA_POSTGRES_PASSWORD пуст — каталоги при необходимости создадим, compose/up пропустим."
|
||||
when: not gitea_stack_ready
|
||||
|
||||
- name: Пароль обязателен, если данные БД уже на диске
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- gitea_postgres_password | length > 0
|
||||
fail_msg: "Есть данные Postgres в {{ gitea_dir }}/postgres, но GITEA_POSTGRES_PASSWORD пуст."
|
||||
when: gitea_postgres_data.stat.exists | default(false)
|
||||
|
||||
- name: Включить runner при токене или существующем .runner
|
||||
ansible.builtin.set_fact:
|
||||
gitea_runner_enabled: "{{ gitea_stack_ready and ((gitea_runner_registration_token | default('') | length > 0) or (gitea_runner_file.stat.exists | default(false))) }}"
|
||||
|
||||
- name: Создать каталоги Gitea
|
||||
ansible.builtin.file:
|
||||
path: "{{ item.path }}"
|
||||
state: directory
|
||||
owner: "{{ item.owner }}"
|
||||
group: "{{ item.group }}"
|
||||
mode: "{{ item.mode }}"
|
||||
loop:
|
||||
- { path: "{{ gitea_dir }}", owner: "root", group: "root", mode: "0755" }
|
||||
- { path: "{{ gitea_dir }}/gitea", owner: "root", group: "root", mode: "0755" }
|
||||
- { path: "{{ gitea_dir }}/postgres", owner: "999", group: "999", mode: "0700" }
|
||||
- { path: "{{ gitea_dir }}/runner-data", owner: "root", group: "root", mode: "0700" }
|
||||
|
||||
- name: Установить compose.yaml для Gitea
|
||||
ansible.builtin.template:
|
||||
src: compose.yaml.j2
|
||||
dest: "{{ gitea_dir }}/compose.yaml"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0600"
|
||||
no_log: true
|
||||
when: gitea_stack_ready
|
||||
|
||||
- name: Запустить Gitea
|
||||
ansible.builtin.command: docker compose -f {{ gitea_dir }}/compose.yaml up -d --remove-orphans
|
||||
register: gitea_compose_up
|
||||
changed_when: >-
|
||||
'Started' in gitea_compose_up.stderr or
|
||||
'Created' in gitea_compose_up.stderr or
|
||||
'Recreated' in gitea_compose_up.stderr or
|
||||
'Pulled' in gitea_compose_up.stderr
|
||||
when: gitea_stack_ready
|
||||
Reference in new issue
Block a user