mirror of
https://github.com/ublue-os/forge.git
synced 2025-04-12 09:43:44 +03:00
feat(ansible): add example configurations to the setup (#45)
This commit is contained in:
parent
327c010ddd
commit
e0df50076e
|
@ -1,3 +1,6 @@
|
|||
---
|
||||
forge_container_name: "{{ forge_registry_url }}/{{ forge_git_repository_url | regex_search('(?<=/)[^/]+(?=\\.git)') }}"
|
||||
forge_container_tag: "{{ ansible_date_time.date }}_{{ ansible_date_time.time | replace(':','')}}"
|
||||
forge_container_file: "Containerfile"
|
||||
forge_container_format: "oci"
|
||||
forge_container_extra_args: []
|
||||
|
|
|
@ -1,5 +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_url: ""
|
||||
forge_git_repository_destination: ""
|
||||
forge_git_repository_version: "main"
|
||||
|
|
|
@ -36,19 +36,19 @@
|
|||
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 %}
|
||||
- name: Create example directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ forge_data_volume_mountpoint }}/examples/"
|
||||
state: directory
|
||||
mode: "0755"
|
||||
|
||||
- name: Create example configuration files
|
||||
ansible.builtin.template:
|
||||
src: "{{ item }}"
|
||||
dest: "{{ forge_data_volume_mountpoint }}/examples/{{ item | regex_search(__regex_search) }}"
|
||||
backup: true
|
||||
owner: "{{ ansible_facts.env.USER }}"
|
||||
mode: "0644"
|
||||
with_fileglob: "files/examples/*"
|
||||
vars:
|
||||
__vars_used: "{{ lookup('ansible.builtin.varnames', __regex_search, wantlist=true) }}"
|
||||
__regex_search: ^forge_(?!data).+
|
||||
__regex_search: "[^\/]+$"
|
||||
|
|
11
anvil/ansible/playbooks/files/examples/bluefin-39.yml
Normal file
11
anvil/ansible/playbooks/files/examples/bluefin-39.yml
Normal file
|
@ -0,0 +1,11 @@
|
|||
## ublue-os forge example configuration for bluefin
|
||||
## For more details got to https://github.com/ublue-os/forge/blob/main/docs/variables.md
|
||||
---
|
||||
forge_git_repository_url: https://github.com/ublue-os/bluefin.git
|
||||
forge_git_repository_destination: "{{ forge_data_volume_mountpoint }}/data/bluefin"
|
||||
forge_container_extra_args:
|
||||
- --build-arg="BASE_IMAGE_NAME=silverblue"
|
||||
- --build-arg="IMAGE_FLAVOR=main"
|
||||
- --build-arg="AKMODS_FLAVOR=main"
|
||||
- --build-arg="FEDORA_MAJOR_VERSION=39"
|
||||
- --build-arg="TARGET_BASE=bluefin"
|
|
@ -2,9 +2,6 @@
|
|||
- name: Build project
|
||||
hosts: host.ublue.local
|
||||
gather_facts: true
|
||||
vars:
|
||||
__image_regex_search: (?<=/)[^/]+(?=\.git)
|
||||
__image_name: "{{ forge_registry_url }}/{{ forge_git_repository_url | regex_search(__image_regex_search) }}"
|
||||
pre_tasks:
|
||||
- name: DEBUG - forge variables
|
||||
ansible.builtin.include_role:
|
||||
|
@ -13,13 +10,13 @@
|
|||
tasks:
|
||||
- name: Build and upload container image
|
||||
containers.podman.podman_image:
|
||||
name: "{{ __image_name }}"
|
||||
name: "{{ forge_container_name }}"
|
||||
tag: latest
|
||||
path: "{{ forge_git_repository_destination }}"
|
||||
build:
|
||||
file: "{{ forge_container_file | default('Containerfile') }}"
|
||||
format: "{{ forge_container_format | default('oci') }}"
|
||||
extra_args: "{{ forge_container_extra_args | default([]) | join(' ') }}"
|
||||
file: "{{ forge_container_file }}"
|
||||
format: "{{ forge_container_format }}"
|
||||
extra_args: "{{ forge_container_extra_args | join(' ') }}"
|
||||
pull: false
|
||||
push: true
|
||||
async: 900
|
||||
|
@ -42,13 +39,13 @@
|
|||
|
||||
- name: Add additional tag to container image
|
||||
containers.podman.podman_tag:
|
||||
image: "{{ __image_name }}:latest"
|
||||
image: "{{ forge_container_name }}:latest"
|
||||
target_names:
|
||||
- "{{ __image_name }}:{{ forge_container_tag }}"
|
||||
- "{{ forge_container_name }}:{{ forge_container_tag }}"
|
||||
|
||||
- name: Push additional container image tag to registry
|
||||
containers.podman.podman_image:
|
||||
name: "{{ __image_name }}"
|
||||
name: "{{ forge_container_name }}"
|
||||
tag: "{{ forge_container_tag }}"
|
||||
pull: false
|
||||
push: true
|
||||
|
|
|
@ -14,7 +14,9 @@ ANSIBLE_EXTRA_VARS = None
|
|||
async def load_configuration_file() -> None:
|
||||
global ANSIBLE_EXTRA_VARS
|
||||
result = await local_file_picker(
|
||||
directory="/data", multiple=False, file_name_filter=".yml"
|
||||
directory="/data",
|
||||
multiple=False,
|
||||
# file_name_filter=".yml", # TODO: limit to yml files but make sure folders are visible as well
|
||||
)
|
||||
file_path = result[0]
|
||||
with open(file_path, "r") as file:
|
||||
|
|
Loading…
Reference in a new issue