Skip to content

Commit e118905

Browse files
committed
Add hotstack_git_server role for GitOps
Creates git repository with daemon for ArgoCD to pull manifests. Integrates with controller role setup. Assisted-By: Claude (claude-4.5-sonnet) Signed-off-by: Harald Jensås <hjensas@redhat.com>
1 parent 9b3a884 commit e118905

7 files changed

Lines changed: 421 additions & 0 deletions

File tree

images/dib/elements/hotstack-controller/package-installs.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ bind-utils:
44
butane:
55
dnsmasq:
66
git:
7+
git-daemon:
78
haproxy:
89
httpd:
910
httpd-tools:

roles/controller/defaults/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ nfs_exports:
1818
mode: '0777' # World writable for container access
1919

2020
controller_install_openstack_client: false
21+
22+
# Hotstack git server for GitOps deployments
23+
hotstack_git_server_enabled: false
24+
2125
hotstack_cloud_secrets:
2226
auth_url: http://cloud.example.com:5000
2327
application_credential_id: app_credential_id

roles/controller/tasks/main.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,8 @@
200200
- name: Install OpenStack client
201201
when: controller_install_openstack_client | bool
202202
ansible.builtin.include_tasks: install_openstack_client.yml
203+
204+
- name: Setup Hotstack git server
205+
when: hotstack_git_server_enabled | bool
206+
ansible.builtin.include_role:
207+
name: hotstack_git_server
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# hotstack_git_server - ansible role
2+
3+
Sets up a git repository and git-daemon on the controller node for GitOps deployments. ArgoCD can pull manifests from this repository.
4+
5+
## Purpose
6+
7+
This role enables true GitOps workflows by:
8+
1. Creating an empty git repository for OpenStack deployment manifests
9+
2. Starting git-daemon to serve the repository
10+
3. Allowing ArgoCD to pull manifests via `git://` protocol
11+
12+
## Features
13+
14+
- Creates git repository at configurable path
15+
- Initializes git with proper configuration
16+
- Starts git-daemon in detached mode on default port 9418
17+
- Installs post-commit hook for ArgoCD refresh
18+
19+
## Variables
20+
21+
| Variable | Default | Description |
22+
|----------|---------|-------------|
23+
| `hotstack_git_server_enabled` | `true` | Enable git server setup |
24+
| `hotstack_git_repo_path` | `{{ base_dir }}/git/openstack-deployment` | Git repository path |
25+
| `hotstack_git_daemon_base_path` | `{{ base_dir }}/git` | Base path for git-daemon |
26+
| `base_dir` | `/home/zuul` | Base directory for git repositories |
27+
28+
## Usage
29+
30+
This role is typically called from the controller role when `hotstack_git_server_enabled` is set to `true` in the scenario's bootstrap variables.
31+
32+
The role only initializes the git repository and starts the daemon. Manifest files must be synced separately using the `sync_files` stage type in your scenario's automation stages.
33+
34+
## Git Repository Structure
35+
36+
The role creates an empty git repository with an initial commit:
37+
38+
```
39+
/home/zuul/git/openstack-deployment/
40+
├── .git/
41+
│ └── hooks/
42+
│ └── post-commit # ArgoCD refresh hook
43+
└── README.md
44+
```
45+
46+
Manifests are added incrementally during the deployment process via git commits in your automation stages.
47+
48+
## ArgoCD Integration
49+
50+
ArgoCD Applications should reference:
51+
52+
```yaml
53+
spec:
54+
source:
55+
repoURL: git://controller-0.openstack.lab/openstack-deployment
56+
targetRevision: main
57+
path: manifests/operators
58+
```
59+
60+
## Git Daemon
61+
62+
The daemon is started on the default port 9418 with:
63+
- `--base-path` - Base directory for repositories
64+
- `--export-all` - Export all repositories
65+
- `--reuseaddr` - Allow quick restarts
66+
- `--enable=receive-pack` - Allow git push (for testing)
67+
- `--verbose` - Log connections
68+
- `--detach` - Run in background
69+
70+
## Security Note
71+
72+
Git daemon has no authentication and is intended for testing environments only. For production, use SSH or HTTPS with proper authentication.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
# Git server configuration for GitOps deployments
3+
hotstack_git_server_enabled: true
4+
base_dir: /home/zuul
5+
6+
# Git daemon configuration
7+
hotstack_git_daemon_base_path: "{{ base_dir }}/git"
8+
9+
# Git repository path
10+
hotstack_git_repo_path: "{{ hotstack_git_daemon_base_path }}/openstack-deployment"

0 commit comments

Comments
 (0)