← Back to team overview

cloud-init-dev team mailing list archive

Re: [Merge] ~t0rrant/cloud-init:1819966-sysconfig-options into cloud-init:master

 

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.

#cloud-config
write_files:
  - content: |
        NTPSERVERARGS="minpoll 3 maxpoll 3"
        RES_OPTIONS="rotate"
    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.

#cloud-config
ntp:                                                                   
  enabled: true                                                        
  config:                                                              
     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 %}
         
         
-- 
https://code.launchpad.net/~t0rrant/cloud-init/+git/cloud-init/+merge/371948
Your team cloud-init commiters is requested to review the proposed merge of ~t0rrant/cloud-init:1819966-sysconfig-options into cloud-init:master.


References