Mailing List Archive

Help Using git with RANCID
Hi,

I have tried my darndest to git RANCID working with a remote git server based on the few web articles and forum threads, but am still missing something. Assistance would be appreciated.

rancid.conf
LIST_OF_GROUPS="all"
RCSSYS=git; export RCSSYS
CVSROOT=$BASEDIR/repos; export CVSROOT

I ran sudo -H -u rancid /mnt/rancid/rancid/bin/rancid-cvs and it seemed happy.

My "/mnt/rancid/rancid/var" directory is now:

all/
logs/
repos/

Under "all/" is now:

configs/
.git/
router.db
routers.all
routers.down
routers.up

Under "repos/" is:

all/

This article (https://www.cryptomonkeys.com/2016/11/rancid-git/) implies one needs to do a clone of a remote repo. If so, into what local directory? And must I first remote something rancid-cvs created?

The forum threads do not mention a clone. They imply creating a remote. But in which of the two git-repo-like directories created by rancid-cvs (var/all/.git or var/repos/all)?

I am expecting the end result to be a clone of a remote repo (for each group) somewhere under rancid/var, and for rancid-run to operate in that location and after making changes effectively does a "git push" back to my remote git server.

I just cannot seem to cobble together the correct series of commands from the multiple sources of information.

Regards,

Ryan Melville
Re: Help Using git with RANCID [ In reply to ]
Wed, Aug 15, 2018 at 08:17:28PM +0000, Ryan Melville:
> Hi,
>
> I have tried my darndest to git RANCID working with a remote git server based on the few web articles and forum threads, but am still missing something. Assistance would be appreciated.
>
> rancid.conf
> LIST_OF_GROUPS="all"
> RCSSYS=git; export RCSSYS
> CVSROOT=$BASEDIR/repos; export CVSROOT
>
> I ran sudo -H -u rancid /mnt/rancid/rancid/bin/rancid-cvs and it seemed happy.

perfect.
cd $BASEDIR/<group>
git remote add <somename> <giturlofexistingremote>
git remote set-url --add --push origin $CVSROOT/all
git remote set-url --add --push origin <giturlofexistingremote>

test (and initial push) it:
git push <somename>
This must not require interactive authentication, which i leave to your
own research.

_______________________________________________
Rancid-discuss mailing list
Rancid-discuss@shrubbery.net
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
Re: Help Using git with RANCID [ In reply to ]
Thank you! I will try this and report back.

Regards,

Ryan Melville
________________________________
From: heasley <heas@shrubbery.net>
Sent: Thursday, August 16, 2018 2:53 AM
To: Ryan Melville
Cc: rancid-discuss@shrubbery.net
Subject: Re: [rancid] Help Using git with RANCID

Wed, Aug 15, 2018 at 08:17:28PM +0000, Ryan Melville:
> Hi,
>
> I have tried my darndest to git RANCID working with a remote git server based on the few web articles and forum threads, but am still missing something. Assistance would be appreciated.
>
> rancid.conf
> LIST_OF_GROUPS="all"
> RCSSYS=git; export RCSSYS
> CVSROOT=$BASEDIR/repos; export CVSROOT
>
> I ran sudo -H -u rancid /mnt/rancid/rancid/bin/rancid-cvs and it seemed happy.

perfect.
cd $BASEDIR/<group>
git remote add <somename> <giturlofexistingremote>
git remote set-url --add --push origin $CVSROOT/all
git remote set-url --add --push origin <giturlofexistingremote>

test (and initial push) it:
git push <somename>
This must not require interactive authentication, which i leave to your
own research.
Re: Help Using git with RANCID [ In reply to ]
Thank you for the advice, which got me on the right track. I think those commands probably would have worked as-is, but my ideal state was having RANCID's local git workspace wire directly back to my git server *only* and not also push to the local ($CVSROOT) git repo.

So my steps were the following, picking up after the "sudo -H -u rancid /mnt/rancid/rancid/bin/rancid-cvs" command:

1) Create new empty 'rancid-<group>' repository on my (external) master git server (Atlassian Bitbucket, in my case).

2) Create 'rancid' user on my master git server, and give it read/write permission to the new repo.

