Running ansible-config before writing default config

Since ansible 2.12, the default config is completely empty and this
breaks the undercloud install process.

We need to run ansible-config beforehand to generate a boilerplace
config.

Closes-bug: #1951020
Change-Id: I544d117e03037c8a4744139c36bc63b978c489dd
This commit is contained in:
David Vallee Delisle 2021-11-15 18:20:50 -05:00
parent 0d3252d5d7
commit 02c44076e6
1 changed files with 6 additions and 0 deletions

View File

@ -84,6 +84,12 @@ def write_default_ansible_cfg(work_dir,
config = configparser.ConfigParser()
config.read(ansible_config_path)
# NOTE(dvd): since ansible 2.12, we need to create the sections
# becase the base file is now empty.
for section in ['defaults', 'ssh_connection']:
if section not in config.sections():
config.add_section(section)
config.set('defaults', 'retry_files_enabled', 'False')
config.set('defaults', 'roles_path', roles_path)
config.set('defaults', 'library', modules_path)