From 2874825341910e3dcae4c7e6f50e56a9ed1acda4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20L=C3=BCscher?= Date: Wed, 1 May 2024 16:29:19 +0000 Subject: [PATCH] feat(ansible): playbooks to build and clone projects (#13) --- ansible/group_vars/all.yml | 10 ++++++++++ ansible/host_vars/host.ublue.local.yml | 2 ++ ansible/playbooks/project_build.yml | 17 +++++++++++++++++ ansible/playbooks/project_clone.yml | 10 ++++++++++ 4 files changed, 39 insertions(+) create mode 100644 ansible/group_vars/all.yml create mode 100644 ansible/host_vars/host.ublue.local.yml create mode 100644 ansible/playbooks/project_build.yml create mode 100644 ansible/playbooks/project_clone.yml diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml new file mode 100644 index 0000000..912fbf4 --- /dev/null +++ b/ansible/group_vars/all.yml @@ -0,0 +1,10 @@ +--- +# variables used for all groups and hosts + +## container registry +forge_registry_url: registry.ublue.local + +## Git +forge_git_repository_url: https://github.com/ublue-os/bluefin.git +forge_git_repository_destination: "{{ ansible_facts.env.HOME }}/ublue-os/forge/bluefin" +forge_git_repository_version: main diff --git a/ansible/host_vars/host.ublue.local.yml b/ansible/host_vars/host.ublue.local.yml new file mode 100644 index 0000000..361ccd7 --- /dev/null +++ b/ansible/host_vars/host.ublue.local.yml @@ -0,0 +1,2 @@ +--- +# variables used in playbooks with target host.ublue.local diff --git a/ansible/playbooks/project_build.yml b/ansible/playbooks/project_build.yml new file mode 100644 index 0000000..8e790ca --- /dev/null +++ b/ansible/playbooks/project_build.yml @@ -0,0 +1,17 @@ +--- +- name: Build project + hosts: host.ublue.local + gather_facts: true + tasks: + - name: Build and push an image to registry + containers.podman.podman_image: + name: bluefin + tag: latest + path: "{{ forge_git_repository_destination }}" + build: + file: Containerfile + format: oci + pull: false + push: true + push_args: + dest: "{{ forge_registry_url }}" diff --git a/ansible/playbooks/project_clone.yml b/ansible/playbooks/project_clone.yml new file mode 100644 index 0000000..66e99fb --- /dev/null +++ b/ansible/playbooks/project_clone.yml @@ -0,0 +1,10 @@ +--- +- name: Clone project + hosts: host.ublue.local + gather_facts: true + tasks: + - name: Clone project + ansible.builtin.git: + repo: "{{ forge_git_repository_url }}" + dest: "{{ forge_git_repository_destination }}" + version: "{{ forge_git_repository_version }}"