2023-12-12 11:35:22, ERROR | render_engine.py:304 | MainThread: device config_context render issue: device_a clashing key found in equally weighted contexts: key: harry_potter contexts: ['switch', 'vpn'] clashing key found in equally weighted contexts: key: gabbys_doll_house contexts: ['router', 'switch'] 2023-12-12 11:35:22, ERROR | render_engine.py:350 | MainThread: device template render issue: device_a template: ./platform_templates/ios.j2 empty config_context: {} 2023-12-12 11:35:22, INFO | render_engine.py:364 | MainThread: device_b rendered file written: ./rendered_templates/device_b.txt 2023-12-12 11:35:22, INFO | render_engine.py:356 | MainThread: device_b rendered file content: **** start of template **** 0) display the config_context: top level context item: {'best_unicorn': ['sugar socks', 'star light', 'sparkle', 'twinkle', 'glitter love'], 'cbeebies_schedule': '18/11/2023', 'device': 'device_b', 'gabbys_doll_house': 1, 'harry_potter': 1, 'octonaughts': 1, 'region': 'europe', 'site': 'dublin'} selecting the best unicorn with config_context['best_unicorn'][0]: sugar socks accessing a key pair injected into the jinja environment global variables: (in this case the config_context printed out in human readable yaml format) best_unicorn: - sugar socks - star light - sparkle - twinkle - glitter love cbeebies_schedule: 18/11/2023 device: device_b gabbys_doll_house: 1 harry_potter: 1 octonaughts: 1 region: europe site: dublin loop through the config_context variable in jinja: best_unicorn:['sugar socks', 'star light', 'sparkle', 'twinkle', 'glitter love'] cbeebies_schedule:18/11/2023 device:device_b gabbys_doll_house:1 harry_potter:1 octonaughts:1 region:europe site:dublin 1) source template ./device/device_b.yml 2) source template ./device/region/europe.yml 3) source template ./device/site/dublin.yml 4) source template ./device/role/.yml these contexts happens to be a list in the inventory files under this directory happen to have the same weight(they dont have to) thus these files do not have the same keys as they would clash gabbys_doll_house = 1 octonaughts = 1 notice best_unicorn is in the all.yml context and router.yml context router.yml has a higher precedence(lower weight value) - sugar socks - star light - sparkle - twinkle - glitter love harry_potter = 1 notice cbeebies_schedule is in the all.yml context and vpn.yml context all.yml context is weighted last/-1, any other context will overwrite it vpn.yml has a higher precedence(lower weight value) cbeebies_schedule = 18/11/2023 4) source template ./device/role/all.yml nothing is rendered using this context, all variables are overwritten by contexts with higher precedence this would be a good place to put service accounts in ACLs or legal disclaimers **** end of template **** 2023-12-12 11:36:41, ERROR | render_engine.py:304 | MainThread: device config_context render issue: device_a clashing key found in equally weighted contexts: key: gabbys_doll_house contexts: ['router', 'switch'] clashing key found in equally weighted contexts: key: harry_potter contexts: ['switch', 'vpn'] 2023-12-12 11:36:41, ERROR | render_engine.py:350 | MainThread: device template render issue: device_a template: ./platform_templates/ios.j2 empty config_context: {} 2023-12-12 11:36:41, INFO | render_engine.py:364 | MainThread: device_b rendered file written: ./rendered_templates/device_b.txt 2023-12-12 11:36:41, INFO | render_engine.py:356 | MainThread: device_b rendered file content: **** start of template **** 0) display the config_context: top level context item: {'best_unicorn': ['sugar socks', 'star light', 'sparkle', 'twinkle', 'glitter love'], 'cbeebies_schedule': '18/11/2023', 'device': 'device_b', 'gabbys_doll_house': 1, 'harry_potter': 1, 'octonaughts': 1, 'region': 'europe', 'site': 'dublin'} selecting the best unicorn with config_context['best_unicorn'][0]: sugar socks accessing a key pair injected into the jinja environment global variables: (in this case the config_context printed out in human readable yaml format) best_unicorn: - sugar socks - star light - sparkle - twinkle - glitter love cbeebies_schedule: 18/11/2023 device: device_b gabbys_doll_house: 1 harry_potter: 1 octonaughts: 1 region: europe site: dublin loop through the config_context variable in jinja: best_unicorn:['sugar socks', 'star light', 'sparkle', 'twinkle', 'glitter love'] cbeebies_schedule:18/11/2023 device:device_b gabbys_doll_house:1 harry_potter:1 octonaughts:1 region:europe site:dublin 1) source template ./device/device_b.yml 2) source template ./device/region/europe.yml 3) source template ./device/site/dublin.yml 4) source template ./device/role/.yml these contexts happens to be a list in the inventory files under this directory happen to have the same weight(they dont have to) thus these files do not have the same keys as they would clash gabbys_doll_house = 1 octonaughts = 1 notice best_unicorn is in the all.yml context and router.yml context router.yml has a higher precedence(lower weight value) - sugar socks - star light - sparkle - twinkle - glitter love harry_potter = 1 notice cbeebies_schedule is in the all.yml context and vpn.yml context all.yml context is weighted last/-1, any other context will overwrite it vpn.yml has a higher precedence(lower weight value) cbeebies_schedule = 18/11/2023 4) source template ./device/role/all.yml nothing is rendered using this context, all variables are overwritten by contexts with higher precedence this would be a good place to put service accounts in ACLs or legal disclaimers **** end of template **** 2023-12-12 11:36:55, ERROR | render_engine.py:303 | MainThread: device config_context render issue: device_a clashing key found in equally weighted contexts: key: gabbys_doll_house contexts: ['router', 'switch'] clashing key found in equally weighted contexts: key: harry_potter contexts: ['switch', 'vpn'] 2023-12-12 11:36:55, ERROR | render_engine.py:349 | MainThread: device template render issue: device_a template: ./platform_templates/ios.j2 empty config_context: {} 2023-12-12 11:36:55, INFO | render_engine.py:363 | MainThread: device_b rendered file written: ./rendered_templates/device_b.txt 2023-12-12 11:46:39, ERROR | render_engine.py:291 | MainThread: device config_context render issue: device_a clashing key found in equally weighted contexts: key: harry_potter contexts: ['switch', 'vpn'] clashing key found in equally weighted contexts: key: gabbys_doll_house contexts: ['router', 'switch'] 2023-12-12 11:46:39, ERROR | render_engine.py:335 | MainThread: device template render issue: device_a template: ./platform_templates/ios.j2 empty config_context: {} 2023-12-12 11:46:39, INFO | render_engine.py:347 | MainThread: device_b rendered file written: ./rendered_templates/device_b.txt