How to install RANCID on Fedora CoreOS

RANCID is an open-source tool that allows backup and management of configurations from network devices. In this tutorial, we will guide you on how to install RANCID on Fedora CoreOS.

Prerequisites

  • A running instance of Fedora CoreOS latest.
  • sudo or root access to the instance.

Installation

  1. Open a terminal window on your Fedora CoreOS instance.

  2. Install the required packages:

    sudo dnf install git rancid
    
  3. Create a directory for RANCID to store its configuration files:

    sudo mkdir /etc/rancid
    
  4. Copy the rancid.conf.sample file to /etc/rancid/rancid.conf:

    sudo cp /usr/share/doc/rancid/rancid.conf.sample /etc/rancid/rancid.conf
    
  5. Create a directory where RANCID will save the device configurations:

    sudo mkdir /var/lib/rancid
    
  6. Update the rancid.conf file to specify the location of the directory created in Step 5:

    sudo vi /etc/rancid/rancid.conf
    
    # Edit the following line:
    # RCSSYS=/usr/local/libexec/rancid
    # To:
    RCSSYS=/usr/libexec/rancid
    
    # Edit the following line:
    # LIST_OF_GROUPS="mygroup"
    # To:
    LIST_OF_GROUPS="mygroup"
    
    # Edit the following line:
    # LIST_OF_USERS = "" ; # Default user definitions
    # To:
    LIST_OF_USERS = "username" ; # Default user definitions
    
    # Edit the following line:
    # RANCID_BRANCH.master.regex = _{}
    # To:
    RANCID_BRANCH.master.regex = _.*{}
    
    # Add the following lines at the end of the file:
    cloginrc=/etc/rancid/.cloginrc
    logdir=/var/lib/rancid/logs
    
  7. Create a cloginrc file in the /etc/rancid directory to specify the login credentials for each device:

    sudo vi /etc/rancid/.cloginrc
    
    # Add the following lines for each device you want to backup:
    add user {DEVICE-IP-ADDRESS} {USERNAME}
    add password {DEVICE-IP-ADDRESS} {DEVICE-PASSWORD}
    add method {DEVICE-IP-ADDRESS} ssh
    
    # Replace {DEVICE-IP-ADDRESS}, {USERNAME} and {DEVICE-PASSWORD} with your device's IP address, username and password respectively.
    
  8. Modify the SELinux context of the log directory:

    sudo semanage fcontext -a -t usr_t "/var/lib/rancid/logs(/.*)?"
    sudo restorecon -R /var/lib/rancid/logs/
    
  9. Start the RANCID services:

    sudo systemctl start rancid-cvsweb
    sudo systemctl start rancid-cvs
    
  10. Enable RANCID to start on boot:

    sudo systemctl enable rancid-cvsweb
    sudo systemctl enable rancid-cvs
    

Conclusion

You have successfully installed RANCID on your Fedora CoreOS instance. You can now use it to backup and manage configurations from network devices.