easy-mode-upload.yaml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. # This example generates HTML and JSON reports and
  2. #
  3. # Copies of the generated HTML and JSON reports are uploaded to the masters,
  4. # which is particularly useful when this playbook is run from a container.
  5. #
  6. # All certificates (healthy or not) are included in the results
  7. #
  8. # Optional environment variables to alter the behaviour of the playbook:
  9. # CERT_EXPIRY_WARN_DAYS: Length of the warning window in days (45)
  10. # COPY_TO_PATH: path to copy reports to in the masters (/etc/origin/certificate_expiration_report)
  11. ---
  12. - name: Generate certificate expiration reports
  13. hosts: nodes:masters:etcd
  14. vars:
  15. openshift_certificate_expiry_save_json_results: yes
  16. openshift_certificate_expiry_generate_html_report: yes
  17. openshift_certificate_expiry_show_all: yes
  18. openshift_certificate_expiry_warning_days: "{{ lookup('env', 'CERT_EXPIRY_WARN_DAYS') | default('45', true) }}"
  19. roles:
  20. - role: openshift_certificate_expiry
  21. - name: Upload reports to master
  22. hosts: masters
  23. gather_facts: no
  24. vars:
  25. destination_path: "{{ lookup('env', 'COPY_TO_PATH') | default('/etc/origin/certificate_expiration_report', true) }}"
  26. timestamp: "{{ lookup('pipe', 'date +%Y%m%d') }}"
  27. tasks:
  28. - name: Ensure that the target directory exists
  29. file:
  30. path: "{{ destination_path }}"
  31. state: directory
  32. - name: Copy the reports
  33. copy:
  34. dest: "{{ destination_path }}/{{ timestamp }}-{{ item }}"
  35. src: "/tmp/{{ item }}"
  36. with_items:
  37. - "cert-expiry-report.html"
  38. - "cert-expiry-report.json"