ansible: Portability fixes for reusing modules / Debian trixie
authorKienan Stewart <kstewart@efficios.com>
Tue, 5 Sep 2023 20:02:01 +0000 (16:02 -0400)
committerKienan Stewart <kstewart@efficios.com>
Wed, 6 Sep 2023 18:46:58 +0000 (14:46 -0400)
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 <kstewart@efficios.com>
Change-Id: I1edbe413176b519e4981369fb18b4b18cdf52f59

automation/ansible/roles/common-node/tasks/setup-Debian.yml
automation/ansible/roles/compilers/defaults/main.yml [new file with mode: 0644]
automation/ansible/roles/compilers/tasks/main.yml
automation/ansible/roles/compilers/tasks/setup-Debian.yml
automation/ansible/roles/compilers/vars/Debian-12.yml
automation/ansible/roles/compilers/vars/Debian-trixie.yml [new file with mode: 0644]
automation/ansible/roles/lttng-modules/defaults/main.yml [new file with mode: 0644]
automation/ansible/roles/lttng-modules/tasks/main.yml

index 953bad637dd8b9c9183945e8492af67a2d5a354b..1a8cc76793bcd0835789cbb1ef7c41c871177345 100644 (file)
@@ -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 (file)
index 0000000..521aabd
--- /dev/null
@@ -0,0 +1,5 @@
+---
+compilers_legacy_install: true
+compilers_legacy_packages:
+ - gcc-4.8
+ - g++-4.8
\ No newline at end of file
index 87bed057940acee0801093b0374b1a109655cf00..77edc5b2bd8f2688138388a6120de56ed56a6e1d 100644 (file)
@@ -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"
 
index ba847c55983b1edf0cf2e5c2c78d545cf7b29211..533c11ea2806f3e51a82c60560b990952bf1ff2b 100644 (file)
@@ -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
index f34dbc66e0679e7e529e639ed484828120b94339..4c6c41ffb5103609573d6b46e92b51313d9e9c59 100644 (file)
@@ -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 (file)
index 0000000..b5e035e
--- /dev/null
@@ -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 (file)
index 0000000..6b1be14
--- /dev/null
@@ -0,0 +1,2 @@
+---
+lttng_modules_checkout_repo: true
\ No newline at end of file
index 809110a72d566b770ecb6cdb9b452102ea963b39..1a313096eb06b47c3e42361459f49c7e57008721 100644 (file)
@@ -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
This page took 0.027268 seconds and 4 git commands to generate.