Changeset - bcad613ab0c5
[Not reviewed]
0 5 0
Branko Majic (branko) - 4 years ago 2021-01-14 23:50:30
branko@majic.rs
MAR-151: Added support for Debian 10 Buster to preseed role:

- Updated role reference documentaiton.
- Updated role meta information.
- Updated tests.
- Parametrise distribution release in one of the tests to cover both
servers with custom overrides being tested.
5 files changed with 55 insertions and 5 deletions:
0 comments (0 inline, 0 general)
docs/rolereference.rst
Show inline comments
 
@@ -131,6 +131,7 @@ Distribution compatibility
 
Role is compatible with the following distributions:
 

	
 
- Debian 9 (Stretch)
 
- Debian 10 (Buster)
 

	
 

	
 
Examples
roles/preseed/meta/main.yml
Show inline comments
 
@@ -8,5 +8,5 @@ galaxy_info:
 
  platforms:
 
    - name: Debian
 
      versions:
 
        - 8
 
        - 9
 
        - 10
roles/preseed/molecule/default/group_vars/parameters-optional-with-overrides.yml
Show inline comments
 
@@ -21,3 +21,21 @@ preseed_server_overrides:
 
    network_interface: eth1
 
    root_password: myrootpassword
 
    timezone: Europe/Belgrade
 
  parameters-optional-with-overrides-buster64:
 
    country: RS
 
    dns: 1.1.1.1
 
    domain: example.com
 
    gateway: 2.2.2.2
 
    hostname: testing
 
    ip: 3.3.3.3
 
    keymap: sv
 
    language: sr
 
    locale: en_UK.UTF-8
 
    mirror_directory: /
 
    mirror_hostname: ftp.de.debian.org
 
    mirror_proxy: http://proxy.local
 
    netmask: 255.255.0.0
 
    network_auto: false
 
    network_interface: eth1
 
    root_password: myrootpassword
 
    timezone: Europe/Belgrade
roles/preseed/molecule/default/molecule.yml
Show inline comments
 
@@ -35,6 +35,27 @@ platforms:
 
    memory: 256
 
    cpus: 1
 

	
 
  - name: parameters-mandatory-buster64
 
    groups:
 
      - parameters-mandatory
 
    box: debian/contrib-buster64
 
    memory: 256
 
    cpus: 1
 

	
 
  - name: parameters-optional-buster64
 
    groups:
 
      - parameters-optional
 
    box: debian/contrib-buster64
 
    memory: 256
 
    cpus: 1
 

	
 
  - name: parameters-optional-with-overrides-buster64
 
    groups:
 
      - parameters-optional-with-overrides
 
    box: debian/contrib-buster64
 
    memory: 256
 
    cpus: 1
 

	
 
provisioner:
 
  name: ansible
 
  config_options:
roles/preseed/molecule/default/tests/test_parameters_optional_with_overrides.py
Show inline comments
 
import os
 

	
 
import pytest
 

	
 
import testinfra.utils.ansible_runner
 

	
 

	
 
@@ -7,12 +9,16 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
 
    os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('parameters-optional-with-overrides')
 

	
 

	
 
def test_preseed_configuration_file_content_host_without_overrides(host):
 
@pytest.mark.parametrize("distribution_release", [
 
    "stretch",
 
    "buster"
 
])
 
def test_preseed_configuration_file_content_host_without_overrides(host, distribution_release):
 
    """
 
    Tests content of generated preseed configuration file.
 
    """
 

	
 
    hostname = 'parameters-mandatory-stretch64'
 
    hostname = 'parameters-mandatory-%s64' % distribution_release
 

	
 
    with host.sudo():
 
        preseed_file = host.file(os.path.join("/tmp/preseed_files", "%s.cfg" % hostname))
 
@@ -39,12 +45,16 @@ d-i netcfg/get_domain string ignored-value""" in preseed_file_content
 
    assert ssh_public_key in preseed_file_content
 

	
 

	
 
def test_preseed_configuration_file_content_host_with_overrides(host):
 
@pytest.mark.parametrize("distribution_release", [
 
    "stretch",
 
    "buster"
 
])
 
def test_preseed_configuration_file_content_host_with_overrides(host, distribution_release):
 
    """
 
    Tests content of generated preseed configuration file.
 
    """
 

	
 
    hostname = 'parameters-optional-with-overrides-stretch64'
 
    hostname = 'parameters-optional-with-overrides-%s64' % distribution_release
 

	
 
    with host.sudo():
 
        preseed_file = host.file(os.path.join("/tmp/preseed_files", "%s.cfg" % hostname))
0 comments (0 inline, 0 general)