k8s/roles/flux/tasks/bootstrap.yml
2026-07-15 11:14:21 +03:00

26 lines
951 B
YAML

---
- name: Bootstrap | Verify GITLAB_FLUX_TOKEN is set
ansible.builtin.assert:
that:
- flux_gitlab_token | length > 0
fail_msg: "GITLAB_FLUX_TOKEN environment variable is not set — cannot bootstrap Flux"
success_msg: "GitLab token is present"
- name: Bootstrap | Run flux bootstrap gitlab
ansible.builtin.command:
argv: >-
{{ ['flux', 'bootstrap', 'gitlab',
'--hostname=' + flux_gitlab_hostname,
'--owner=' + flux_gitlab_owner,
'--repository=' + flux_gitlab_repository,
'--branch=' + flux_gitlab_branch,
'--path=' + flux_gitlab_path,
'--private=true']
+ (['--personal'] if flux_gitlab_personal | bool else []) }}
environment:
KUBECONFIG: "{{ flux_kubeconfig }}"
GITLAB_TOKEN: "{{ flux_gitlab_token }}"
PATH: "/usr/local/bin:/usr/bin:/bin"
register: _flux_bootstrap
changed_when: "'already exists' not in _flux_bootstrap.stderr"