Repo files deployed are deleted randomly

Problem:
The .repo files deployed by foreman on the hosts seems t be deleted randomly on many host. As a result I need to redeploy them again and again on many servers. Dont know what causes this . any idea or options that does this in foreman settings?

Expected outcome:
.repo files not to be deleted once deployed

Foreman and Proxy versions:
katello-3.11.1-1.el7.noarch
foreman-cli-1.21.3-1.el7.noarch

Foreman and Proxy plugin versions:
foreman-proxy-1.21.3-1.el7.noarch

Other relevant data:
[e.g. logs from Foreman and/or the Proxy, modified templates, commands issued, etc]
(for logs, surround with three back-ticks to get proper formatting, e.g.)

logs

also i see the repo file is diabled by redhat.repo.dis.1545150080

Certificate-Based Repositories

Managed by (rhsm) subscription-manager

*** This file is auto-generated. Changes made here will be over-written. ***

*** Use “subscription-manager repo-override --help” if you wish to make changes. ***

If this file is empty and this system is subscribed consider

a “yum repolist” to refresh available repos

@abraham1986: Thanks for sharing this.
Few questions: Is the redhat.repo file getting deleted on the hosts? Afaik the redhat.repo file is managed by subscription manager so that output is expected. Does the host stay registered after you see the redhat.repo file deleted? I don’t understand this line:

.repo files not to be deleted once deployed

Hello
yes, the redhat.repo file is being deleted on the hosts. So each time, I need to redeploy them again but buy doing the following steps.
subscription-manager clean
rpm -Uvh http://10.231.12.88/pub/katello-ca-consumer-latest.noarch.rpm
subscription-manager register --org=“BigDataCC” --activationkey=""
Or
subscription-manager register --org=“BigDataCC” --force --activationkey=" "

For you comment “redhat.repo file is managed by subscription manager so that output is expected”
Do you mean the redhat.repo file is supposed to be deleted or renamed as redhat.repo.dis.**** ?

Does the host stay registered after you see the redhat.repo file deleted?

Yes, i dont know on what time interval it changes renamed or deleted. The server will be listed in Host lists in foreman webui, but actually the redhat.repo file will be missing and when I run the "subscription-manager repos --list " it will say, not attached to any repos.

For my comment “.repo files not to be deleted once deployed”

I expect this file to be present on the server as long as the server is registered with a Activation Key.

NOTE: We have only installed Katello Agents on te servers and no puppet agents are installed as we use chef in our platform.

@abraham1986 : So I asked around the team on this, and there seems to be no plausible explanation to why katello or sub-man would rename the repo file on the host.

We have only installed Katello Agents on te servers and no puppet agents are installed as we use chef in our platform.

Could you check the Chef code to see if there’s anything that might be doing this?

i have checked this already and there is nothing done from chef side.

As i was going through the /etc/rhsm/rhsm.conf i see the value full_refresh_on_yum.
Do you think this can be disabled and can make a difference?

subscription-manager config --rhsm.full_refresh_on_yum=0