From 457816cc104cd0233e5c9366ecf293d876f151f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= Date: Thu, 8 Aug 2024 14:07:14 +0200 Subject: [PATCH 1/8] fix task name --- tasks/installer-setup.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/installer-setup.yml b/tasks/installer-setup.yml index 0ebcfdbe..427c72b0 100644 --- a/tasks/installer-setup.yml +++ b/tasks/installer-setup.yml @@ -20,7 +20,7 @@ include_tasks: pkg-redhat/install-installer-yum.yml when: ansible_facts.os_family in ["RedHat", "Rocky", "AlmaLinux"] and not ansible_check_mode and ansible_pkg_mgr == "yum" -- name: Include installer YUM install task +- name: Include installer DEB install task include_tasks: pkg-debian/install-installer.yml when: ansible_facts.os_family == "Debian" and not ansible_check_mode From 680d45e68212b7995fee2e4312ea2e81988b30f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= Date: Thu, 8 Aug 2024 14:12:15 +0200 Subject: [PATCH 2/8] fix installer setup on SUSE --- tasks/installer-setup.yml | 4 ++++ tasks/pkg-suse.yml | 4 ++++ tasks/pkg-suse/install-installer-zypper.yml | 7 +++++++ 3 files changed, 15 insertions(+) create mode 100644 tasks/pkg-suse/install-installer-zypper.yml diff --git a/tasks/installer-setup.yml b/tasks/installer-setup.yml index 427c72b0..53ad1a3a 100644 --- a/tasks/installer-setup.yml +++ b/tasks/installer-setup.yml @@ -24,6 +24,10 @@ include_tasks: pkg-debian/install-installer.yml when: ansible_facts.os_family == "Debian" and not ansible_check_mode +- name: Include installer Zypper install task + include_tasks: pkg-suse/install-installer-zypper.yml + when: ansible_facts.os_family == "Suse" and not ansible_check_mode + - name: Bootstrap the installer command: /usr/bin/datadog-bootstrap bootstrap register: datadog_installer_bootstrap_result diff --git a/tasks/pkg-suse.yml b/tasks/pkg-suse.yml index 124596db..dde3e5f1 100644 --- a/tasks/pkg-suse.yml +++ b/tasks/pkg-suse.yml @@ -130,6 +130,10 @@ register: agent_datadog_zypper_repo_template when: datadog_manage_zypper_repofile +- name: Include installer setup + include_tasks: installer-setup.yml + when: datadog_installer_enabled + # refresh zypper repos only if the template changed - name: Refresh Datadog zypper_repos # noqa: command-instead-of-module command: zypper refresh datadog diff --git a/tasks/pkg-suse/install-installer-zypper.yml b/tasks/pkg-suse/install-installer-zypper.yml new file mode 100644 index 00000000..0ec9e867 --- /dev/null +++ b/tasks/pkg-suse/install-installer-zypper.yml @@ -0,0 +1,7 @@ +--- +- name: Install latest datadog-installer package (zypper) + zypper: + name: "{{ datadog_installer_flavor }}" + state: latest # noqa package-latest + register: datadog_installer_install_result + ignore_errors: true From 9ffbb906d7887fc36132eb5efba9527076a059bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= Date: Thu, 8 Aug 2024 14:12:25 +0200 Subject: [PATCH 3/8] add SUSE to our installer test matrix --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9398ba63..62e2d181 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -383,6 +383,6 @@ workflows: matrix: parameters: ansible_version: ["2_10", "3_4", "4_10"] - os: ["debian", "centos", "amazonlinux2"] + os: ["debian", "centos", "amazonlinux2", "suse"] apm_enabled: ["host", ""] remote_updates: ["true", "false"] From d67f748c62e24b431017fdf6aeb73fb99e7c7d08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= Date: Thu, 8 Aug 2024 14:17:50 +0200 Subject: [PATCH 4/8] duplicate installer tests for suse as it doesn't support APM for now --- .circleci/config.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 62e2d181..b71c6192 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -284,6 +284,37 @@ jobs: fi fi' + test_installer_suse: + parameters: + ansible_version: + type: string + jinja2_native: + type: string + default: "false" + inventory: + type: string + default: "ci.ini" + docker: + - image: datadog/docker-library:ansible_suse_<> + steps: + - checkout + # datadog-installer will bailout if there's no systemctl binary, and won't attempt to + # create the systemd folder to store its units + # Since we're running the tests in a docker container without systemd, we can "help" it + # proceed by pretending systemd is there + - run: printf "#!/bin/bash\n\nexit 0" > /usr/bin/systemctl && chmod +x /usr/bin/systemctl + - run: mkdir -p /etc/systemd/system/ + - run: > + ANSIBLE_JINJA2_NATIVE="<>" ansible-playbook + -i ./ci_test/inventory/<> "./ci_test/install_installer.yaml" + -e datadog_remote_updates="true" + - run: > + bash -c 'datadog-installer version; + if [ -d /opt/datadog-agent ]; then + echo "The agent should NOT have been installed by the distribution"; + exit 1; + fi' + workflows: version: 2 test_datadog_role: @@ -386,3 +417,8 @@ workflows: os: ["debian", "centos", "amazonlinux2", "suse"] apm_enabled: ["host", ""] remote_updates: ["true", "false"] + + - test_installer_suse: + matrix: + parameters: + ansible_version: ["2_10", "3_4", "4_10"] From c666aa46b5397b2c31611be46c857985906b5cd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= Date: Thu, 8 Aug 2024 14:20:12 +0200 Subject: [PATCH 5/8] remove suse from regular installer matrix --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b71c6192..65c9839d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -414,7 +414,7 @@ workflows: matrix: parameters: ansible_version: ["2_10", "3_4", "4_10"] - os: ["debian", "centos", "amazonlinux2", "suse"] + os: ["debian", "centos", "amazonlinux2"] apm_enabled: ["host", ""] remote_updates: ["true", "false"] From 03268238a52d453fa30db693b5ed08ed97a9eb8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= Date: Thu, 8 Aug 2024 16:17:11 +0200 Subject: [PATCH 6/8] move suse back to the regular installer tests we'll soon enable APM on suse --- .circleci/config.yml | 37 +------------------------------------ 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 65c9839d..f132c955 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -284,37 +284,6 @@ jobs: fi fi' - test_installer_suse: - parameters: - ansible_version: - type: string - jinja2_native: - type: string - default: "false" - inventory: - type: string - default: "ci.ini" - docker: - - image: datadog/docker-library:ansible_suse_<> - steps: - - checkout - # datadog-installer will bailout if there's no systemctl binary, and won't attempt to - # create the systemd folder to store its units - # Since we're running the tests in a docker container without systemd, we can "help" it - # proceed by pretending systemd is there - - run: printf "#!/bin/bash\n\nexit 0" > /usr/bin/systemctl && chmod +x /usr/bin/systemctl - - run: mkdir -p /etc/systemd/system/ - - run: > - ANSIBLE_JINJA2_NATIVE="<>" ansible-playbook - -i ./ci_test/inventory/<> "./ci_test/install_installer.yaml" - -e datadog_remote_updates="true" - - run: > - bash -c 'datadog-installer version; - if [ -d /opt/datadog-agent ]; then - echo "The agent should NOT have been installed by the distribution"; - exit 1; - fi' - workflows: version: 2 test_datadog_role: @@ -414,11 +383,7 @@ workflows: matrix: parameters: ansible_version: ["2_10", "3_4", "4_10"] - os: ["debian", "centos", "amazonlinux2"] + os: ["debian", "centos", "amazonlinux2", "suse"] apm_enabled: ["host", ""] remote_updates: ["true", "false"] - - test_installer_suse: - matrix: - parameters: - ansible_version: ["2_10", "3_4", "4_10"] From 7c1c9f04a2b3447fa01d377d20ce06a4b7d95ead Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= Date: Thu, 8 Aug 2024 16:30:17 +0200 Subject: [PATCH 7/8] wip --- tasks/apm-inject-check.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tasks/apm-inject-check.yml b/tasks/apm-inject-check.yml index 2bb08d57..96caa17e 100644 --- a/tasks/apm-inject-check.yml +++ b/tasks/apm-inject-check.yml @@ -7,7 +7,9 @@ - name: Fail if APM Host injection is not supported on this host fail: msg: APM Host Injection is not supported in this platform. - when: ansible_facts.os_family not in ["Debian", "RedHat", "Rocky", "AlmaLinux"] + when: > + ansible_facts.os_family not in ["Debian", "RedHat", "Rocky", "AlmaLinux"] or + (ansible_facts.os_family == "Suse" and not datadog_installer_enabled) - name: Fail if APM Host injection type does not contain a supported value fail: From 1a9bd3809e91b8856f20373e65c5a648fbae5052 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= Date: Thu, 8 Aug 2024 16:46:01 +0200 Subject: [PATCH 8/8] fix inverted logic --- tasks/apm-inject-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/apm-inject-check.yml b/tasks/apm-inject-check.yml index 96caa17e..c7aae1b6 100644 --- a/tasks/apm-inject-check.yml +++ b/tasks/apm-inject-check.yml @@ -8,7 +8,7 @@ fail: msg: APM Host Injection is not supported in this platform. when: > - ansible_facts.os_family not in ["Debian", "RedHat", "Rocky", "AlmaLinux"] or + ansible_facts.os_family not in ["Debian", "RedHat", "Rocky", "AlmaLinux"] and (ansible_facts.os_family == "Suse" and not datadog_installer_enabled) - name: Fail if APM Host injection type does not contain a supported value