-
Story
-
Resolution: Done
-
Minor
-
RH294 - RHEL9.0-en-2-20221117
-
None
-
6
-
en-US (English)
URL:
Reporter RHNID:
Section: -
Language: en-US (English)||||||||
Workaround:
Description: Please consider using FQCN for the import_tasks, include_tasks, import_playbook modules to match the style of the rest of the course book.
Also, in my experience students always have questions about the import_tasks vs. include_tasks module behavior. Unfortunately, this exercise uses them in a way that is completely interchangeable. I think the most noteworthy difference is how a when keyword applies to these modules. It would be very easy to add a simple test to these tasks in this play, like checking the linux distro fact, just for students to see how the test gets repeated for each of the 3 firewall tasks.
- name: Include the environment task file and set the variables
ansible.builtin.include_tasks:
file: tasks/environment.yml
vars:
package: httpd
service: httpd
when: ansible_facts['distribution'] == "RedHat"
- name: Import the firewall task file and set the variables
ansible.builtin.import_tasks:
file: tasks/firewall.yml
vars:
firewall_pkg: firewalld
firewall_svc: firewalld
rule:
- http
- https
when: ansible_facts['distribution'] == "RedHat"
Run it first with RedHat, then have students change it to Fedora and see the tests fail.
- relates to
-
PTL-5159 RH294-231: 6.3 Including and Importing Files - Using FQCN
-
- Closed
-