Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Ubuntu 24.04 #833

Merged
merged 12 commits into from
Sep 9, 2024
Merged

Conversation

matthewandrews
Copy link
Member

No description provided.

@matthewandrews matthewandrews requested a review from vjrj September 3, 2024 02:17
Copy link
Collaborator

@vjrj vjrj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general LGTM except for the minor comments I added, and the fact that I couldn't test correctly without merge #800.

I get errors like:

NoduleNotFoundError: No module named 'ansible.module_utils.six.moves

with older ansible like the recommended by current ala-install or:

ansible.builtin.include has been removed. Use include_tasks or import_tasks instead. This feature was removed from ansible-core in a release after 2023-05-16. Please update your playbooks.

with recent ansible and ala-install without #800.

ansible/roles/common/tasks/setfacts.yml Show resolved Hide resolved
ansible/roles/augeas/tasks/main.yml Outdated Show resolved Hide resolved
ansible/group_vars/all/vars.yml Show resolved Hide resolved
@vjrj
Copy link
Collaborator

vjrj commented Sep 5, 2024

Something like this can be also added for make newserver to work:

diff --git a/ansible/newserver.yml b/ansible/newserver.yml
index afa3f810..e6b79d10 100644
--- a/ansible/newserver.yml
+++ b/ansible/newserver.yml
@@ -1,15 +1,30 @@
 ---
 # Use this playbook once on a new server to install python2 and python3
 # must pass target var e.g. ansible-playbook newserver.yml -i /path/to/inventories/your-inventory-file -u ${USER} --private-key=~/.ssh/id_rsa --extra-vars 'target=bla-bla'
+
 - name: newserver
   hosts: '{{ target }}'
   gather_facts: false
+  become: yes
+  
   pre_tasks:
-  - name: Install python2 and python3 for Ansible
+  - name: Get the distribution version
+    raw: lsb_release -r | awk '{print $2}'
+    register: os_version
+    changed_when: false
+
+  - name: Install python2 and python3 for Ansible (< u24)
     raw: bash -c "test -e /usr/bin/python || (apt -qqy update && apt-get install -qqy python3-minimal 'python2.*-minimal')"
-    register: output
-    changed_when: output.stdout != ""
+    when: os_version.stdout is version('24.04', '<')
+    register: output_python2_and_3
+    changed_when: output_python2_and_3.stdout != ""
+  
+  - name: Install only python3 for Ansible (>= u24)
+    raw: bash -c "test -e /usr/bin/python || (apt -qqy update && apt-get install -qqy python3-minimal)"
+    when: os_version.stdout is version('24.04', '>=')
+    register: output_python3
+    changed_when: output_python3.stdout != ""
+
+  tasks:
   - name: Gathering Facts
     setup:
-  become: yes
-

@matthewandrews
Copy link
Member Author

Something like this can be also added for make newserver to work:

diff --git a/ansible/newserver.yml b/ansible/newserver.yml
index afa3f810..e6b79d10 100644
--- a/ansible/newserver.yml
+++ b/ansible/newserver.yml
@@ -1,15 +1,30 @@
 ---
 # Use this playbook once on a new server to install python2 and python3
 # must pass target var e.g. ansible-playbook newserver.yml -i /path/to/inventories/your-inventory-file -u ${USER} --private-key=~/.ssh/id_rsa --extra-vars 'target=bla-bla'
+
 - name: newserver
   hosts: '{{ target }}'
   gather_facts: false
+  become: yes
+  
   pre_tasks:
-  - name: Install python2 and python3 for Ansible
+  - name: Get the distribution version
+    raw: lsb_release -r | awk '{print $2}'
+    register: os_version
+    changed_when: false
+
+  - name: Install python2 and python3 for Ansible (< u24)
     raw: bash -c "test -e /usr/bin/python || (apt -qqy update && apt-get install -qqy python3-minimal 'python2.*-minimal')"
-    register: output
-    changed_when: output.stdout != ""
+    when: os_version.stdout is version('24.04', '<')
+    register: output_python2_and_3
+    changed_when: output_python2_and_3.stdout != ""
+  
+  - name: Install only python3 for Ansible (>= u24)
+    raw: bash -c "test -e /usr/bin/python || (apt -qqy update && apt-get install -qqy python3-minimal)"
+    when: os_version.stdout is version('24.04', '>=')
+    register: output_python3
+    changed_when: output_python3.stdout != ""
+
+  tasks:
   - name: Gathering Facts
     setup:
-  become: yes
-

Thanks! I've added that change in d57c3c7

@vjrj
Copy link
Collaborator

vjrj commented Sep 6, 2024

LGTM and can be merged IMHO. I continue adding other issues I detect in #834.

@matthewandrews matthewandrews merged commit c941c60 into master Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants