2020-03-09 10:11:07 +01:00
|
|
|
---
|
2020-09-25 08:01:17 +02:00
|
|
|
####################################################################
|
|
|
|
# WARNING: These are designed specifically for Ansible tests #
|
|
|
|
# and should not be used as examples of how to write Ansible roles #
|
|
|
|
####################################################################
|
|
|
|
|
2022-08-05 21:31:34 +02:00
|
|
|
# Copyright (c) Ansible Project
|
|
|
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2020-03-09 10:11:07 +01:00
|
|
|
- name: test cloud-init
|
|
|
|
# TODO: check for a workaround
|
|
|
|
# install 'cloud-init'' failed: dpkg-divert: error: `diversion of /etc/init/ureadahead.conf
|
|
|
|
# to /etc/init/ureadahead.conf.disabled by cloud-init' clashes with `local diversion of
|
|
|
|
# /etc/init/ureadahead.conf to /etc/init/ureadahead.conf.distrib
|
|
|
|
# https://bugs.launchpad.net/ubuntu/+source/ureadahead/+bug/997838
|
|
|
|
# Will also have to skip on OpenSUSE when running on Python 2 on newer Leap versions
|
|
|
|
# (!= 42 and >= 15) ascloud-init will install the Python 3 package, breaking our build on py2.
|
|
|
|
when:
|
|
|
|
- not (ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int == 14)
|
|
|
|
- not (ansible_os_family == "Suse" and ansible_distribution_major_version|int != 42 and ansible_python.version.major != 3)
|
2022-05-08 14:00:29 +02:00
|
|
|
- not (ansible_distribution == "CentOS" and ansible_distribution_major_version|int == 8) # TODO: cannot start service
|
2022-02-21 21:14:45 +01:00
|
|
|
- not (ansible_distribution == 'Archlinux') # TODO: package seems to be broken, cannot be downloaded from mirrors?
|
|
|
|
- not (ansible_distribution == 'Alpine') # TODO: not sure what's wrong here, the module doesn't return what the tests expect
|
2020-03-09 10:11:07 +01:00
|
|
|
block:
|
|
|
|
- name: setup install cloud-init
|
|
|
|
package:
|
|
|
|
name:
|
|
|
|
- cloud-init
|
|
|
|
- udev
|
|
|
|
|
2023-01-07 18:17:12 +01:00
|
|
|
- name: Ensure systemd-network user exists
|
|
|
|
user:
|
|
|
|
name: systemd-network
|
|
|
|
state: present
|
|
|
|
when: ansible_distribution == 'Fedora' and ansible_distribution_major_version|int >= 37
|
|
|
|
|
2020-03-09 10:11:07 +01:00
|
|
|
- name: setup run cloud-init
|
|
|
|
service:
|
|
|
|
name: cloud-init-local
|
|
|
|
state: restarted
|
|
|
|
|
|
|
|
- name: test gather cloud-init facts in check mode
|
|
|
|
cloud_init_data_facts:
|
2023-02-16 06:42:27 +01:00
|
|
|
check_mode: true
|
2020-03-09 10:11:07 +01:00
|
|
|
register: result
|
|
|
|
- name: verify test gather cloud-init facts in check mode
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result.cloud_init_data_facts.status.v1 is defined
|
|
|
|
- result.cloud_init_data_facts.status.v1.stage is defined
|
|
|
|
- not result.cloud_init_data_facts.status.v1.stage
|
|
|
|
- cloud_init_data_facts.status.v1 is defined
|
|
|
|
- cloud_init_data_facts.status.v1.stage is defined
|
|
|
|
- not cloud_init_data_facts.status.v1.stage
|
|
|
|
|
|
|
|
- name: test gather cloud-init facts
|
|
|
|
cloud_init_data_facts:
|
|
|
|
register: result
|
|
|
|
- name: verify test gather cloud-init facts
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result.cloud_init_data_facts.status.v1 is defined
|
|
|
|
- result.cloud_init_data_facts.status.v1.stage is defined
|
|
|
|
- not result.cloud_init_data_facts.status.v1.stage
|
|
|
|
- cloud_init_data_facts.status.v1 is defined
|
|
|
|
- cloud_init_data_facts.status.v1.stage is defined
|
|
|
|
- not cloud_init_data_facts.status.v1.stage
|