Skip to content

Fix datadog-installer handling on SUSE #594

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

Merged
merged 7 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,41 @@ 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_<<parameters.ansible_version>>
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="<<parameters.jinja2_native>>" ansible-playbook
-i ./ci_test/inventory/<<parameters.inventory>> "./ci_test/install_installer.yaml"
-e datadog_remote_updates="true"
- run: >
bash -c 'datadog-installer version;
if [ ! -d /opt/datadog-packages/datadog-agent ]; then
echo "The agent should have been installed by the installer";
exit 1;
fi
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:
Expand Down Expand Up @@ -386,3 +421,8 @@ workflows:
os: ["debian", "centos", "amazonlinux2"]
apm_enabled: ["host", ""]
remote_updates: ["true", "false"]

- test_installer_suse:
matrix:
parameters:
ansible_version: ["2_10", "3_4", "4_10"]
6 changes: 5 additions & 1 deletion tasks/installer-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@
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

- 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
Expand Down
4 changes: 4 additions & 0 deletions tasks/pkg-suse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions tasks/pkg-suse/install-installer-zypper.yml
Original file line number Diff line number Diff line change
@@ -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