123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- ---
- # Updates pip, installs the lab scripts.
- #
- # The following variables must exist:
- #
- # lab_sku: ad482 (or some other SKU)
- # lab_package: rht-labs-{{ lab_sku }}
- # lab_index_url: https://pypi.apps.tools-na.prod.nextcle.com/repository/labs/simple/
- # lab_files_fixes: a list of patch files to apply to lab materials
- # - patch: files/patch.patch
- # target: some/file.txt
- #
- - name: Upgrade pip
- ansible.builtin.pip:
- name: pip
- state: latest
- - name: Install the lab package
- ansible.builtin.pip:
- name: "{{ lab_package }}"
- state: present
- extra_args: "--extra-index-url {{ lab_index_url }}"
- - name: Set the grading_config_file fact for convenience
- set_fact:
- grading_config_file: "{{ ansible_facts['user_dir'] }}/.grading/config.yaml"
- - name: Check if the grading config is there
- ansible.builtin.stat:
- path: "{{ grading_config_file }}"
- register: grading_file
- - name: Load the current grading config
- set_fact:
- grading_cfg: "{{ lookup('ansible.builtin.file', grading_config_file) | from_yaml }}"
- when: grading_file.stat.exists
- - name: Extract the current SKU
- set_fact:
- current_sku: "{{ grading_cfg.rhtlab.course.sku }}"
- when: grading_cfg is defined
- - name: Activate the new labs
- ansible.builtin.shell: "lab select {{ lab_sku }}"
- when: (current_sku is not defined) or (current_sku != lab_sku)
- - name: Ensure ansible POSIX collection is there
- become: yes
- yum:
- name:
- - ansible-collection-ansible-posix
- state: latest
- - name: Apply all the patches to lab resources
- ansible.posix.patch:
- src: "{{ item.patch }}"
- dest: "{{ item.target }}"
- ignore_whitespace: yes
- loop: "{{ lab_files_fixes }}"
- ...
|