From: Kienan Stewart Date: Tue, 5 Sep 2023 20:02:01 +0000 (-0400) Subject: ansible: Portability fixes for reusing modules / Debian trixie X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=b67c1a0b9bcd985e4da5257752122fb10986bf09;p=lttng-ci.git ansible: Portability fixes for reusing modules / Debian trixie While configuring my workstation with ansible, I needed to make some adjustments in order to re-use some of the modules: either by needing to support Debian trixie, to run the tasks out of the context of the lttng-ci inventory, or to disable some unwanted configurations. @see https://git.internal.efficios.com/kstewart/workstation-config Signed-off-by: Kienan Stewart Change-Id: I1edbe413176b519e4981369fb18b4b18cdf52f59 --- diff --git a/automation/ansible/roles/common-node/tasks/setup-Debian.yml b/automation/ansible/roles/common-node/tasks/setup-Debian.yml index 953bad6..1a8cc76 100644 --- a/automation/ansible/roles/common-node/tasks/setup-Debian.yml +++ b/automation/ansible/roles/common-node/tasks/setup-Debian.yml @@ -6,7 +6,7 @@ apt: "name={{ common_node_packages }} state=present" - name: Install linux headers - when: inventory_hostname in groups['node_standalone'] + when: inventory_hostname in groups['node_standalone']|default([]) block: - name: Install i386 linux headers Debian when: ansible_architecture == 'i386' and ansible_distribution == 'Debian' diff --git a/automation/ansible/roles/compilers/defaults/main.yml b/automation/ansible/roles/compilers/defaults/main.yml new file mode 100644 index 0000000..521aabd --- /dev/null +++ b/automation/ansible/roles/compilers/defaults/main.yml @@ -0,0 +1,5 @@ +--- +compilers_legacy_install: true +compilers_legacy_packages: + - gcc-4.8 + - g++-4.8 \ No newline at end of file diff --git a/automation/ansible/roles/compilers/tasks/main.yml b/automation/ansible/roles/compilers/tasks/main.yml index 87bed05..77edc5b 100644 --- a/automation/ansible/roles/compilers/tasks/main.yml +++ b/automation/ansible/roles/compilers/tasks/main.yml @@ -4,6 +4,7 @@ include_vars: "{{ item }}" with_first_found: - "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml" + - "{{ ansible_distribution }}-{{ ansible_distribution_release }}.yml" - "{{ ansible_distribution }}.yml" - "{{ ansible_os_family }}.yml" diff --git a/automation/ansible/roles/compilers/tasks/setup-Debian.yml b/automation/ansible/roles/compilers/tasks/setup-Debian.yml index ba847c5..533c11e 100644 --- a/automation/ansible/roles/compilers/tasks/setup-Debian.yml +++ b/automation/ansible/roles/compilers/tasks/setup-Debian.yml @@ -1,8 +1,15 @@ --- -- name: Add sources for gcc 4.8 - when: ansible_distribution == 'Debian' - ansible.builtin.apt_repository: - repo: 'deb [trusted=yes] http://archive.debian.org/debian jessie main' +- name: Install legacy compilers + block: + - name: Add sources for gcc 4.8 + when: ansible_distribution == 'Debian' + ansible.builtin.apt_repository: + repo: 'deb [trusted=yes] http://archive.debian.org/debian jessie main' + state: "{{compilers_legacy_install|ternary('present', 'absent')}}" + - name: Install legacy compiler packages + when: compilers_legacy_install + ansible.builtin.apt: + name: "{{compilers_legacy_packages}}" - name: Update apt cache. apt: update_cache=yes cache_valid_time=86400 diff --git a/automation/ansible/roles/compilers/vars/Debian-12.yml b/automation/ansible/roles/compilers/vars/Debian-12.yml index f34dbc6..4c6c41f 100644 --- a/automation/ansible/roles/compilers/vars/Debian-12.yml +++ b/automation/ansible/roles/compilers/vars/Debian-12.yml @@ -23,6 +23,3 @@ compilers_packages: - clang-tidy-14 - clang-tidy-15 - bear - # Requires snapshot source - - gcc-4.8 - - g++-4.8 diff --git a/automation/ansible/roles/compilers/vars/Debian-trixie.yml b/automation/ansible/roles/compilers/vars/Debian-trixie.yml new file mode 100644 index 0000000..b5e035e --- /dev/null +++ b/automation/ansible/roles/compilers/vars/Debian-trixie.yml @@ -0,0 +1,27 @@ +--- +compilers_packages: + - gcc + - gcc-11 + - gcc-12 + - gcc-13 + - g++ + - g++-11 + - g++-12 + - g++-13 + - clang + - clang-14 + - clang-15 + - clang-16 + - libclang-dev + - libclang-14-dev + - libclang-15-dev + - libclang-16-dev + - clang-format + - clang-format-14 + - clang-format-15 + - clang-format-16 + - clang-tidy + - clang-tidy-14 + - clang-tidy-15 + - clang-tidy-16 + - bear diff --git a/automation/ansible/roles/lttng-modules/defaults/main.yml b/automation/ansible/roles/lttng-modules/defaults/main.yml new file mode 100644 index 0000000..6b1be14 --- /dev/null +++ b/automation/ansible/roles/lttng-modules/defaults/main.yml @@ -0,0 +1,2 @@ +--- +lttng_modules_checkout_repo: true \ No newline at end of file diff --git a/automation/ansible/roles/lttng-modules/tasks/main.yml b/automation/ansible/roles/lttng-modules/tasks/main.yml index 809110a..1a31309 100644 --- a/automation/ansible/roles/lttng-modules/tasks/main.yml +++ b/automation/ansible/roles/lttng-modules/tasks/main.yml @@ -21,6 +21,7 @@ when: ansible_os_family == 'Suse' - name: checkout repo + when: jenkins_user|bool and lttng_modules_checkout_repo git: repo=git://git-mirror.internal.efficios.com/git/linux-all.git dest=/home/jenkins/gitcache/linux-stable.git bare=yes