From: Michael Jeanson Date: Mon, 5 Jun 2023 19:18:31 +0000 (-0400) Subject: ansible: split common and common-node roles X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=858e2403eb8035573a1011361aea5f285f83037c;p=lttng-ci.git ansible: split common and common-node roles To keep the roles self-contained, split the 'common' role into a 'common-node' role. Change-Id: Ifade97c647cc0e9b480d765caf02a225397de6da Signed-off-by: Michael Jeanson --- diff --git a/automation/ansible/group_vars/node.yml b/automation/ansible/group_vars/node.yml index 3a17f75..02a0ca6 100644 --- a/automation/ansible/group_vars/node.yml +++ b/automation/ansible/group_vars/node.yml @@ -1,22 +1,2 @@ --- jenkins_user: true -packages_Debian: - - autoconf - - automake - - bison - - build-essential - - clang - - clang-tools - - cloc - - default-jdk-headless - - flex - - gettext - - git - - libssl-dev - - libtap-harness-archive-perl - - libtool-bin - - lzop - - pbzip2 - - sudo - - vim - - virtualenv diff --git a/automation/ansible/node_all.yml b/automation/ansible/node_all.yml index 849557c..31b2e11 100644 --- a/automation/ansible/node_all.yml +++ b/automation/ansible/node_all.yml @@ -1,6 +1,7 @@ - hosts: all roles: - common + - common-node - cross-compilers - compilers - babeltrace diff --git a/automation/ansible/node_amd64.yml b/automation/ansible/node_amd64.yml index 6ceb1b3..427ba7e 100644 --- a/automation/ansible/node_amd64.yml +++ b/automation/ansible/node_amd64.yml @@ -1,6 +1,7 @@ - hosts: node_amd64 roles: - common + - common-node - cross-compilers - compilers - babeltrace diff --git a/automation/ansible/node_arm64.yml b/automation/ansible/node_arm64.yml index d5954f3..fd39716 100644 --- a/automation/ansible/node_arm64.yml +++ b/automation/ansible/node_arm64.yml @@ -1,6 +1,7 @@ - hosts: node_arm64 roles: - common + - common-node - babeltrace - liburcu - lttng-ust diff --git a/automation/ansible/node_armhf.yml b/automation/ansible/node_armhf.yml index 9591ee4..2ae2ca4 100644 --- a/automation/ansible/node_armhf.yml +++ b/automation/ansible/node_armhf.yml @@ -1,6 +1,7 @@ - hosts: node_armhf roles: - common + - common-node - babeltrace - liburcu - lttng-ust diff --git a/automation/ansible/node_el.yml b/automation/ansible/node_el.yml index e6d658b..96b5f04 100644 --- a/automation/ansible/node_el.yml +++ b/automation/ansible/node_el.yml @@ -1,6 +1,7 @@ - hosts: node_el roles: - common + - common-node - babeltrace - liburcu - lttng-ust diff --git a/automation/ansible/node_i386.yml b/automation/ansible/node_i386.yml index 6e18d13..eb84244 100644 --- a/automation/ansible/node_i386.yml +++ b/automation/ansible/node_i386.yml @@ -1,6 +1,7 @@ - hosts: node_i386 roles: - common + - common-node - babeltrace - liburcu - lttng-ust diff --git a/automation/ansible/node_ppc64el.yml b/automation/ansible/node_ppc64el.yml index b0a3d3c..62dc4d5 100644 --- a/automation/ansible/node_ppc64el.yml +++ b/automation/ansible/node_ppc64el.yml @@ -1,6 +1,7 @@ - hosts: node_ppc64el roles: - common + - common-node - babeltrace - liburcu - lttng-ust diff --git a/automation/ansible/node_sles.yml b/automation/ansible/node_sles.yml index c403d7c..5ad9454 100644 --- a/automation/ansible/node_sles.yml +++ b/automation/ansible/node_sles.yml @@ -1,6 +1,7 @@ - hosts: node_sles roles: - common + - common-node - babeltrace - liburcu - lttng-ust diff --git a/automation/ansible/node_standalone.yml b/automation/ansible/node_standalone.yml index 325b5d4..e97f6c4 100644 --- a/automation/ansible/node_standalone.yml +++ b/automation/ansible/node_standalone.yml @@ -1,6 +1,7 @@ - hosts: node_standalone roles: - common + - common-node - cross-compilers - babeltrace - liburcu diff --git a/automation/ansible/roles/common-node/tasks/main.yml b/automation/ansible/roles/common-node/tasks/main.yml new file mode 100644 index 0000000..177603e --- /dev/null +++ b/automation/ansible/roles/common-node/tasks/main.yml @@ -0,0 +1,22 @@ +--- +# Include variables and define needed variables. +- name: Include OS-specific variables. + include_vars: "{{ item }}" + with_first_found: + - "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}.yml" + - "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml" + - "{{ ansible_distribution }}.yml" + - "{{ ansible_os_family }}.yml" + +# Setup/install tasks. +- include: setup-RedHat.yml + when: ansible_os_family in ['RedHat', 'Rocky'] + +- include: setup-Debian.yml + when: ansible_os_family == 'Debian' + +- include: setup-Alpine.yml + when: ansible_os_family == 'Alpine' + +- include: setup-Suse.yml + when: ansible_os_family == 'Suse' diff --git a/automation/ansible/roles/common-node/tasks/setup-Alpine.yml b/automation/ansible/roles/common-node/tasks/setup-Alpine.yml new file mode 100644 index 0000000..17196f1 --- /dev/null +++ b/automation/ansible/roles/common-node/tasks/setup-Alpine.yml @@ -0,0 +1,6 @@ +--- +- name: Update apk cache. + apk: update_cache=yes + +- name: Ensure common_node packages are installed. + apk: "name={{ common_node_packages }} state=present" diff --git a/automation/ansible/roles/common-node/tasks/setup-Debian.yml b/automation/ansible/roles/common-node/tasks/setup-Debian.yml new file mode 100644 index 0000000..e390f9d --- /dev/null +++ b/automation/ansible/roles/common-node/tasks/setup-Debian.yml @@ -0,0 +1,6 @@ +--- +- name: Update apt cache. + apt: update_cache=yes cache_valid_time=86400 + +- name: Ensure common_node packages are installed. + apt: "name={{ common_node_packages }} state=present" diff --git a/automation/ansible/roles/common-node/tasks/setup-RedHat.yml b/automation/ansible/roles/common-node/tasks/setup-RedHat.yml new file mode 100644 index 0000000..b448251 --- /dev/null +++ b/automation/ansible/roles/common-node/tasks/setup-RedHat.yml @@ -0,0 +1,6 @@ +--- +- name: Ensure common_node packages are installed. + dnf: + name: "{{ common_node_packages }}" + state: installed + install_weak_deps: false diff --git a/automation/ansible/roles/common-node/tasks/setup-Suse.yml b/automation/ansible/roles/common-node/tasks/setup-Suse.yml new file mode 100644 index 0000000..b1c3cd5 --- /dev/null +++ b/automation/ansible/roles/common-node/tasks/setup-Suse.yml @@ -0,0 +1,6 @@ +--- +- name: Ensure common_node patterns are installed. + zypper: "name={{ common_node_patterns }} type=pattern state=present update_cache=yes" + +- name: Ensure common_node packages are installed. + zypper: "name={{ common_node_packages }} type=package state=present update_cache=yes" diff --git a/automation/ansible/roles/common-node/vars/Alpine.yml b/automation/ansible/roles/common-node/vars/Alpine.yml new file mode 100644 index 0000000..225b074 --- /dev/null +++ b/automation/ansible/roles/common-node/vars/Alpine.yml @@ -0,0 +1,26 @@ +--- +common_node_packages: + - alpine-sdk + - autoconf + - automake + - bash + - bison + - clang + - cloc + - coreutils + - curl + - flex + - gettext + - git + - htop + - jq + - libtool + - openjdk11 + - openssl-dev + - perl + - py-virtualenv + - rsync + - shadow + - sudo + - tree + - vim diff --git a/automation/ansible/roles/common-node/vars/CentOS-7.yml b/automation/ansible/roles/common-node/vars/CentOS-7.yml new file mode 100644 index 0000000..df50f3a --- /dev/null +++ b/automation/ansible/roles/common-node/vars/CentOS-7.yml @@ -0,0 +1,28 @@ +--- +common_node_packages: + - autoconf + - automake + - bison + - clang + - curl + - emacs-nox + - flex + - gcc + - gcc-c++ + - gettext + - git + - java-11-openjdk-devel + - java-11-openjdk-headless + # - jq + - libtool + - lzop + - make + - openssh-server + - openssl-devel + - perl-Test-Harness + - psmisc + - python-virtualenv + - rsync + - sudo + - tree + - vim diff --git a/automation/ansible/roles/common-node/vars/Debian.yml b/automation/ansible/roles/common-node/vars/Debian.yml new file mode 100644 index 0000000..39c2a3a --- /dev/null +++ b/automation/ansible/roles/common-node/vars/Debian.yml @@ -0,0 +1,29 @@ +--- +common_node_packages: + - autoconf + - automake + - bison + - build-essential + - clang + - clang-tools + - cloc + - curl + - default-jdk-headless + - emacs-nox + - flex + - gettext + - git + - htop + - jq + - libssl-dev + - libtap-harness-archive-perl + - libtool-bin + - lzop + - openssh-server + - pbzip2 + - psmisc + - rsync + - sudo + - tree + - vim + - virtualenv diff --git a/automation/ansible/roles/common-node/vars/RedHat.yml b/automation/ansible/roles/common-node/vars/RedHat.yml new file mode 100644 index 0000000..4867365 --- /dev/null +++ b/automation/ansible/roles/common-node/vars/RedHat.yml @@ -0,0 +1,29 @@ +--- +common_node_packages: + - autoconf + - automake + - bison + - clang + - curl + - emacs-nox + - flex + - gcc + - gcc-c++ + - gettext + - git + - htop + - java-11-openjdk-devel + - java-11-openjdk-headless + - jq + - libtool + - lzop + - make + - openssh-server + - openssl-devel + - perl-Test-Harness + - psmisc + - python3-virtualenv + - rsync + - sudo + - tree + - vim diff --git a/automation/ansible/roles/common-node/vars/Rocky.yml b/automation/ansible/roles/common-node/vars/Rocky.yml new file mode 120000 index 0000000..f802000 --- /dev/null +++ b/automation/ansible/roles/common-node/vars/Rocky.yml @@ -0,0 +1 @@ +RedHat.yml \ No newline at end of file diff --git a/automation/ansible/roles/common-node/vars/SLES-15.yml b/automation/ansible/roles/common-node/vars/SLES-15.yml new file mode 100644 index 0000000..693f0f3 --- /dev/null +++ b/automation/ansible/roles/common-node/vars/SLES-15.yml @@ -0,0 +1,26 @@ +--- +common_node_patterns: + - base + - devel_basis + +common_node_packages: + - autoconf + - automake + - bison + - curl + - flex + - gettext-runtime + - git-core + - java-11-openjdk-devel + - java-11-openjdk-headless + - jq + - libopenssl-devel +# - libtap-harness-archive-perl + - libtool + - openssh + - psmisc +# - python-virtualenv + - rsync + - sudo +# - tree + - vim diff --git a/automation/ansible/roles/common-node/vars/Suse.yml b/automation/ansible/roles/common-node/vars/Suse.yml new file mode 100644 index 0000000..4e13642 --- /dev/null +++ b/automation/ansible/roles/common-node/vars/Suse.yml @@ -0,0 +1,26 @@ +--- +common_node_patterns: + - base + - Minimal + - Basis-Devel + +common_node_packages: + - autoconf + - automake + - bison + - curl + - flex + - gettext-runtime + - git-core + - java-11-openjdk-devel + - java-11-openjdk-headless +# - jq + - libopenssl-devel +# - libtap-harness-archive-perl + - libtool + - openssh + - psmisc +# - python-virtualenv + - sudo + - tree + - vim diff --git a/automation/ansible/roles/common/tasks/setup-Debian.yml b/automation/ansible/roles/common/tasks/setup-Debian.yml index 54a7a4f..0f70202 100644 --- a/automation/ansible/roles/common/tasks/setup-Debian.yml +++ b/automation/ansible/roles/common/tasks/setup-Debian.yml @@ -20,8 +20,4 @@ apt: update_cache=yes cache_valid_time=86400 - name: Ensure common packages are installed. - apt: "name={{ common_packages + packages_Debian|default([]) }} state=present" - -- name: Debug common packages - debug: - msg: "{{ common_packages + packages_Debian|default([]) }}" + apt: "name={{ common_packages }} state=present" diff --git a/automation/ansible/roles/common/vars/Alpine.yml b/automation/ansible/roles/common/vars/Alpine.yml index 6d04831..06f2d9d 100644 --- a/automation/ansible/roles/common/vars/Alpine.yml +++ b/automation/ansible/roles/common/vars/Alpine.yml @@ -1,23 +1,10 @@ --- common_packages: - - alpine-sdk - - autoconf - - automake - bash - - bison - - clang - - cloc - coreutils - curl - - flex - - gettext - git - htop - - jq - - libtool - - openjdk11 - - openssl-dev - - perl - py-virtualenv - rsync - shadow diff --git a/automation/ansible/roles/common/vars/CentOS-7.yml b/automation/ansible/roles/common/vars/CentOS-7.yml index 66b6722..bda232b 100644 --- a/automation/ansible/roles/common/vars/CentOS-7.yml +++ b/automation/ansible/roles/common/vars/CentOS-7.yml @@ -1,25 +1,10 @@ --- common_packages: - - autoconf - - automake - - bison - - clang - curl - emacs-nox - - flex - - gcc - - gcc-c++ - - gettext - git - - java-11-openjdk-devel - - java-11-openjdk-headless - # - jq - - libtool - lzop - - make - openssh-server - - openssl-devel - - perl-Test-Harness - psmisc - python-virtualenv - rsync diff --git a/automation/ansible/roles/common/vars/RedHat.yml b/automation/ansible/roles/common/vars/RedHat.yml index 273dd1b..3c3a997 100644 --- a/automation/ansible/roles/common/vars/RedHat.yml +++ b/automation/ansible/roles/common/vars/RedHat.yml @@ -1,26 +1,11 @@ --- common_packages: - - autoconf - - automake - - bison - - clang - curl - emacs-nox - - flex - - gcc - - gcc-c++ - - gettext - git - htop - - java-11-openjdk-devel - - java-11-openjdk-headless - - jq - - libtool - lzop - - make - openssh-server - - openssl-devel - - perl-Test-Harness - psmisc - python3-virtualenv - rsync diff --git a/automation/ansible/roles/common/vars/SLES-15.yml b/automation/ansible/roles/common/vars/SLES-15.yml index 42e3989..8330b4e 100644 --- a/automation/ansible/roles/common/vars/SLES-15.yml +++ b/automation/ansible/roles/common/vars/SLES-15.yml @@ -1,26 +1,12 @@ --- common_patterns: - base - - devel_basis common_packages: - - autoconf - - automake - - bison - curl - - flex - - gettext-runtime - git-core - - java-11-openjdk-devel - - java-11-openjdk-headless - - jq - - libopenssl-devel -# - libtap-harness-archive-perl - - libtool - openssh - psmisc -# - python-virtualenv - rsync - sudo -# - tree - vim diff --git a/automation/ansible/roles/common/vars/Suse.yml b/automation/ansible/roles/common/vars/Suse.yml index acf1ec6..17ad4fc 100644 --- a/automation/ansible/roles/common/vars/Suse.yml +++ b/automation/ansible/roles/common/vars/Suse.yml @@ -2,25 +2,12 @@ common_patterns: - base - Minimal - - Basis-Devel common_packages: - - autoconf - - automake - - bison - curl - - flex - - gettext-runtime - git-core - - java-11-openjdk-devel - - java-11-openjdk-headless -# - jq - - libopenssl-devel -# - libtap-harness-archive-perl - - libtool - openssh - psmisc -# - python-virtualenv - sudo - tree - vim