mirror of
https://github.com/ublue-os/forge.git
synced 2025-07-13 05:05:46 +03:00
feat: add graphical user interface (#34)
This commit is contained in:
parent
c3ed45a21b
commit
4f2130bcce
43 changed files with 2939 additions and 971 deletions
12
anvil/ansible/.ansible-lint
Normal file
12
anvil/ansible/.ansible-lint
Normal file
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
# .ansible-lint
|
||||
|
||||
# https://ansible-lint.readthedocs.io/profiles/
|
||||
profile: production
|
||||
|
||||
# Ansible-lint does not fail on warnings from the rules or tags listed below
|
||||
warn_list:
|
||||
- galaxy[version-incorrect]
|
||||
- no-jinja-nesting
|
||||
- package-latest
|
||||
- name[template]
|
8
anvil/ansible/collections/requirements.yml
Normal file
8
anvil/ansible/collections/requirements.yml
Normal file
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
collections:
|
||||
- name: ansible.posix
|
||||
version: 1.5.4
|
||||
- name: community.general
|
||||
version: 8.6.0
|
||||
- name: containers.podman
|
||||
version: 1.13.0
|
5
anvil/ansible/group_vars/all/git.yml
Normal file
5
anvil/ansible/group_vars/all/git.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
# git variables
|
||||
forge_git_repository_url: "https://github.com/ublue-os/bluefin.git"
|
||||
forge_git_repository_destination: "{{ forge_data_volume_mountpoint }}/data/bluefin"
|
||||
forge_git_repository_version: "main"
|
3
anvil/ansible/group_vars/all/registry.yml
Normal file
3
anvil/ansible/group_vars/all/registry.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
# container registry variables
|
||||
forge_registry_url: "registry.ublue.local"
|
4
anvil/ansible/host_vars/localhost.yml
Normal file
4
anvil/ansible/host_vars/localhost.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
# localhost variables
|
||||
ansible_connection: local
|
||||
ansible_python_interpreter: "{{ ansible_playbook_python }}"
|
9
anvil/ansible/inventory.yml
Normal file
9
anvil/ansible/inventory.yml
Normal file
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
all:
|
||||
hosts:
|
||||
localhost:
|
||||
host.ublue.local:
|
||||
ansible_host: host.containers.internal
|
||||
ansible_user: "{{ lookup('ansible.builtin.env', 'ANSIBLE_HOST_USER') }}"
|
||||
ansible_become_password: "{{ lookup('ansible.builtin.env', 'ANSIBLE_HOST_BECOME_PASSWORD') }}"
|
||||
children:
|
54
anvil/ansible/playbooks/configure_host.yml
Normal file
54
anvil/ansible/playbooks/configure_host.yml
Normal file
|
@ -0,0 +1,54 @@
|
|||
---
|
||||
- name: Configure host system
|
||||
hosts: host.ublue.local
|
||||
gather_facts: true
|
||||
pre_tasks:
|
||||
- name: Get information on podman volume ublue-os_forge_data
|
||||
containers.podman.podman_volume_info:
|
||||
name: ublue-os_forge-data
|
||||
register: __podman_volume_info
|
||||
|
||||
- name: Persist podman ublue-os_forge_data mountpoint
|
||||
ansible.builtin.set_fact:
|
||||
forge_data_volume_mountpoint: "{{ __podman_volume_info.volumes[0].Mountpoint }}"
|
||||
cacheable: true
|
||||
|
||||
tasks:
|
||||
- name: Add ublue.local entries to /etc/hosts
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/hosts
|
||||
search_string: 127.0.0.1 rvproxy.ublue.local registry.ublue.local forge.ublue.local
|
||||
line: 127.0.0.1 rvproxy.ublue.local registry.ublue.local forge.ublue.local
|
||||
state: present
|
||||
become: true
|
||||
|
||||
- name: Add ublue.local TSL root certificate to trust anchors
|
||||
ansible.builtin.copy:
|
||||
src: /certs/tls/ublue-os_forge-root.pem
|
||||
dest: /etc/pki/ca-trust/source/anchors/ublue-os_forge-root.pem
|
||||
force: true
|
||||
mode: "0644"
|
||||
become: true
|
||||
|
||||
- name: Update ca-trust store
|
||||
ansible.builtin.command:
|
||||
cmd: update-ca-trust
|
||||
changed_when: false
|
||||
become: true
|
||||
|
||||
- name: Create example extra-vars configuration file
|
||||
ansible.builtin.copy:
|
||||
dest: "{{ forge_data_volume_mountpoint }}/forge_example_vars.yml"
|
||||
content: |
|
||||
## ublue-os forge extra-vars example configuration
|
||||
## For more details got to https://github.com/ublue-os/forge/blob/main/docs/variables.md
|
||||
---
|
||||
{% for item in __vars_used %}
|
||||
{{ item }}: {{ lookup('ansible.builtin.vars', item) }}
|
||||
{% endfor %}
|
||||
backup: true
|
||||
owner: "{{ ansible_facts.env.USER }}"
|
||||
mode: "0644"
|
||||
vars:
|
||||
__vars_used: "{{ lookup('ansible.builtin.varnames', __regex_search, wantlist=true) }}"
|
||||
__regex_search: ^forge_(?!data).+
|
29
anvil/ansible/playbooks/project_build.yml
Normal file
29
anvil/ansible/playbooks/project_build.yml
Normal file
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
- name: Build project
|
||||
hosts: host.ublue.local
|
||||
gather_facts: true
|
||||
pre_tasks:
|
||||
- name: DEBUG - forge variables
|
||||
ansible.builtin.include_role:
|
||||
name: debug_forge_vars
|
||||
|
||||
tasks:
|
||||
- name: Build and push image to registry
|
||||
containers.podman.podman_image:
|
||||
name: "{{ forge_git_repository_url | regex_search(__regex_search) }}"
|
||||
tag: latest
|
||||
path: "{{ forge_git_repository_destination }}"
|
||||
build:
|
||||
file: Containerfile
|
||||
format: oci
|
||||
pull: false
|
||||
push: true
|
||||
push_args:
|
||||
dest: "{{ forge_registry_url }}"
|
||||
vars:
|
||||
__regex_search: (?<=/)[^/]+(?=\.git)
|
||||
register: __podman_image_info
|
||||
|
||||
- name: INFO | Status from build and push
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ __podman_image_info }}"
|
19
anvil/ansible/playbooks/project_clone.yml
Normal file
19
anvil/ansible/playbooks/project_clone.yml
Normal file
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
- name: Clone project
|
||||
hosts: host.ublue.local
|
||||
gather_facts: true
|
||||
pre_tasks:
|
||||
- name: DEBUG - forge variables
|
||||
ansible.builtin.include_role:
|
||||
name: debug_forge_vars
|
||||
tasks:
|
||||
- name: Clone project
|
||||
ansible.builtin.git:
|
||||
repo: "{{ forge_git_repository_url }}"
|
||||
dest: "{{ forge_git_repository_destination }}"
|
||||
version: "{{ forge_git_repository_version }}"
|
||||
register: __git_clone_info
|
||||
|
||||
- name: INFO | Status from git clone
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ __git_clone_info }}"
|
46
anvil/ansible/roles/debug_forge_vars/README.md
Normal file
46
anvil/ansible/roles/debug_forge_vars/README.md
Normal file
|
@ -0,0 +1,46 @@
|
|||
# Role - debug_forge_vars
|
||||
|
||||
This role is used for debugging purposes only.
|
||||
|
||||
## Variables
|
||||
|
||||
The role has the following variables defined.
|
||||
|
||||
### default/main.yml
|
||||
|
||||
In the [main.yml](./defaults/main.yml/) all variables are defined which are
|
||||
used in the context of debugging. Usually end-users should not worry about them to much.
|
||||
|
||||
<!-- markdownlint-disable MD013 -->
|
||||
|
||||
| name | type | default value | description |
|
||||
| ------------------------------- | ---- | ------------- | ------------------------------------------------------------------------------------------- |
|
||||
| `forge_debug_vars_regex_search` | str | ^forge\_.+ | Python regex search term. Useful if you want to print out all variables starting with `xyz` |
|
||||
|
||||
<!-- markdownlint-enable MD013 -->
|
||||
|
||||
## Example Playbook Usage
|
||||
|
||||
This role is best included in a playbook as pre-task:
|
||||
|
||||
```yaml
|
||||
pre_tasks:
|
||||
- name: DEBUG - forge variables
|
||||
ansible.builtin.include_role:
|
||||
name: debug_forge_vars
|
||||
```
|
||||
|
||||
With the role included you can launch the playbook in verbose mode `ansible-playbook -v`.
|
||||
This will print all variables found with the regex search term defined in the `forge_debug_vars_regex_search`
|
||||
variable.
|
||||
|
||||
You can modify the `forge_debug_vars_regex_search` term by changing it via the vars statement
|
||||
|
||||
```yaml
|
||||
pre_tasks:
|
||||
- name: DEBUG - forge git variables
|
||||
ansible.builtin.include_role:
|
||||
name: debug_forge_vars
|
||||
vars:
|
||||
forge_debug_vars_regex_search: ^forge_git.+
|
||||
```
|
2
anvil/ansible/roles/debug_forge_vars/defaults/main.yml
Normal file
2
anvil/ansible/roles/debug_forge_vars/defaults/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Default vars for this role
|
||||
forge_debug_vars_regex_search: "{{ lookup('ansible.builtin.env', 'FORGE_DEBUG_VARS_REGEX_SEARCH', default='^forge_.+') }}"
|
13
anvil/ansible/roles/debug_forge_vars/tasks/main.yml
Normal file
13
anvil/ansible/roles/debug_forge_vars/tasks/main.yml
Normal file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
# main task file for this role
|
||||
|
||||
- name: DEBUG | forge variables
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ item }}: {{ lookup('ansible.builtin.vars', item) }}"
|
||||
verbosity: 1
|
||||
loop: "{{ __forge_vars_used }}"
|
||||
loop_control:
|
||||
extended: true
|
||||
label: "{{ ansible_loop.index }}/{{ ansible_loop.length }}"
|
||||
vars:
|
||||
__forge_vars_used: "{{ lookup('ansible.builtin.varnames', forge_debug_vars_regex_search, wantlist=true) }}"
|
Loading…
Add table
Add a link
Reference in a new issue