10.4. Installing ASGARD Agent on a Golden Image

If you want to include the ASGARD Agent in your Golden Image, follow the steps in this section. Make sure to download the correct Agent Installer package from your ASGARD system.

You have two options for deploying an agent on your Golden Image. The first option is the easier method.

10.4.1. Offline Installation

Note

Before continuing, make sure the host cannot reach your ASGARD system.

In this method, make sure that the host system being prepared for the Golden Image is either offline or cannot reach ASGARD. Install the ASGARD Agent as usual. Once the installation is complete, stop the asgard2-agent service.

Windows (administrative command prompt):

C:\Windows\system32>sc stop asgard2-agent

Linux:

user@golden:~$ sudo systemctl stop asgard2-agent.service

Your ASGARD Agent should be ready now. Make sure that the agent does not communicate with ASGARD during the process. If the agent communicates with ASGARD and creates an Asset Request, stop the asgard2-agent service again and inspect the following file:

  • Windows: C:\Windows\System32\asgard2-agent\asgard2-agent.yaml

  • Linux: /var/lib/asgard2-agent/asgard2-agent.yaml

The file should not contain the marked lines in the next example. If both lines exist, delete them and save the file. Also deny the Asset Request in ASGARD to avoid confusion:

1host: yourasgard.domain.local:443
2token: +uW6HrF3kxmLNZYqKTKuZt [...]
3registered: true
4proxy: []
5system_proxy: false
6labels: []
7write_log: false

Warning

Your Golden Image will not work if the two lines in the asgard2-agent.yaml file exist. It will create a Duplicate Asset instead. Make sure that these lines are not present when you create the Golden Image.

10.4.2. Online Installation

If you cannot prevent the host being used for the Golden Image from communicating with ASGARD, follow these steps. Install the ASGARD Agent as usual. Once the installation is complete, stop the asgard2-agent service.

Windows (administrative command prompt):

C:\Windows\system32>sc stop asgard2-agent

Linux:

user@golden:~$ sudo systemctl stop asgard2-agent.service

Once the service is stopped, edit the agent configuration file. This is necessary because the agent has already communicated with ASGARD and generated a token, which should be unique. If you create the Golden Image now, the systems installed from that image will appear as Duplicate Asset (see Duplicate Assets Remediation).

Open the asgard2-agent.yaml file and delete the marked lines in this example.

  • Windows: C:\Windows\System32\asgard2-agent\asgard2-agent.yaml

  • Linux: /var/lib/asgard2-agent/asgard2-agent.yaml

1host: yourasgard.domain.local:443
2token: +uW6HrF3kxmLNZYqKTKuZt [...]
3registered: true
4proxy: []
5system_proxy: false
6labels: []
7write_log: false

After you delete the two lines and save the file, your host is ready. Make sure those two lines are not present and the asgard2-agent service is still not running. Delete the token because it is unique to ASGARD. If two agents present the same token, they will be flagged as duplicate assets. The registered value tells the agent whether it has to send a new asset request. Once it is set to true, it will not send a new request.

Hint

Deny the Asset Request that was created while installing the agent on the host in ASGARD. This avoids confusion later.