main.yml 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. ---
  2. # Updates pip, installs the lab scripts.
  3. #
  4. # The following variables must exist:
  5. #
  6. # lab_sku: ad482 (or some other SKU)
  7. # lab_package: rht-labs-{{ lab_sku }}
  8. # lab_index_url: https://pypi.apps.tools-na.prod.nextcle.com/repository/labs/simple/
  9. # lab_files_fixes: a list of patch files to apply to lab materials
  10. #
  11. - name: Upgrade pip
  12. ansible.builtin.pip:
  13. name: pip
  14. state: latest
  15. - name: Install the lab package
  16. ansible.builtin.pip:
  17. name: "{{ lab_package }}"
  18. state: present
  19. extra_args: "--extra-index-url {{ lab_index_url }}"
  20. - name: Set the grading_config_file fact for convenience
  21. set_fact:
  22. grading_config_file: "{{ ansible_facts['user_dir'] }}/.grading/config.yaml"
  23. - name: Check if the grading config is there
  24. ansible.builtin.stat:
  25. path: "{{ grading_config_file }}"
  26. register: grading_file
  27. - name: Load the current grading config
  28. set_fact:
  29. grading_cfg: "{{ lookup('ansible.builtin.file', grading_config_file) | from_yaml }}"
  30. when: grading_file.stat.exists
  31. - name: Extract the current SKU
  32. set_fact:
  33. current_sku: "{{ grading_cfg.rhtlab.course.sku }}"
  34. when: grading_cfg is defined
  35. - name: Activate the new labs
  36. ansible.builtin.shell: "lab select {{ lab_sku }}"
  37. when: (current_sku is not defined) or (current_sku != lab_sku)
  38. ...