Public bug reported:
I run lxd profiles with cloud-init (#cloud-config) configurations, and I use jinja2 templating (## template: jinja) so I can use one profile that I can apply to many distros. It works great, except on some images I notice ignore the jinja2 template directives. When I launch a new debian/11/cloud image, I noticed it does not adhere to the jinja2 template. config: user.user-data: | ## template: jinja #cloud-config {% if distro == 'centos' or 'rocky' -%} users: ~Do some stuff..... {%- endif %} {% if distro == 'debian' or 'ubuntu' -%} users: ~Do some stuff..... {%- endif %} The image has cloud-init 20.4.1, and has the jinja2 engine installed. So I don’t understand why it would not adhere to the jinja directives in the profile like all other distros do. I checked, the user-data file in /var/lib/cloud/seed/nocloud-net/ is exactly as it is in the profile, so that seems to pass correctly. If I issue: cloud-init query -f {{distro}} - I get the correct metadata variable of “debian”. If I issue: cloud-init devel render /var/lib/cloud/seed/nocloud- net/user-data -d it renders the entire user-data config, not just the jinja template variable like I normally see. It just seems to ignore the variable. LXD is cloud provider. Containers are hosted on-prem. Log collection attached. Thank you ** Affects: cloud-init Importance: Undecided Status: New ** Attachment added: "logs collection" https://bugs.launchpad.net/bugs/2007871/+attachment/5648669/+files/cloud-init.tar.gz -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to cloud-init. https://bugs.launchpad.net/bugs/2007871 Title: Not rendering jinja variables - Debian/11/cloud Status in cloud-init: New Bug description: I run lxd profiles with cloud-init (#cloud-config) configurations, and I use jinja2 templating (## template: jinja) so I can use one profile that I can apply to many distros. It works great, except on some images I notice ignore the jinja2 template directives. When I launch a new debian/11/cloud image, I noticed it does not adhere to the jinja2 template. config: user.user-data: | ## template: jinja #cloud-config {% if distro == 'centos' or 'rocky' -%} users: ~Do some stuff..... {%- endif %} {% if distro == 'debian' or 'ubuntu' -%} users: ~Do some stuff..... {%- endif %} The image has cloud-init 20.4.1, and has the jinja2 engine installed. So I don’t understand why it would not adhere to the jinja directives in the profile like all other distros do. I checked, the user-data file in /var/lib/cloud/seed/nocloud-net/ is exactly as it is in the profile, so that seems to pass correctly. If I issue: cloud-init query -f {{distro}} - I get the correct metadata variable of “debian”. If I issue: cloud-init devel render /var/lib/cloud/seed/nocloud- net/user-data -d it renders the entire user-data config, not just the jinja template variable like I normally see. It just seems to ignore the variable. LXD is cloud provider. Containers are hosted on-prem. Log collection attached. Thank you To manage notifications about this bug go to: https://bugs.launchpad.net/cloud-init/+bug/2007871/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp