From 4d42a2b0950882bf63380a08c90007970c38b4ce Mon Sep 17 00:00:00 2001 From: Ahmed Abdelhalim Date: Tue, 7 Jul 2026 16:30:43 +0200 Subject: Add pve-lxc service provisioning using service.yml and containers group --- configure.yml | 2 +- group_vars/all.yml | Bin 26 -> 50 bytes group_vars/all.yml.example | 1 + group_vars/containers.yml | Bin 0 -> 62 bytes group_vars/containers.yml.example | 3 +++ host_vars/git.local.yml | Bin 0 -> 531 bytes host_vars/git.local.yml.example | 21 +++++++++++++++++++++ inventory/hosts.yml | 6 ++++-- service.yml | 7 +++++++ site.yml | 5 ++++- 10 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 group_vars/containers.yml create mode 100644 group_vars/containers.yml.example create mode 100644 host_vars/git.local.yml create mode 100644 host_vars/git.local.yml.example create mode 100644 service.yml diff --git a/configure.yml b/configure.yml index 763bc406..f64046c6 100644 --- a/configure.yml +++ b/configure.yml @@ -135,6 +135,6 @@ pve_lxc_ip: "{{ hostvars[service_host].pve_lxc_ip }}" pve_lxc_gateway: "{{ hostvars[service_host].pve_lxc_gateway }}" pve_lxc_dns: "{{ hostvars[service_host].pve_lxc_dns }}" - loop: "{{ groups['services'] }}" + loop: "{{ groups['containers'] }}" loop_control: loop_var: "service_host" diff --git a/group_vars/all.yml b/group_vars/all.yml index 20f84e62..8109283b 100644 Binary files a/group_vars/all.yml and b/group_vars/all.yml differ diff --git a/group_vars/all.yml.example b/group_vars/all.yml.example index ed97d539..c612e689 100644 --- a/group_vars/all.yml.example +++ b/group_vars/all.yml.example @@ -1 +1,2 @@ --- +ansible_connection: ssh diff --git a/group_vars/containers.yml b/group_vars/containers.yml new file mode 100644 index 00000000..e6d29eb5 Binary files /dev/null and b/group_vars/containers.yml differ diff --git a/group_vars/containers.yml.example b/group_vars/containers.yml.example new file mode 100644 index 00000000..b2559075 --- /dev/null +++ b/group_vars/containers.yml.example @@ -0,0 +1,3 @@ +--- +ansible_user: root +ansible_port: 22 diff --git a/host_vars/git.local.yml b/host_vars/git.local.yml new file mode 100644 index 00000000..f01929e3 Binary files /dev/null and b/host_vars/git.local.yml differ diff --git a/host_vars/git.local.yml.example b/host_vars/git.local.yml.example new file mode 100644 index 00000000..60b8d659 --- /dev/null +++ b/host_vars/git.local.yml.example @@ -0,0 +1,21 @@ +--- +ansible_host: "10.0.0.100" + +network_ipv4_address: "10.0.0.100" +network_ipv4_gateway: "10.0.0.254" +network_ipv4_dns: "10.0.0.254" + +pve_lxc_id: 100 +pve_lxc_hostname: "git" +pve_lxc_template: "alpine-3.23-default_20260116_amd64.tar.xz" +pve_lxc_disk: "local-lvm:4" +pve_lxc_cores: 1 +pve_lxc_memory: 256 +pve_lxc_ip: "10.0.0.100/24" +pve_lxc_gateway: "10.0.0.254" +pve_lxc_dns: "10.0.0.254" + +cgit_hostname: "git.home.arpa" +cgit_title: "git.a14m.dev" +cgit_description: "a14m git repositories" +cgit_ssh_user: "git" diff --git a/inventory/hosts.yml b/inventory/hosts.yml index 080c06fd..ce41d1b5 100644 --- a/inventory/hosts.yml +++ b/inventory/hosts.yml @@ -1,10 +1,12 @@ --- homelab: - vars: - ansible_connection: ssh hosts: desktop.local: macbook.local: laptop.local: rpi5.local: pve.local: + +containers: + hosts: + git.local: diff --git a/service.yml b/service.yml new file mode 100644 index 00000000..a08cfa69 --- /dev/null +++ b/service.yml @@ -0,0 +1,7 @@ +--- +- name: "Git configure" + gather_facts: true + hosts: + - git.local + roles: + - role: "cgit" diff --git a/site.yml b/site.yml index 34c96e5b..7f9a4745 100644 --- a/site.yml +++ b/site.yml @@ -18,5 +18,8 @@ poll: 5 failed_when: false -- name: "Configure" +- name: "Host Configure" ansible.builtin.import_playbook: "configure.yml" + +- name: "Service Configure" + ansible.builtin.import_playbook: "service.yml" -- cgit v1.2.3