• Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Run sth on server after imaging?

    Scheduled Pinned Locked Moved Unsolved
    FOG Problems
    2
    5
    501
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • F
      flodo
      last edited by flodo

      Hi there!
      I am completely new to fog, so forgive me any stupid questions please.
      I wonder if it is possible to run a tool on the server after transferring an image to a client? Like running Ansible?

      Any hints are highly appreciated

      Best regards,

      george1421G 1 Reply Last reply Reply Quote 0
      • george1421G
        george1421 Moderator @flodo
        last edited by

        @flodo First let me say this, FOG doesn’t typically step into the target system during a deployment. FOG’s function is to move disk blocks from storage location to storage location as fast as it can and then exit, leaving the target computer to do its configuration and setup thing during first boot. This holds true for MS Windows based computers as well as linux based systems.

        With that said, FOG calls bash scripts before image deployment / capture. One script is called just after the FOS Linux kernel boots. We would use that to setup or preconfigure any hardware needed for image capture/deploy. The second script is called on a deployment just after the image has been transferred to the target computer and before the target computer reboots. I’ve used these post deployment scripts to set linux host names, or to update specific configuration files based on user definable fields in the fog web ui. Once the post deployment scripts finish and the target computer reboots then FOG is out of the picture (* the exception is if you use the FOG Client there are some post reboot actions that can be managed from the fog server).

        So the deployment tool FOG uses is based on a customized version of linux. Ansible runs on linux so that is a good start. I don’t know what dependencies are needed in FOS linux to support Ansible. But if we knew that its possible to recreate fos linux with the required bits.

        So after all of that, I can say its possible, but it breaks the standard FOG workflow of move the bits quickly and get out.

        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

        F 1 Reply Last reply Reply Quote 0
        • F
          flodo
          last edited by

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • F
            flodo @george1421
            last edited by flodo

            @george1421 Hey George 👋 thanks for your reply! sounds promising! What I do right now is

            • Transferring clonezilla via pxe
            • Make clonezilla load and etch the image from an NFS server to the new system
            • After transfering the image, the system reboots

            All that is already automated but a bit fragile and hacky.

            I then manually start Ansible to set the hostname, transferring a wallpaper, copying vpn credentials. All the stuff that differs from system to system. Ansible is doing all it’s stuff via ssh, so the only real requirement on the systems is an openssh-server.

            My main problem is

            • that I have to manually run Ansible
            • that I can only setup one system at a time (since all have the same hostname after image transfer, like newsystem.local (and I also do not have their ips)

            I would look for a way to automatically detect a new system in the network, “provisioning” it with an image (since that is faster than using foreman e.g.), and then automatically adjusting a couple of files and settings as needed. Clicking some buttons and writing something is fine, as long as everything else is then running without an operator and as long as I can setup more than one system at once

            Ansible is not absolutely needed, it’s just how I did it so far

            Another possibility would be to e.g. transfer different data inside the image, or completely different “data” partitions, depending on the host. Is that possible maybe? Like keeping the rootfs img the same on all systems but transfering different images for another partition.

            george1421G 1 Reply Last reply Reply Quote 0
            • george1421G
              george1421 Moderator @flodo
              last edited by george1421

              @flodo First let me say I don’t know Ansible, I know of it but that is about it. So I always force my way through things.

              But with imaging there are two approaches to take.

              1. Leave bread crumbs (deploy time configuration info) behind for the target OS to pick up with its internal setup program to consume. In the MS Windows realm that might be mounting the C drive and updating the unattend.xml file with deployment time settings like computer name, calculated target OU, timezone, etc.

              2. Using a FOG postinstall script to mount the root partition on the target computer and use a bash script to make system changes like set the hostname in /etc/hostname and other parameters that the target system will need at first boot. If you can script it with bash you can probably update it in the target linux OS. When you are done, you would unmount the mounted partition and then let FOG finish with the deployment and reboot the target computer. I have an example of how to do this for windows, it can easily be translated to linux.

              If you wanted to go the ansible route, then you need to identify what you need on the FOS Linux OS and then we/you will need to include that plus the ansible code when FOS Linux is compiled. It is not as hard as it sounds. You need to find the dependencies needed for ansible and then update the buildroot configuration to included the dependencies. FWIW: the FOS engine does have ssh server installed, but with only one user root. So to login remotely to the FOS Linux engine you need to give root a password then you can connect remotely to FOS Linux over ssh.

              Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post

              222

              Online

              12.0k

              Users

              17.3k

              Topics

              155.2k

              Posts
              Copyright © 2012-2024 FOG Project