diff --git a/molecule/logging-test/molecule.yml b/molecule/logging-test/molecule.yml index 2822af83..f64b0f91 100644 --- a/molecule/logging-test/molecule.yml +++ b/molecule/logging-test/molecule.yml @@ -44,13 +44,6 @@ platforms: groups: - linux - rhel - - name: "ansible-ubuntu-1804-${MOLECULE_SCENARIO_NAME}" - image_family: projects/ubuntu-os-cloud/global/images/family/ubuntu-1804-lts - machine_type: e2-medium - size_gb: 40 - groups: - - linux - - ubuntu - name: "ansible-ubuntu-2004-${MOLECULE_SCENARIO_NAME}" image_family: projects/ubuntu-os-cloud/global/images/family/ubuntu-2004-lts machine_type: e2-medium @@ -65,6 +58,13 @@ platforms: groups: - linux - debian + - name: "ansible-debian-11-${MOLECULE_SCENARIO_NAME}" + image_family: projects/debian-cloud/global/images/family/debian-11 + machine_type: e2-medium + size_gb: 40 + groups: + - linux + - debian - name: "ansible-sles-12-${MOLECULE_SCENARIO_NAME}" image_family: projects/suse-cloud/global/images/family/sles-12 machine_type: e2-medium diff --git a/molecule/monitoring-test/molecule.yml b/molecule/monitoring-test/molecule.yml index 454dcf44..33816f16 100644 --- a/molecule/monitoring-test/molecule.yml +++ b/molecule/monitoring-test/molecule.yml @@ -44,13 +44,6 @@ platforms: groups: - linux - rhel - - name: "ansible-ubuntu-1804-${MOLECULE_SCENARIO_NAME}" - image_family: projects/ubuntu-os-cloud/global/images/family/ubuntu-1804-lts - machine_type: e2-medium - size_gb: 40 - groups: - - linux - - ubuntu - name: "ansible-ubuntu-2004-${MOLECULE_SCENARIO_NAME}" image_family: projects/ubuntu-os-cloud/global/images/family/ubuntu-2004-lts machine_type: e2-medium @@ -65,6 +58,13 @@ platforms: groups: - linux - debian + - name: "ansible-debian-11-${MOLECULE_SCENARIO_NAME}" + image_family: projects/debian-cloud/global/images/family/debian-11 + machine_type: e2-medium + size_gb: 40 + groups: + - linux + - debian - name: "ansible-sles-12-${MOLECULE_SCENARIO_NAME}" image_family: projects/suse-cloud/global/images/family/sles-12 machine_type: e2-medium diff --git a/molecule/ops-agent-test/molecule.yml b/molecule/ops-agent-test/molecule.yml index 2822af83..1ccd6265 100644 --- a/molecule/ops-agent-test/molecule.yml +++ b/molecule/ops-agent-test/molecule.yml @@ -30,6 +30,13 @@ platforms: groups: - linux - centos + - name: "ansible-rocky-9-${MOLECULE_SCENARIO_NAME}" + image_family: projects/rocky-linux-cloud/global/images/family/rocky-linux-9 + machine_type: e2-medium + size_gb: 40 + groups: + - linux + - centos - name: "ansible-rhel-7-${MOLECULE_SCENARIO_NAME}" image_family: projects/rhel-cloud/global/images/family/rhel-7 machine_type: e2-medium @@ -44,13 +51,13 @@ platforms: groups: - linux - rhel - - name: "ansible-ubuntu-1804-${MOLECULE_SCENARIO_NAME}" - image_family: projects/ubuntu-os-cloud/global/images/family/ubuntu-1804-lts + - name: "ansible-rhel-9-${MOLECULE_SCENARIO_NAME}" + image_family: projects/rhel-cloud/global/images/family/rhel-9 machine_type: e2-medium size_gb: 40 groups: - linux - - ubuntu + - rhel - name: "ansible-ubuntu-2004-${MOLECULE_SCENARIO_NAME}" image_family: projects/ubuntu-os-cloud/global/images/family/ubuntu-2004-lts machine_type: e2-medium @@ -58,6 +65,13 @@ platforms: groups: - linux - ubuntu + - name: "ansible-ubuntu-2204-${MOLECULE_SCENARIO_NAME}" + image_family: projects/ubuntu-os-cloud/global/images/family/ubuntu-2204-lts + machine_type: e2-medium + size_gb: 40 + groups: + - linux + - ubuntu - name: "ansible-debian-10-${MOLECULE_SCENARIO_NAME}" image_family: projects/debian-cloud/global/images/family/debian-10 machine_type: e2-medium @@ -65,6 +79,20 @@ platforms: groups: - linux - debian + - name: "ansible-debian-11-${MOLECULE_SCENARIO_NAME}" + image_family: projects/debian-cloud/global/images/family/debian-11 + machine_type: e2-medium + size_gb: 40 + groups: + - linux + - debian + - name: "ansible-debian-12-${MOLECULE_SCENARIO_NAME}" + image_family: projects/debian-cloud/global/images/family/debian-12 + machine_type: e2-medium + size_gb: 40 + groups: + - linux + - debian - name: "ansible-sles-12-${MOLECULE_SCENARIO_NAME}" image_family: projects/suse-cloud/global/images/family/sles-12 machine_type: e2-medium diff --git a/tasks/linux.yml b/tasks/linux.yml index 87853b45..ac19871a 100644 --- a/tasks/linux.yml +++ b/tasks/linux.yml @@ -16,6 +16,34 @@ check_mode: false changed_when: false +- block: + - name: REPO_CODENAME on Debian/Ubuntu + set_fact: + repo_codename: "{{ ansible_distribution_release }}" + when: ansible_distribution in ['Debian', 'Ubuntu'] + + - name: REPO_CODENAME on RedHat/CentOS/Rocky + set_fact: + repo_codename: "el{{ ansible_distribution_major_version }}" + when: ansible_distribution in ['RedHat', 'CentOS', 'Rocky'] + + - name: REPO_CODENAME on Amazon + block: + - name: Monitoring agent + set_fact: + repo_codename: "amzn" + when: agent_type == 'monitoring' + - name: Logging agent + set_fact: + repo_codename: "el6" + when: agent_type == 'logging' + when: ansible_distribution == 'Amazon' + + - name: REPO_CODENAME on SLES/openSUSE + set_fact: + repo_codename: "sles{{ ansible_distribution_major_version }}" + when: ansible_distribution in ['SLES', 'openSUSE', 'openSUSE Leap', 'SuSE', 'SLES_SAP'] + - name: Add repo and install agent or remove repo and uninstall agent command: chdir: "{{ tempfolder.path }}" @@ -23,7 +51,7 @@ bash add-{{ 'google-cloud-ops' if agent_type == 'ops-agent' else agent_type }}-agent-repo.sh {{ '--also-install' if package_state == 'present' else '--uninstall --remove-repo' }} --version={{ version }} {{ '--dry-run' if ansible_check_mode else '' }} environment: - REPO_CODENAME: "{{ ansible_distribution_release }}" + REPO_CODENAME: "{{ repo_codename | default(omit) }}" register: result retries: 5 delay: 10