Auto assign snapin?



  • Is it possible to have a snapin automagically assigned to a host?



  • Thanks for that!!! I’ll try it out!



  • Not from FOG that I’ve found.
    You can write a little shell script to update the mysql database automatically if you’d like. Here’s an extremely lame script off the top of my head that would associate every snapin with every host in the FOG database:
    [CODE]#!/bin/bash

    Store all host IDs

    HOST_IDs=$(/usr/bin/mysql -u root -Dfog --batch --skip-column-names
    -e “SELECT hostID FROM hosts;”)

    Store all Snapin IDs

    SNAPIN_IDs=$(/usr/bin/mysql -u root -Dfog --batch --skip-column-names
    -e “SELECT sID FROM snapins;”)

    Clear out any existing associations

    /usr/bin/mysql -u root -Dfog --batch --skip-column-names
    -e “TRUNCATE TABLE snapinAssoc;”

    Add every snapin to every host

    for HOST in $HOST_IDs
    do
    for SNAPIN in $SNAPIN_IDs
    do
    /usr/bin/mysql -u root -Dfog --batch --skip-column-names
    -e "INSERT INTO snapinAssoc (saHostID, saSnapinID) VALUES($HOST, $SNAPIN);"
    done
    done[/CODE]


 

354
Online

41.8k
Users

12.3k
Topics

116.0k
Posts