3) Store 'rancid' user git credentials on my RANCID server, which requires a temporary clone that is then immediately deleted.

sudo -H -u rancid git config --global user.name "rancid"
sudo -H -u rancid git config --global user.email "rancid@<mydomain>"
sudo -H -u rancid git config --global credential.helper store
sudo -H -u rancid git clone https://rancid@<my-git-server>/scm/rancid-<group>.git<https://rancid@%3cmy-git-server%3e/scm/rancid-%3cgroup%3e.git>
(enter 'rancid' user passwords when prompted)
sudo -H -u rancid rm -rf rancid-all

4) Re-wire RANCID's git workspace to the master git server, instead of its local git server/repo. Uses my particular RANCID installation path and group name ("all").

cd /mnt/rancid/rancid/var/all
sudo -H -u rancid git remote set-url origin https://rancid@<my-git-server>/scm/rancid-all.git
sudo -H -u rancid git push -u origin --all
sudo -H -u rancid git push origin --tags


At this point, I made a change to a network device, waited for my next cron execution of rancid-run, and then observed the changes in my master git repo, so I believe it was all working well.

Regards,

Ryan Melville
Re: Help Using git with RANCID [ In reply to ]
From: Rancid-discuss <rancid-discuss-bounces@shrubbery.net> On Behalf Of
Ryan Melville
Sent: Wednesday, August 22, 2018 5:41 PM
To: heasley <heas@shrubbery.net>
Cc: rancid-discuss@shrubbery.net
Subject: Re: [rancid] Help Using git with RANCID



>Thank you for the advice, which got me on the right track. I think those
commands probably would have worked as-is, but my ideal state was having
RANCID's local git workspace wire directly back to my git server *only* and
not also push to the local ($CVSROOT) git repo.



>So my steps were the following, picking up after the "sudo -H -u rancid
/mnt/rancid/rancid/bin/rancid-cvs" command:



>1) Create new empty 'rancid-<group>' repository on my (external) master git
server (Atlassian Bitbucket, in my case).



>2) Create 'rancid' user on my master git server, and give it read/write
permission to the new repo.



>3) Store 'rancid' user git credentials on my RANCID server, which requires
a temporary clone that is then immediately deleted.



sudo -H -u rancid git config --global user.name "rancid"

sudo -H -u rancid git config --global user.email "rancid@<mydomain>"

sudo -H -u rancid git config --global credential.helper store

sudo -H -u rancid git clone https://rancid@
<https://rancid@%3cmy-git-server%3e/scm/rancid-%3cgroup%3e.git>
<my-git-server>/scm/rancid-<group>.git

(enter 'rancid' user passwords when prompted)

sudo -H -u rancid rm -rf rancid-all



>4) Re-wire RANCID's git workspace to the master git server, instead of its
local git server/repo. Uses my particular RANCID installation path and
group name ("all").



>cd /mnt/rancid/rancid/var/all

sudo -H -u rancid git remote set-url origin https://rancid@
<https://rancid@%3cmy-git-server%3e/scm/rancid-all.git>
<my-git-server>/scm/rancid-all.git

sudo -H -u rancid git push -u origin --all

sudo -H -u rancid git push origin --tags





>At this point, I made a change to a network device, waited for my next cron
execution of rancid-run, and then observed the changes in my master git
repo, so I believe it was all working well.



Was or is? Big difference!



>Regards,



>Ryan Melville
Re: Help Using git with RANCID [ In reply to ]
> Was or is? Big difference!

"is", from my perspective.

"was", from your perspective, due to email transit time. :)


Regards,



Ryan Melville
Re: Help Using git with RANCID [ In reply to ]
So not a native english speaker? Was means not working anymore, wonder how you can manage a network if the basics are scewed!



From: Ryan Melville <rmelville@otes.com>
Sent: Thursday, August 23, 2018 2:38 PM
To: Vacheslav <m_zouhairy@skno.by>; 'heasley' <heas@shrubbery.net>
Cc: rancid-discuss@shrubbery.net
Subject: Re: [rancid] Help Using git with RANCID



> Was or is? Big difference!

"is", from my perspective.

"was", from your perspective, due to email transit time. :)



Regards,



Ryan Melville