As stated above if you match the existing file with a yumrepo resource then 
yes it will effectively change just the file but puppet will now own that 
so it has to match or else it will create a new file.

So if the existing file looks like this...

[BaseOS]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=BaseOS&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

And you now want to just enable it then something like this may work...

yumrepo { 'BaseOS':
  desc => 'CentOS-$releasever - Base
  mirrorlist => 
'http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=BaseOS&infra=$infra'
  gpgcheck => 0
  enabled => 1
  gpgkey => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial'
}

And if you can't get it to work and you absolutely cannot have two similar 
files with one disabled and one enabled then look a something like fileline 
in the stdlib to edit a line in a file - but the yumrepo resource type is 
the way to go.

Tip: you need to get a test host so you can just start playing with this 
stuff and seeing how it works. Also please read the resource type docs as 
they are great : https://puppet.com/docs/puppet/5.5/types/yumrepo.html

On Sunday, March 29, 2020 at 3:04:50 AM UTC+1, Keyzer Suze wrote:
>
> Hi
>
> Okay sorry for the confusion.
>
> So brand new centos 8 install
>
> all the repo files are in the /etc/yum.repo.d directory
>
> I want to turn on the high availability repo 
>
> I would rather not replace the whole files - yes I can see its contents, 
> but I don't want to maintain the file in puppet I want to maintain the 
> state of the repo
>
> on a very basic level I want to change the enabled option in the file to 1 
> / true
>
>
>
>
>
>
>
> On Sat, Mar 28, 2020 at 3:30 AM warron.french <[email protected] 
> <javascript:>> wrote:
>
>> Keyser, do you mean what syntax to generate a repo file for the CentOS 
>> high availability packages?
>>
>> I am trying to understand your requirement clearly.
>> --------------------------
>> Warron French
>>
>>
>>
>> On Fri, Mar 27, 2020 at 1:10 AM Keyzer Suze <[email protected] 
>> <javascript:>> wrote:
>>
>>> Hi
>>>
>>> Looking at configure brand new installs
>>>
>>> basically i have Centos 8 template (VMWare) and I create new machines, 
>>> login assign name to it and run puppet agent.
>>>
>>> I wanted to use high availability packages and i need to turn on the 
>>> repo.
>>>
>>> Not sure the best way of doing it, I don't want to recreate the file, 
>>> just want to turn on enabled 
>>>
>>>
>>> thanks
>>>
>>>
>>>
>>> On Thu, Mar 26, 2020 at 11:30 PM warron.french <[email protected] 
>>> <javascript:>> wrote:
>>>
>>>> Did you get an answer Keyzer?
>>>>
>>>> Do you still have the file /etc/yum.repos.d/Centos-Base.repo, or do you 
>>>> need to recreate the entire repo from scratch?  How I respond depends on 
>>>> your answer.
>>>>
>>>> --------------------------
>>>> Warron French
>>>>
>>>>
>>>>
>>>> On Tue, Mar 24, 2020 at 7:51 PM Keyzer Suze <[email protected] 
>>>> <javascript:>> wrote:
>>>>
>>>>> Hi
>>>>>
>>>>> I want to turn on the high availability repo.
>>>>>
>>>>> How to I do that, with re creating the repo file ?
>>>>>
>>>>> A
>>>>>
>>>>> -- 
>>>>> You received this message because you are subscribed to the Google 
>>>>> Groups "Puppet Users" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>>> an email to [email protected] <javascript:>.
>>>>> To view this discussion on the web visit 
>>>>> https://groups.google.com/d/msgid/puppet-users/59832e87-1dda-45fc-a226-2e6a2f75d667%40googlegroups.com
>>>>>  
>>>>> <https://groups.google.com/d/msgid/puppet-users/59832e87-1dda-45fc-a226-2e6a2f75d667%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "Puppet Users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to [email protected] <javascript:>.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/puppet-users/CAJdJdQn%3DsK007M49Zox%3DqVuK%2B9kbxy%2Brkf28e-4ehZHnW0tWmQ%40mail.gmail.com
>>>>  
>>>> <https://groups.google.com/d/msgid/puppet-users/CAJdJdQn%3DsK007M49Zox%3DqVuK%2B9kbxy%2Brkf28e-4ehZHnW0tWmQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Puppet Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected] <javascript:>.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/puppet-users/CANmbM4HfKK8NQ1rS4Mi8tD6Ay8Zg4_ywqXFVKP0sH%3DgWy3DTAw%40mail.gmail.com
>>>  
>>> <https://groups.google.com/d/msgid/puppet-users/CANmbM4HfKK8NQ1rS4Mi8tD6Ay8Zg4_ywqXFVKP0sH%3DgWy3DTAw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Puppet Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/puppet-users/CAJdJdQkrBzAVg4GkwELZA_GjsSztewAsC9djh-hXGwh8Vd1hBg%40mail.gmail.com
>>  
>> <https://groups.google.com/d/msgid/puppet-users/CAJdJdQkrBzAVg4GkwELZA_GjsSztewAsC9djh-hXGwh8Vd1hBg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/88fc904d-9088-462c-acd8-ce6fb18ee25c%40googlegroups.com.

Reply via email to