Code review comment for ~t0rrant/cloud-init:1819966-sysconfig-options

Revision history for this message
Ryan Harper (raharper) wrote :

Hi Manual,

Thanks for creating a potential fix. The various network-config formats that cloud-init handles don't lend themselves to writing arbitrary configuration values to renderer specific files, in your case, the NTPSERVERARGS is a sysconfig renderer specific value that doesn't have an equivalent in other backends, such as eni (etc/network/interfaces) nor netplan.

To address the bug I think the best option is use cloud-init write_files config module to append the string you're interested in.

  - content: |
        NTPSERVERARGS="minpoll 3 maxpoll 3"
    path: /etc/sysconfig/network
    append: true

There is also the cc_ntp module, which controls enabling ntp service, and configuring
but this would only cover your ntp configuration using a custom template.

  enabled: true
     template: |
         ## template:jinja
         # My NTP Client config
         {% if pools -%}# pools{% endif %}
         {% for pool in pools -%}
         pool {{pool}} iburst minpoll 3 maxpoll 4
         {% endfor %}
         {%- if servers %}# servers
         {% endif %}
         {% for server in servers -%}
         server {{server}} iburst
         {% endfor %}

« Back to merge proposal