cancel
Showing results for 
Search instead for 
Did you mean: 
JS_Learning
Moderator
Moderator
  • 17.3K Views

RH294: ansible-galaxy requirements.yml files

Jump to solution

 

Hello,

I am following the course RH294, using the document "RH294-RHEL8.0-en-1-20190531".

On page 328 it starts to mention about requirements.yml files, used for installing a particular role.

I am trying to understand how we are supposed to know about the values inside that file:

Exemple:

# from any Git-based repository, using SSH
- src: git@gitlab.com:guardianproject-ops/ansible-nginx-acme.git
scm: git
version: master
name: nginx-acme-ssh

 

1) Where do we know that we have to write "src, scm, version, name"...?

2) For git, it looks we need to provide the above values. Let's say someone use something else or ask to use something else, how can we find what is required?

I am trying to understand the "how to" rather than to make it work (I managed to make it work by simply copy/paste as in the example).

Thanks,

 

Labels (3)
13 Replies
JS_Learning
Moderator
Moderator
  • 2,711 Views

Hi,

Good ideas, the output of the command in verbose vvv works good.

All I need is to actually write a requirement file with the "- src: xxx" (I start from zero and build up) , then run it, and see the same output you copied.

This way, I can see the important keys:

found role {'scm': None, 'src': 'foo', 'version': '', 'name': 'foo'} in yaml file

 That way, we can build a proper requirement file using that reference.

 

Also, it's good idea to check the python code sometimes, I usually prefer something closer to "operational levels" rather than reading numerous lines of code. But it can also be an usable hint.

 

Many thanks, I think the topic is covered :)

 

smeeuwsen
Cadet
Cadet
  • 2,674 Views

The exam objective listed above:

Use provided documentation to look up specific information about Ansible modules and commands

Is for EX407, note that it is not listed as an objective for EX294. You can of course use ansible-doc to find specific info about modules but access to doc.ansible.com is not available during the exam. Seems only fair to let people know I would presume, so they can prepare properly?

mmmk
Cadet
Cadet
  • 1,742 Views
  • 1,579 Views

Simplly

1. Create Requirement.yml

2. Add following in the yml

     - src: < Source url>

        name: <name for role>

3. save the file

4. ansible-galaxy role install -r <requirement filepath.yml> -p <role directory>

5. - p is optional, galaxy will use the path defined in Ansible.cfg if not mentioned

 

Join the discussion
You must log in to join this conversation.