cancel
Showing results for 
Search instead for 
Did you mean: 
Trevor
Starfighter Starfighter
Starfighter
  • 293 Views

Which Ansible module?

A little something for those of you who are currently
enrolled in the RH294 course, or even for those who
completed it within the past 2 semesters:

Question:  Which module is used to setup a yum
repository?

 

 

Trevor "Red Hat Evangelist" Chandler
Labels (3)
5 Replies
Ad_astra
Flight Engineer Flight Engineer
Flight Engineer
  • 246 Views

To setup a yum repository with ansible, I would use ansible.builtin.yum_repository. 

For example:

---

- name: Setup Yum repos

  hosts: all

  tasks:

    - name: Create the main repo

      ansible.builtin.yum_repository:

        name: main1

        file: main1

        description: This is the main repo

        baseurl: https://this-is-the-path.to/main/repo/

        gpgcheck: no

        enabled: yes

Trevor
Starfighter Starfighter
Starfighter
  • 237 Views

Hello Ad_astra,

I think you really liked this question.  You not only
provided the proper module, but you provided a
playbook, showing where the module would appear
in the playbook.

I'm glad you did provide a partial playbook, because
that could certainly benefit any community members
looking at your response.  

Now, there might be that one community member 
that says, "Okay, I understand the statement that
references to yum_reposority module.  However,
is that "gpgcheck: no" statement required - not a
benefit, but required?????"   How would you respond
to that person's query Ad_astra?

 

Trevor "Red Hat Evangelist" Chandler
Ad_astra
Flight Engineer Flight Engineer
Flight Engineer
  • 193 Views

Hi

The gpgcheck option tells yum or dnf if it is required to perform a GPG signature check on packages.

My reply would be that the gpgcheck option has no default value. If it is not specified, the gpgcheck value will use the settings in the /etc/yum.conf or use the system default of 'false'.

On my test system, the /etc/yum.conf file specifies that gpgcheck=1 which is true. However, as I am not specifying a gpgkey option in my task, I must ensure the value is false so my task does not fail. Setting the gpgcheck value in the task overrides the setting in the /etc/yum.conf file. 

Trevor
Starfighter Starfighter
Starfighter
  • 175 Views

Love your response to my query Ad_astra!

Looks like you might enjoy this Ansible stuff.
Well, if that's the case, standby, cause I've 
got a lot more on the way!

Thanks again Ad_astra!!!

Trevor "Red Hat Evangelist" Chandler
Ad_astra
Flight Engineer Flight Engineer
Flight Engineer
  • 174 Views

Hi

You are most welcome.

I enjoy the interesting questions. Always good to learn something new!

Thanks again

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