Skip to content

Instantly share code, notes, and snippets.

@CalvinHartwell
Last active April 15, 2020 12:21
Show Gist options
  • Save CalvinHartwell/47b2556c2f34d26bddda0378e8a2ef77 to your computer and use it in GitHub Desktop.
Save CalvinHartwell/47b2556c2f34d26bddda0378e8a2ef77 to your computer and use it in GitHub Desktop.
landscape-client-install.sh
#!/bin/bash
# install landscape-client package.
sudo apt-get update -y
sudo apt-get install landscape-client -y
# Generate a unique random name for the machine based on machine-id and date-time
# this logic can be modified as required.
COMPUTER_TITLE=$HOSTNAME
ACCOUNT_NAME="calvin-hartwell"
URL="https://landscape.canonical.com/message-system"
TAGS="notag"
# Run landscape config to populate the standard configs.
landscape-config --silent --ok-no-register
# Place Landscape client config file
sudo tee /etc/landscape/client.conf > /dev/null <<EOL
[client]
log_level = info
url = $URL
ping_url = http://landscape.canonical.com/ping
data_path = /var/lib/landscape/client
computer_title = $COMPUTER_TITLE
account_name = $ACCOUNT_NAME
include_manager_plugins = ScriptExecution
tags = $TAGS
EOL
# set correct ownership of config file
sudo chown landscape:landscape /etc/landscape/client.conf
# bigger example can be found here:
# https://github.com/CanonicalLtd/landscape-client/blob/master/example.conf
# restart the landscape service to use the config!
sudo systemctl restart landscape-client.service
# Machine will be in landscape dashboard
echo "Machine should now be registered to Landscape, go to $URL to approve".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment