mount_iso.yml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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: Initialize vars
  16. set_fact:
  17. mount_check: "0"
  18. tags: install
  19. - name: Check iso directory status
  20. stat:
  21. path: "/mnt/{{ iso_dir_name }}"
  22. register: check_iso_dir
  23. - name: Create iso directory
  24. file:
  25. path: "/mnt/{{ iso_dir_name }}"
  26. state: directory
  27. mode: 0644
  28. tags: install
  29. when: not check_iso_dir.stat.exists
  30. - name: Check mountpoint
  31. command: mountpoint /mnt/{{ iso_dir_name }}
  32. changed_when: false
  33. register: result
  34. failed_when: false
  35. tags: install
  36. - name: Update mount status
  37. set_fact:
  38. mount_check: "{{ result.rc }}"
  39. tags: install
  40. - name: Mount the iso file
  41. command: mount -o loop {{ iso_file_path }} /mnt/{{ iso_dir_name }}
  42. changed_when: false
  43. args:
  44. warn: no
  45. when: "'1' in mount_check"
  46. tags: install