# How do I update certificate in cloud config?

**URL:** <https://forums.suse.com/t/how-do-i-update-certificate-in-cloud-config/12662>\
**Category:** RancherOS\
**Created:** [December 10, 2018, 11:11am UTC](https://forums.suse.com/t/how-do-i-update-certificate-in-cloud-config/12662 "2018-12-10T11:11:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![philosifer](https://avatars.discourse-cdn.com/v4/letter/p/77aa72/32.png) [@philosifer](https://forums.suse.com/u/philosifer)\
**Post date:** [December 10, 2018, 11:11am UTC](https://forums.suse.com/t/how-do-i-update-certificate-in-cloud-config/12662/1 "2018-12-10T11:11:19Z")

</div>

I’ve successfully deployed rancher on rancheros and included the certificate for my private registry as described in the documentation. e.g.

#cloud-config  
write\_files:

- path: /etc/docker/certs.d/myregistrydomain.com:5000/ca.crt  
permissions: “0644”  
owner: root  
content: |  
-----BEGIN CERTIFICATE-----  
MIIDJjCCAg4CCQDLCSjwGXM72TANBgkqhkiG9w0BAQUFADBVMQswCQYDVQQGEwJB  
…  
vloANkUoc1pvzvxKoz2HIHUKf+xFT50xppx6wsQZ01pNMSNF0qgc1vvH  
-----END CERTIFICATE-----

The questions is how do i update the certificate when it expires and needs replacing? I tried replacing the file in /etc/docker.d/certs/… but when i reboot the node the cloud config just rights the old one back again.

Maybe its possible to do it with ros config set but i can’t figure out the syntax i’d use.

---

<div class="post-metadata">

**Author:** ![philosifer](https://avatars.discourse-cdn.com/v4/letter/p/77aa72/32.png) [@philosifer](https://forums.suse.com/u/philosifer)\
**Post date:** [December 11, 2018, 9:21am UTC](https://forums.suse.com/t/how-do-i-update-certificate-in-cloud-config/12662/2 "2018-12-11T09:21:25Z")

</div>

Because the certificate is a multiline value its going to be tricky do with ros config set but I worked out a way to do it with merge so for the benefit of others…

sudo ros config get write\_files \> writefiles.yml

That will dump out the write files section from your live cloud config.

Use an editor to add in the “write\_files:” line at the top that it will need later. Edit the certificate section with your new certificate values.

Now just do

sudo ros config merge -i writefiles.yml

Reboot and verify that the new value is being applied. Now to script that for all the other nodes.
