Hello,
I'm about to take the EX374V22K exam in a few days.
I took the DO374 online course.
If I had been able to ask a few questions to the instructor in a real class environment, most of them would have been related to the help I would find inline during the exam.
- regarding the filters : how do I find help in case, for instance, I forget which are the possible parameters of 'passwd_hash' filter. I noticed the "ansible-doc" or "ansible-navigator doc" don't manage the filters section ;
- what if I don't remember exactly the syntax of a "requirements.yml" file for a collection dependency ;
- is there a skeleton I can get for the "execution-environment.yml" configuration file ?
Lastly, looking at the blueprint of the exam, I noticed the following objective and I wondered what kind of task(s) would be asked to perform in order to validate it :
"Create a dynamic inventory from an identity management server or a database server".
Many thanks in advance for your help.
Kind regards,
Berthevin
Filters section. First, get all available types:
$ ansible-doc -t -l
usage: ansible-doc [-h] [--version] [-v] [-M MODULE_PATH] [--playbook-dir BASEDIR]
[-t {become,cache,callback,cliconf,connection,httpapi,inventory,lookup,netconf,shell,vars,module,strategy,test,filter,role,keyword}] [-j]
See if the filter you need is there:
$ ansible-doc -t filter -l | grep passw
ansible.builtin.password_hash convert input password into password_h...
Filter documentation:
$ ansible-doc -t filter ansible.builtin.password_hash
---
Another method for the core filters is viewing the Python files:
$ find /usr -name filter | grep ansible
Directory: /usr/lib/python3.9/site-packages/ansible/plugins/filter
File you want: password_hash.yml
---
BTW, this list of filters you can use in playbooks is not complete, the non-core ones come with jinja2 package:
$ find /usr | grep jinja | grep filter
The one you need:
/usr/lib/python3.9/site-packages/jinja2/filters.py
This Python file has comments inside, so one can find required filter without checking Ansible on-line docs or PDFs.
For the requirements, this is how to find examples:
$ find /usr/share/ansible -name requirements.yml
/usr/share/ansible/collections/ansible_collections/redhat/rhel_system_roles/tests/sshd/requirements.yml
/usr/share/ansible/collections/ansible_collections/ibm/power_aix/collections/requirements.yml
/usr/share/ansible/collections/ansible_collections/ansible/posix/tests/requirements.yml
/usr/share/ansible/roles/rhel-system-roles.sshd/tests/requirements.yml
At least one of these collections needs to be installed, of course. There is one which must be available in the repository: rhel-system-roles
So if "find" command finds nothing, it won't hurt to do "sudo dnf install rhel-system-roles" on the controller host.
Filters section. First, get all available types:
$ ansible-doc -t -l
usage: ansible-doc [-h] [--version] [-v] [-M MODULE_PATH] [--playbook-dir BASEDIR]
[-t {become,cache,callback,cliconf,connection,httpapi,inventory,lookup,netconf,shell,vars,module,strategy,test,filter,role,keyword}] [-j]
See if the filter you need is there:
$ ansible-doc -t filter -l | grep passw
ansible.builtin.password_hash convert input password into password_h...
Filter documentation:
$ ansible-doc -t filter ansible.builtin.password_hash
---
Another method for the core filters is viewing the Python files:
$ find /usr -name filter | grep ansible
Directory: /usr/lib/python3.9/site-packages/ansible/plugins/filter
File you want: password_hash.yml
---
BTW, this list of filters you can use in playbooks is not complete, the non-core ones come with jinja2 package:
$ find /usr | grep jinja | grep filter
The one you need:
/usr/lib/python3.9/site-packages/jinja2/filters.py
This Python file has comments inside, so one can find required filter without checking Ansible on-line docs or PDFs.
execution-environment.yml skeleton
$ rpm -ql ansible-navigator | grep template
/usr/lib/python3.9/site-packages/ansible_navigator/data/settings-sample.template.yml
Regarding the dynamic inventories - in the labs, they provide scripts. So it's probably about using a pre-coded script.
Hello ipalagin,
Many thanks for your answers. It helped me (I passed the exam today).
Kind regards,
Berthevin
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.