main.yml 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. ---
  2. - name: Remove kubeadm cronjob that renews certificates
  3. cron:
  4. name: "Use kubeadm renew certificates"
  5. special_time: monthly
  6. user: root
  7. job: "/usr/bin/kubeadm alpha certs renew all"
  8. cron_file: yunion_kubeadm_renew_certs
  9. state: absent
  10. become: true
  11. - name: Ensure a cronjob that renews k8s certificates
  12. cron:
  13. name: "Use ocadm renew certificates"
  14. special_time: monthly
  15. user: root
  16. job: "/opt/yunion/bin/ocadm alpha certs renew all"
  17. cron_file: yunion_ocadm_renew_certs
  18. become: true
  19. - name: Check if k3s.service.env file exists
  20. ansible.builtin.stat:
  21. path: /etc/systemd/system/k3s.service.env
  22. register: k3s_service_env_file
  23. become: true
  24. - name: Add CATTLE_NEW_SIGNED_CERT_EXPIRATION_DAYS to k3s.service.env if not set
  25. ansible.builtin.lineinfile:
  26. path: /etc/systemd/system/k3s.service.env
  27. line: "CATTLE_NEW_SIGNED_CERT_EXPIRATION_DAYS=3650"
  28. regexp: "^CATTLE_NEW_SIGNED_CERT_EXPIRATION_DAYS="
  29. state: present
  30. create: false
  31. when: k3s_service_env_file.stat.exists
  32. become: true