mirror of
https://github.com/ublue-os/forge.git
synced 2025-07-17 15:15:45 +03:00
wip - finalize
This commit is contained in:
parent
aaa38993bd
commit
45f497cf1f
13 changed files with 48 additions and 56 deletions
|
@ -1,8 +1,12 @@
|
|||
# Don't add the following files to the container
|
||||
|
||||
## Ansible files
|
||||
**/collections/ansible_collections
|
||||
**/fact_cache
|
||||
|
||||
## Python cache
|
||||
**/__pycache__
|
||||
|
||||
## Podman build files
|
||||
.containerignore
|
||||
Containerfile
|
||||
Containerfile
|
||||
|
|
|
@ -13,6 +13,8 @@ ENV POETRY_VIRTUALENVS_IN_PROJECT="true"
|
|||
ENV PATH="${PATH}:${PIPX_BIN_DIR}:${PIPX_HOME}/venvs/poetry/bin:/${PROJECT_DIR}/.venv/bin"
|
||||
## Ansible settings
|
||||
ENV ANSIBLE_INVENTORY="${ANSIBLE_DIR}/inventory.yml"
|
||||
ENV ANSIBLE_CACHE_PLUGIN="community.general.yaml"
|
||||
ENV ANSIBLE_CACHE_PLUGIN_CONNECTION="${ANSIBLE_DIR}/fact_cache"
|
||||
ENV ANSIBLE_ROLES_PATH="${ANSIBLE_DIR}/roles"
|
||||
ENV ANSIBLE_COLLECTIONS_PATH="${ANSIBLE_DIR}/collections"
|
||||
ENV ANSIBLE_PRIVATE_KEY_FILE="/certs/ssh/ublue-os_forge-id_ed25519"
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
[defaults]
|
||||
# Inventory location
|
||||
inventory = ./ansible/inventory.yml
|
||||
# Location for roles
|
||||
roles_path = ./ansible/roles
|
||||
# Location for collections
|
||||
collection_paths = ./ansible/collections
|
||||
# Localtion for plugins & modules
|
||||
library = ./ansible/library
|
||||
# SSH
|
||||
private_key_file = /certs/ssh/ublue-os_forge-id_ed25519
|
||||
# Console log settings
|
||||
display_skipped_hosts = false
|
||||
# Use the YAML callback plugin.
|
||||
stdout_callback = yaml
|
||||
# Use the stdout_callback when running ad-hoc commands.
|
||||
bin_ansible_callbacks = True
|
||||
# Callback plugins
|
||||
callbacks_enabled=ansible.posix.profile_tasks
|
||||
# Skip SSH host key checking
|
||||
host_key_checking = False
|
||||
# Disable cowsay
|
||||
nocows = 1
|
|
@ -1,4 +0,0 @@
|
|||
---
|
||||
# data variables
|
||||
forge_data_path: "{{ lookup('ansible.builtin.env', 'FORGE_DATA_PATH', default=ansible_facts.env.HOME + '/ublue-os_forge') }}"
|
||||
forge_data_default_variables_file_path: "{{ forge_data_path }}/forge_default_vars.env"
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
# git variables
|
||||
forge_git_repository_url: "{{ lookup('ansible.builtin.env', 'FORGE_GIT_REPOSITORY_URL', default='https://github.com/ublue-os/bluefin.git') }}"
|
||||
forge_git_repository_destination: "{{ lookup('ansible.builtin.env', 'FORGE_GIT_REPOSITORY_DESTINATION', default=forge_data_path + '/bluefin') }}"
|
||||
forge_git_repository_version: "{{ lookup('ansible.builtin.env', 'FORGE_GIT_REPOSITORY_VERSION', default='main') }}"
|
||||
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"
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
# container registry variables
|
||||
forge_registry_url: "{{ lookup('ansible.builtin.env', 'FORGE_REGISTRY_URL', default='registry.ublue.local') }}"
|
||||
forge_registry_url: "registry.ublue.local"
|
||||
|
|
|
@ -2,6 +2,17 @@
|
|||
- 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:
|
||||
|
@ -25,25 +36,19 @@
|
|||
changed_when: false
|
||||
become: true
|
||||
|
||||
- name: Create default directory for forge content
|
||||
ansible.builtin.file:
|
||||
path: "{{ forge_data_path }}"
|
||||
state: directory
|
||||
mode: "0755"
|
||||
|
||||
- name: Create default configuration variable file
|
||||
- name: Create example extra-vars configuration file
|
||||
ansible.builtin.copy:
|
||||
dest: "{{ forge_data_default_variables_file_path }}"
|
||||
dest: "{{ forge_data_volume_mountpoint }}/forge_example_vars.yml"
|
||||
content: |
|
||||
## ublue-os forge configuration variables defaults
|
||||
## 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 | upper }}={{ lookup('ansible.builtin.vars', item) }}
|
||||
{{ 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_.+
|
||||
__regex_search: ^forge_(?!data).+
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
- name: DEBUG | forge variables
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ item }}: {{ lookup('ansible.builtin.vars', item) }}"
|
||||
# verbosity: 1
|
||||
verbosity: 1
|
||||
loop: "{{ __forge_vars_used }}"
|
||||
loop_control:
|
||||
extended: true
|
||||
|
|
|
@ -27,13 +27,15 @@ async def load_configuration_file() -> None:
|
|||
ANSIBLE_EXTRA_VARS = f"@{file_path}"
|
||||
|
||||
|
||||
async def run_ansible_playbook(playbook_name: str, gui_log: ui.log, gui_spinner: GuiProgressSpinner) -> None:
|
||||
async def run_ansible_playbook(
|
||||
playbook_name: str, gui_log: ui.log, gui_spinner: GuiProgressSpinner
|
||||
) -> None:
|
||||
# Clear log console
|
||||
gui_log.clear()
|
||||
# Enable spinner
|
||||
gui_spinner.enable()
|
||||
# Run ansible playbook
|
||||
project_root = os.environ['ANSIBLE_DIR']
|
||||
project_root = os.environ["ANSIBLE_DIR"]
|
||||
playbook_path = f"{project_root}/playbooks/"
|
||||
extra_vars_file = ANSIBLE_EXTRA_VARS
|
||||
thread, runner = ansible_runner.interface.run_command_async(
|
||||
|
@ -55,7 +57,7 @@ async def run_ansible_playbook(playbook_name: str, gui_log: ui.log, gui_spinner:
|
|||
# Make sure log is displayed during playbook run
|
||||
await asyncio.sleep(0.1)
|
||||
# Check if event has been processed already
|
||||
event_key = (event['uuid'], event['counter'])
|
||||
event_key = (event["uuid"], event["counter"])
|
||||
if event_key not in processed_events:
|
||||
# Add event to processed set
|
||||
processed_events.add(event_key)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue