Merge "Running ansible-config before writing default config"

This commit is contained in:
Zuul 2021-11-18 22:28:49 +00:00 committed by Gerrit Code Review
commit bdd016b8ff
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 = configparser.ConfigParser()
config.read(ansible_config_path) 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', 'retry_files_enabled', 'False')
config.set('defaults', 'roles_path', roles_path) config.set('defaults', 'roles_path', roles_path)
config.set('defaults', 'library', modules_path) config.set('defaults', 'library', modules_path)