This ticket depends on the first release of ansible-runner-wrapper being available on pypi.
Note:
- Currently, dss_docker/create_image.py adds extra_var
docker_container to the Ansible playbook.
- The variable is only used in playbooks used by
dss_docker/create_image.py but should remain in the extra_vars as some playbooks depend on this variable
- Other than the former implementation of AnsibleAccess in the AI Lab,
dss_docker/create_image.py does not need to inspect extra_vars.
- test/ansible/ansible_sample_playbook.yml contains a reference to the fictional ansible variable
test_docker_container but the playbook is never actually evaluated, otherwise ansible could report an error.
Required changes, as ARW differs from former implementation in ai-lab:
- run_install_dependencies should return a plain dict instead of
AnsibleFacts.
- In _install_dependencies() in file
dss_docker/create_image.py use
host = ansible.InventoryHost(self.container_name)
access = ansible.Access(retrieve_facts_from=host.host_name)
fact_dict = run_install_dependencies(
access,
configuration=self._ansible_config(),
host_infos=(host,),
# ...
)
return ansible.Facts(fact_dict, prefixes=["dss_facts"])
- Remove the files in
ai-lab/exasol/ds/sandbox/lib/ansible/
- Update logging exasol.ds.sandbox.lib.logging.get_status_logger()
def get_status_logger(log_type: LogType) -> logging.Logger:
prefix = "exasol." if log_type == LogType.ANSIBLE else "ai-lab-"
return logging.getLogger(f"{prefix}{log_type.value}")
Hosts
AI Lab's old implementation supported generating an Ansible inventory on the fly. ARW does not support this anymore.
- File ec2_playbook.yml contains
hosts: ec2 which probably matches all hosts with AWS PublicDnsName starting with ec2.
- This only works if there is an inventory file containing the full public DNS name and the name of the file containing the private key, see Ansible docs on Patterns.
Out of scope
- Remove obsolete tests, e.g.
This ticket depends on the first release of ansible-runner-wrapper being available on pypi.
Note:
docker_containerto the Ansible playbook.dss_docker/create_image.pybut should remain in the extra_vars as some playbooks depend on this variabledss_docker/create_image.pydoes not need to inspectextra_vars.test_docker_containerbut the playbook is never actually evaluated, otherwise ansible could report an error.Required changes, as ARW differs from former implementation in ai-lab:
AnsibleFacts.dss_docker/create_image.pyuseai-lab/exasol/ds/sandbox/lib/ansible/Hosts
AI Lab's old implementation supported generating an Ansible inventory on the fly. ARW does not support this anymore.
hosts: ec2which probably matches all hosts with AWS PublicDnsName starting withec2.Out of scope
test/unit/test_ansible.pytest/unit/ansible/test/ansible