main.yml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # Copyright 2020 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 common role
  16. include_vars: "{{ role_path }}/../../../roles/common/vars/main.yml"
  17. no_log: True
  18. - name: Check input config file is encrypted
  19. command: cat {{ role_path }}/../../../{{ input_config_filename }}
  20. changed_when: false
  21. register: config_content
  22. - name: Decrpyt appliance_config.yml
  23. command: >-
  24. ansible-vault decrypt {{ role_path }}/../../../{{ input_config_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 }}/../../../{{ input_config_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 input config file
  36. command: >-
  37. ansible-vault encrypt {{ role_path }}/../../../{{ input_config_filename }}
  38. --vault-password-file {{ role_path }}/../../../{{ vault_filename }}
  39. changed_when: false