summaryrefslogtreecommitdiffstats
path: root/roles/configure
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2025-08-11 00:33:32 +0200
committerAhmed Abdelhalim <[email protected]>2025-08-11 00:33:32 +0200
commite47ae78cfe17371ce240e134fd66f01ed120ffee (patch)
treee43be879f5ef250ed0f68005daff481411aa97b5 /roles/configure
parentd96220d5b940f49dd5e22133c763b85bad91d5a0 (diff)
Remove configure dependency on other roles and add ubuntu support
Diffstat (limited to 'roles/configure')
-rw-r--r--roles/configure/README.md4
-rw-r--r--roles/configure/meta/argument_specs.yml10
-rw-r--r--roles/configure/meta/main.yml6
-rw-r--r--roles/configure/tasks/install-debian.yml7
-rw-r--r--roles/configure/tasks/main.yml15
5 files changed, 29 insertions, 13 deletions
diff --git a/roles/configure/README.md b/roles/configure/README.md
index dfab439..0430791 100644
--- a/roles/configure/README.md
+++ b/roles/configure/README.md
@@ -9,12 +9,12 @@ This role configures the bootstrapped distro installation basic networking funct
## Role Variables
- `configure_playbooks_path` the root directory of the distro-configure playbooks
+- `partiton_root` dictionary with the required `mount_path`
- `hostname` the hostname variable defined in bootstrap role
-- `mnt_root_path` the mount root path fact defined in bootstrap role
## Internals
- Install ansible on live environment
- Copy `ansible-distro-configure` playbook (via archive because it's waaaay faster)
-- Update the `ansible-distro-configure` inventory to configure chroot (`mnt_root_path`)
+- Update the `ansible-distro-configure` inventory to configure chroot (`partition_root.mount_path`)
- Run the `ansible-distro-configure` playbook for desired `hostname`
diff --git a/roles/configure/meta/argument_specs.yml b/roles/configure/meta/argument_specs.yml
index cd10572..3fcde79 100644
--- a/roles/configure/meta/argument_specs.yml
+++ b/roles/configure/meta/argument_specs.yml
@@ -7,7 +7,9 @@ argument_specs:
description: "The path to the configure playbook directory to run when provided"
hostname:
type: "str"
- description: "Check hostname variable in role: bootstrap"
- mnt_root_path:
- type: "str"
- description: "Check mnt_root_path fact in role: bootstrap"
+ required: true
+ description: "The distro linux hostname to be configured (will configure if availabe in inventory)"
+ partition_root:
+ type: "dict"
+ required: true
+ description: "Check partition_root argument in role: partition, required options: mount_path"
diff --git a/roles/configure/meta/main.yml b/roles/configure/meta/main.yml
index 1599ace..97ee720 100644
--- a/roles/configure/meta/main.yml
+++ b/roles/configure/meta/main.yml
@@ -1,6 +1,5 @@
---
-dependencies:
- - bootstrap
+dependencies: []
galaxy_info:
role_name: configure
author: a14m
@@ -12,3 +11,6 @@ galaxy_info:
- name: ArchLinux
versions:
- all
+ - name: Ubuntu
+ versions:
+ - noble
diff --git a/roles/configure/tasks/install-debian.yml b/roles/configure/tasks/install-debian.yml
new file mode 100644
index 0000000..d9dc732
--- /dev/null
+++ b/roles/configure/tasks/install-debian.yml
@@ -0,0 +1,7 @@
+---
+- name: "Ensure ansible dependencies are installed on live environment"
+ ansible.builtin.apt:
+ state: "present"
+ pkg:
+ - "python3"
+ - "python3-pip"
diff --git a/roles/configure/tasks/main.yml b/roles/configure/tasks/main.yml
index e4ff6b9..6a1e58c 100644
--- a/roles/configure/tasks/main.yml
+++ b/roles/configure/tasks/main.yml
@@ -1,8 +1,16 @@
---
+- name: "Set root partition paths"
+ ansible.builtin.set_fact:
+ configure_chroot_path: "{{ partition_root.mount_path }}"
+
- name: "Install archlinux"
ansible.builtin.include_tasks: "install-archlinux.yml"
when: ansible_os_family == "Archlinux"
+- name: "Install debian"
+ ansible.builtin.include_tasks: "install-debian.yml"
+ when: ansible_os_family == "Debian"
+
- name: "Install ansible-core on live environment"
# Can't install ansible-core using package manager
# This resolve the "ERROR! ansible-galaxy requires resolvelib<1.1.1,>=0.5.3"
@@ -13,10 +21,7 @@
break_system_packages: true
- name: "Run distro-configure playbooks on bootstrapped distro"
- when:
- - configure_playbook_dir is defined
- - mnt_root_path is defined
- - hostname is defined
+ when: configure_playbook_dir is defined
block:
- name: "Archive playbook on controller"
become: false
@@ -55,7 +60,7 @@
ansible_connection: "chroot"
ansible_chroot_exe: "arch-chroot"
hosts:
- {{ mnt_root_path }}:
+ {{ configure_chroot_path }}:
- name: "Download playbook dependencies on live environment"
ansible.builtin.command: