mirror of
https://github.com/ublue-os/forge.git
synced 2025-04-21 05:53:45 +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_file: "Containerfile"
|
||||||
forge_container_format: "oci"
|
forge_container_format: "oci"
|
||||||
|
forge_container_extra_args: []
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
# git variables
|
# git variables
|
||||||
forge_git_repository_url: "https://github.com/ublue-os/bluefin.git"
|
forge_git_repository_url: ""
|
||||||
forge_git_repository_destination: "{{ forge_data_volume_mountpoint }}/data/bluefin"
|
forge_git_repository_destination: ""
|
||||||
forge_git_repository_version: "main"
|
forge_git_repository_version: "main"
|
||||||
|
|
|
@ -36,19 +36,19 @@
|
||||||
changed_when: false
|
changed_when: false
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: Create example extra-vars configuration file
|
- name: Create example directory
|
||||||
ansible.builtin.copy:
|
ansible.builtin.file:
|
||||||
dest: "{{ forge_data_volume_mountpoint }}/forge_example_vars.yml"
|
path: "{{ forge_data_volume_mountpoint }}/examples/"
|
||||||
content: |
|
state: directory
|
||||||
## ublue-os forge extra-vars example configuration
|
mode: "0755"
|
||||||
## For more details got to https://github.com/ublue-os/forge/blob/main/docs/variables.md
|
|
||||||
---
|
- name: Create example configuration files
|
||||||
{% for item in __vars_used %}
|
ansible.builtin.template:
|
||||||
{{ item }}: {{ lookup('ansible.builtin.vars', item) }}
|
src: "{{ item }}"
|
||||||
{% endfor %}
|
dest: "{{ forge_data_volume_mountpoint }}/examples/{{ item | regex_search(__regex_search) }}"
|
||||||
backup: true
|
backup: true
|
||||||
owner: "{{ ansible_facts.env.USER }}"
|
owner: "{{ ansible_facts.env.USER }}"
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
|
with_fileglob: "files/examples/*"
|
||||||
vars:
|
vars:
|
||||||
__vars_used: "{{ lookup('ansible.builtin.varnames', __regex_search, wantlist=true) }}"
|
__regex_search: "[^\/]+$"
|
||||||
__regex_search: ^forge_(?!data).+
|
|
||||||
|
|
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
|
- name: Build project
|
||||||
hosts: host.ublue.local
|
hosts: host.ublue.local
|
||||||
gather_facts: true
|
gather_facts: true
|
||||||
vars:
|
|
||||||
__image_regex_search: (?<=/)[^/]+(?=\.git)
|
|
||||||
__image_name: "{{ forge_registry_url }}/{{ forge_git_repository_url | regex_search(__image_regex_search) }}"
|
|
||||||
pre_tasks:
|
pre_tasks:
|
||||||
- name: DEBUG - forge variables
|
- name: DEBUG - forge variables
|
||||||
ansible.builtin.include_role:
|
ansible.builtin.include_role:
|
||||||
|
@ -13,13 +10,13 @@
|
||||||
tasks:
|
tasks:
|
||||||
- name: Build and upload container image
|
- name: Build and upload container image
|
||||||
containers.podman.podman_image:
|
containers.podman.podman_image:
|
||||||
name: "{{ __image_name }}"
|
name: "{{ forge_container_name }}"
|
||||||
tag: latest
|
tag: latest
|
||||||
path: "{{ forge_git_repository_destination }}"
|
path: "{{ forge_git_repository_destination }}"
|
||||||
build:
|
build:
|
||||||
file: "{{ forge_container_file | default('Containerfile') }}"
|
file: "{{ forge_container_file }}"
|
||||||
format: "{{ forge_container_format | default('oci') }}"
|
format: "{{ forge_container_format }}"
|
||||||
extra_args: "{{ forge_container_extra_args | default([]) | join(' ') }}"
|
extra_args: "{{ forge_container_extra_args | join(' ') }}"
|
||||||
pull: false
|
pull: false
|
||||||
push: true
|
push: true
|
||||||
async: 900
|
async: 900
|
||||||
|
@ -42,13 +39,13 @@
|
||||||
|
|
||||||
- name: Add additional tag to container image
|
- name: Add additional tag to container image
|
||||||
containers.podman.podman_tag:
|
containers.podman.podman_tag:
|
||||||
image: "{{ __image_name }}:latest"
|
image: "{{ forge_container_name }}:latest"
|
||||||
target_names:
|
target_names:
|
||||||
- "{{ __image_name }}:{{ forge_container_tag }}"
|
- "{{ forge_container_name }}:{{ forge_container_tag }}"
|
||||||
|
|
||||||
- name: Push additional container image tag to registry
|
- name: Push additional container image tag to registry
|
||||||
containers.podman.podman_image:
|
containers.podman.podman_image:
|
||||||
name: "{{ __image_name }}"
|
name: "{{ forge_container_name }}"
|
||||||
tag: "{{ forge_container_tag }}"
|
tag: "{{ forge_container_tag }}"
|
||||||
pull: false
|
pull: false
|
||||||
push: true
|
push: true
|
||||||
|
|
|
@ -14,7 +14,9 @@ ANSIBLE_EXTRA_VARS = None
|
||||||
async def load_configuration_file() -> None:
|
async def load_configuration_file() -> None:
|
||||||
global ANSIBLE_EXTRA_VARS
|
global ANSIBLE_EXTRA_VARS
|
||||||
result = await local_file_picker(
|
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]
|
file_path = result[0]
|
||||||
with open(file_path, "r") as file:
|
with open(file_path, "r") as file:
|
||||||
|
|
Loading…
Reference in a new issue