Files
@ 8d272d91d3d2
Branch filter:
Location: majic-ansible-roles/roles/preseed/molecule/default/tests/test_parameters_optional.py - annotation
8d272d91d3d2
2.4 KiB
text/x-python
MAR-165: Deploy Diffie-Helman parameters for LDAP server in the ldap_server role:
- Not relevant for Debian Strech because of a bug in the OpenLDAP
version it ships with.
- This should allow use of DHE ciphers with LDAP server.
- Generated DH parameters only help pick one of the parameters from
RFC-7919 (based on the size of generated ones).
- Make the cipher test lists distro-specific due to differences
between supported algorithms in respective GnuTLS versions.
- Not relevant for Debian Strech because of a bug in the OpenLDAP
version it ships with.
- This should allow use of DHE ciphers with LDAP server.
- Generated DH parameters only help pick one of the parameters from
RFC-7919 (based on the size of generated ones).
- Make the cipher test lists distro-specific due to differences
between supported algorithms in respective GnuTLS versions.
da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 d62b3adec462 da27c590e954 da27c590e954 4ee589937d60 da27c590e954 da27c590e954 da27c590e954 da27c590e954 4ee589937d60 da27c590e954 da27c590e954 4ee589937d60 da27c590e954 d47bd45e61b3 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 4ee589937d60 da27c590e954 da27c590e954 da27c590e954 da27c590e954 df804f3e9b89 4ee589937d60 4ee589937d60 d47bd45e61b3 d20f150f3cca bb8003ddf790 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 da27c590e954 | import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('parameters-optional')
def test_preseed_configuration_files(host):
"""
Tests presence and permissions on created preseed configuration files.
"""
with host.sudo():
# Verify that preseed configuration files are created for all hosts.
for testinfra_host in testinfra_hosts:
preseed_file = host.file(os.path.join("/tmp/preseed_files", "%s.cfg" % testinfra_host))
assert preseed_file.is_file
assert preseed_file.mode == 0o640
def test_preseed_configuration_file_content(host):
"""
Tests content of generated preseed configuration file.
"""
hostname = host.run('hostname').stdout.strip()
with host.sudo():
preseed_file = host.file(os.path.join("/tmp/preseed_files", "%s.cfg" % hostname))
preseed_file_content = preseed_file.content_string
ssh_public_key = "MY_ANSIBLE_KEY"
assert "d-i debian-installer/language string sr" in preseed_file_content
assert "d-i debian-installer/country string RS" in preseed_file_content
assert "d-i debian-installer/locale string en_UK.UTF-8" in preseed_file_content
assert "d-i keyboard-configuration/xkb-keymap select sv" in preseed_file_content
assert "d-i netcfg/choose_interface select eth1" in preseed_file_content
assert """# Manual network configuration.
d-i netcfg/disable_autoconfig boolean true
d-i netcfg/get_ipaddress string 3.3.3.3
d-i netcfg/get_netmask string 255.255.0.0
d-i netcfg/get_gateway string 2.2.2.2
d-i netcfg/get_nameservers string 1.1.1.1
d-i netcfg/confirm_static boolean true
# Hostname and domain configuration.
d-i netcfg/get_hostname string testing
d-i netcfg/get_domain string example.com""" in preseed_file_content
assert "d-i mirror/http/hostname string ftp.de.debian.org" in preseed_file_content
assert "d-i mirror/http/directory string /" in preseed_file_content
assert "d-i mirror/http/proxy string http://proxy.local" in preseed_file_content
assert "d-i passwd/root-password password myrootpassword" in preseed_file_content
assert "d-i passwd/root-password-again password myrootpassword" in preseed_file_content
assert "d-i time/zone string Europe/Belgrade" in preseed_file_content
assert ssh_public_key in preseed_file_content
|