Snapin to Host assign



  • Hello,

    It would be good to have possibility to assign Basic Task from Snapin to Host or group.
    For now we can assign Snapin only from Host view or Group view.


  • Testers

    I copy pasted the function into my console and tested it with a snapin that was assigned to just my computer and it did in fact queue it to deploy.

    This could be altered to quickly deploy to a given list of hosts or groups as well. Giving you a quick command line method for deploying snapins to hosts in a variety of ways.

    If this is something that would achieve what you’re going for let me know and maybe I can add in the functions to the api module so they just exist and then you have a deployment tool via command line, which is typically quicker in my humble opinion


  • Testers

    @mousepl Are you thinking you would want to be able to do this on the fly, or would you want to deploy the snapin on all hosts that have it assigned to it?
    By on the fly I mean, select specific hosts from the snapin then deploy, that would be a bit more difficult to implement, but maybe adding a button for deploying on all hosts with a snapin is possible.

    If you’re familar with powershell or willing to learn. You could create a function/script that does this with the api module.

    i.e.

    # install the module
    Install-Module FogApi;
    # Follow the setup instructions found in the links in my signature. i.e. get the fogapi token and user api token from your web gui
    Set-FogServerSettings -fogServer 'serverName' -fogapitoken 'insertServerAPItokenHere' -fogusertoken 'insertFogUserAPItokenHere'
    

    Assuming those steps are done for the user running the function

    function Start-SnapinDeploy {
    [CmdletBinding()]
    param(
        #define the snapin name you want to deploy
        $snapinName
    )
    #get all the snapins from the server
    $allSnapins = Get-FogSnapins;
    #get all the host/snapin associations from the server
    $snapAssocs = Get-FogObject -type object -coreObject snapinassociation;
    #get the snapin you want to deploye in a single object
    $snapinToDeploy = $allSnapins | Where-Object name -match $snapinName;
    #find all the hosts that have that snapin associated
    $hostsWithSnapin = $snapAssocs.snapinassociations | Where-Object snapinID -match "$($snapinToDeploy.ID)"
    #loop through the hosts that have that snapin assigned and start a task for that snapin for each of them
    $hostsWithSnapin.hostID | ForEach-Object {
        $hostID = $_;
        $json = (@{
            "taskTypeID" = 13
            "deploySnapins"=$snapinToDeploy.ID
        } | ConvertTo-Json);
        New-FogObject -type objecttasktype -coreTaskObject host -jsonData $json -IDofObject $hostID;
        }
    }
    # call the function to deploy a snapin named office365
    Start-SnapinDeploy -snapinName 'office365'
    

    I may be off on the json creation as I haven’t tested a single snapin deploy, so the required body data might be different. I just kinda altered the way I use the start-fogsnapins function https://github.com/FOGProject/fog-community-scripts/blob/master/PowershellModules/FogApi/FogApi/Public/Start-FogSnapins.ps1 for this example. I typically only use fog snapins for the initial deployment at imaging.

    But as you can see from the example, while things are linked together, the linkage is really meant to go from host to snapin. Snapins are really meant to be deployed at imaging time, which is why they are all queued when you a image a host. The idea being to include software provisioning with your OS images. The feature request you described would be useful I agree, but one might argue that that makes more sense for a software deployment tool, where fog is an imaging tool.

    It can be used as a software deployment tool, but that’s just not how it’s designed.

    That’s all really just a disclaimer to say it may be a bit for this to show up as a new feature. It’s possible and it would be useful. I’m all for anything linked in a database having linked buttons in each spot in a gui. But creating that button may just be easier said than done, but may eventually be done.

    You could in theory create a gui using the powershell module and built in powershell command show-command and some dynamic paramters that grab all the available snapins, it would take a bit of work but you could make a gui prompt with drop downs/multi-selector for fog host(s), snapins, then a deploy button. Point being, just because it isn’t in the web gui, doesn’t mean the capability doesn’t already exist.

    I hope that helps



  • Maybe i was not clear. Point is to “run” snapin from Snapin page. simply select Snapin and deploy it on particulat Hosts/groups.
    It makes sense, it is working like this in Zenworks for example. If you can run (not assign because assigning is doing nothing) Snapin from host level why not to do it from Snapin level?

    Here is example:
    to execute snapin on 12 hosts i need to go Host by Host and run Snapin which takes time OR i can create group, ad d12 Hosts to it and run Snapin, go to Groups GUI, run Snapin and after that remove group (because i want to run it once so group is no longer needed).

    It would be easier to go to Snapin, select particular Hosts (or groups) and run it from this level.


  • Senior Developer

    Snapins can be assigned to a host from the snapin page. Tasks are handled at the host level as you task hosts. Tasking a snapin makes no sense. How do you select which hosts to send that snapin too? That would add too much complexity. Does that make sense?


Log in to reply
 

304
Online

7.1k
Users

14.3k
Topics

135.1k
Posts