main.yml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. # Copyright 2021 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: Include variables from control_plane_common role
  16. include_vars: "{{ role_path }}/../../../roles/control_plane_common/vars/main.yml"
  17. no_log: True
  18. - name: Check login_vars.yml is encrypted
  19. command: cat {{ role_path }}/../../../{{ login_vars_filename }}
  20. changed_when: false
  21. register: config_content
  22. - name: Decrpyt login_vars.yml
  23. command: >-
  24. ansible-vault decrypt {{ role_path }}/../../../{{ login_vars_filename }}
  25. --vault-password-file {{ role_path }}/../../../{{ vault_filename }}
  26. changed_when: false
  27. when: "'$ANSIBLE_VAULT;' in config_content.stdout"
  28. - name: Include variable file appliance_config.yml
  29. include_vars: "{{ role_path }}/../../../{{ login_vars_filename }}"
  30. no_log: true
  31. - name: Save input variables from file
  32. set_fact:
  33. cobbler_password: "{{ provision_password }}"
  34. no_log: true
  35. - name: Encrypt login_vars.yml
  36. command: >-
  37. ansible-vault encrypt {{ role_path }}/../../../{{ login_vars_filename }}
  38. --vault-password-file {{ role_path }}/../../../{{ vault_filename }}
  39. changed_when: false
  40. - name: Update login_vars.yml permission
  41. file:
  42. path: "{{ role_path }}/../../../{{ login_vars_filename }}"
  43. mode: "{{ file_perm }}"