secrets.yml 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # Copyright 2022 Dell Inc. or its subsidiaries. All Rights Reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. ---
  15. - name: Encrypt grafana username
  16. shell: |
  17. set -o pipefail
  18. echo -n "{{ grafana_username }}" | base64
  19. register: grafana_user_encrypted
  20. changed_when: false
  21. no_log: true
  22. - name: Encrypt grafana password
  23. shell: |
  24. set -o pipefail
  25. echo -n "{{ grafana_password }}" | base64
  26. register: grafana_password_encrypted
  27. changed_when: false
  28. no_log: true
  29. - name: Kubernetes secrets
  30. kubernetes.core.k8s:
  31. state: present
  32. definition:
  33. apiVersion: v1
  34. kind: Secret
  35. metadata:
  36. name: "{{ grafana_secrets }}"
  37. namespace: "{{ grafana_namespace }}"
  38. type: Opaque
  39. data:
  40. grafana_username: "{{ grafana_user_encrypted.stdout }}"
  41. grafana_password: "{{ grafana_password_encrypted.stdout }}"