summaryrefslogtreecommitdiffstats
path: root/roles/configure
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2026-01-11 19:02:52 +0100
committerAhmed Abdelhalim <[email protected]>2026-01-11 19:02:52 +0100
commit6e47923b6536a17bdf38336f7c244426f5fc482a (patch)
tree90cea2389abd5b9abc80b60efada71b3a3a9b9c6 /roles/configure
parent8d16a6dafc56d6d742099d504df5f7607eada7b0 (diff)
Install pip
After giving up on fixing the usage of ansible.builtin.pip on live environment. I ended up having to setup pip manually and using it with ansible commands to setup ansible-core on live environment to run the configuration playbook No idea why it started failing on the first place, was working 2 days ago!!!
Diffstat (limited to 'roles/configure')
-rw-r--r--roles/configure/tasks/install-ansible.yml37
-rw-r--r--roles/configure/tasks/install-archlinux.yml8
-rw-r--r--roles/configure/tasks/install-debian.yml7
-rw-r--r--roles/configure/tasks/main.yml20
4 files changed, 41 insertions, 31 deletions
diff --git a/roles/configure/tasks/install-ansible.yml b/roles/configure/tasks/install-ansible.yml
new file mode 100644
index 0000000..c9894a9
--- /dev/null
+++ b/roles/configure/tasks/install-ansible.yml
@@ -0,0 +1,37 @@
+---
+- name: "Ensure ansible dependencies are installed on live environment"
+ community.general.pacman:
+ name:
+ - "python3"
+ - "python-packaging"
+ state: present
+ when: ansible_os_family == "Archlinux"
+
+- name: "Ensure ansible dependencies are installed on live environment"
+ ansible.builtin.apt:
+ pkg:
+ - "python3"
+ - "python3-packaging"
+ state: "present"
+ when: ansible_os_family == "Debian"
+
+# Workaround ansible.builtin.pip not working on live environment,
+# after giving up on fixing it, now we install pip manually and use the commands to setup ansible
+- name: "Download get-pip.py"
+ ansible.builtin.get_url:
+ url: "https://bootstrap.pypa.io/get-pip.py"
+ dest: "/tmp/get-pip.py"
+ mode: "0644"
+
+- name: "Bootstrap pip with break-system-packages"
+ ansible.builtin.command:
+ cmd: "python3 /tmp/get-pip.py --break-system-packages --force-reinstall --root-user-action=ignore"
+ changed_when: true
+
+- 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"
+ # where the python-resolvelib was updated but ansible package wasn't in the package managers
+ ansible.builtin.command:
+ cmd: "python3 -m pip install ansible-core>=2.18 --break-system-packages --root-user-action=ignore"
+ changed_when: true
diff --git a/roles/configure/tasks/install-archlinux.yml b/roles/configure/tasks/install-archlinux.yml
deleted file mode 100644
index d2f777f..0000000
--- a/roles/configure/tasks/install-archlinux.yml
+++ /dev/null
@@ -1,8 +0,0 @@
----
-- name: "Ensure ansible dependencies are installed on live environment"
- community.general.pacman:
- name:
- - "python3"
- - "python-pip"
- state: present
- update_cache: true
diff --git a/roles/configure/tasks/install-debian.yml b/roles/configure/tasks/install-debian.yml
deleted file mode 100644
index d9dc732..0000000
--- a/roles/configure/tasks/install-debian.yml
+++ /dev/null
@@ -1,7 +0,0 @@
----
-- 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 399017a..16c6d38 100644
--- a/roles/configure/tasks/main.yml
+++ b/roles/configure/tasks/main.yml
@@ -3,22 +3,10 @@
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"
- # where the python-resolvelib was updated but ansible package wasn't in the package managers
- ansible.builtin.pip:
- name: "ansible-core>=2.18"
- state: "present"
- break_system_packages: true
+# After giving up on fixing the ansible.builtin.pip directly
+# Workaround ansible install not working without reinstalling and configuring pip externally
+- name: "Install ansible"
+ ansible.builtin.include_tasks: "install-ansible.yml"
- name: "Run distro-configure playbooks on bootstrapped distro"
when: configure_playbook_dir is defined