Skip to content

Instantly share code, notes, and snippets.

@CalvinHartwell
Last active April 15, 2020 12:21
Show Gist options
  • Select an option

  • Save CalvinHartwell/47b2556c2f34d26bddda0378e8a2ef77 to your computer and use it in GitHub Desktop.

Select an option

Save CalvinHartwell/47b2556c2f34d26bddda0378e8a2ef77 to your computer and use it in GitHub Desktop.

Revisions

  1. CalvinHartwell revised this gist Mar 10, 2020. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions landscape-client-install.sh
    Original file line number Diff line number Diff line change
    @@ -11,6 +11,9 @@ 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]
  2. CalvinHartwell revised this gist Mar 10, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion landscape-client-install.sh
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ sudo apt-get install landscape-client -y
    COMPUTER_TITLE=$HOSTNAME
    ACCOUNT_NAME="calvin-hartwell"
    URL="https://landscape.canonical.com/message-system"
    TAGS="NewMachine"
    TAGS="notag"

    # Place Landscape client config file
    sudo tee /etc/landscape/client.conf > /dev/null <<EOL
  3. CalvinHartwell revised this gist Mar 10, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion landscape-client-install.sh
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@ 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=$(sudo cat /etc/machine-id)-$(date +%F)
    COMPUTER_TITLE=$HOSTNAME
    ACCOUNT_NAME="calvin-hartwell"
    URL="https://landscape.canonical.com/message-system"
    TAGS="NewMachine"
  4. CalvinHartwell revised this gist Mar 10, 2020. No changes.
  5. CalvinHartwell revised this gist Mar 10, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion landscape-client-install.sh
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ 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=$(sudo cat /etc/machine-id)-$(date +%F)
    ACCOUNT_NAME="CalvinHartwell"
    ACCOUNT_NAME="calvin-hartwell"
    URL="https://landscape.canonical.com/message-system"
    TAGS="NewMachine"

  6. CalvinHartwell revised this gist Mar 10, 2020. 1 changed file with 10 additions and 7 deletions.
    17 changes: 10 additions & 7 deletions landscape-client-install.sh
    Original file line number Diff line number Diff line change
    @@ -1,18 +1,18 @@
    #!/bin/bash

    # install landscape-client package.
    sudo apt-get update
    sudo apt-get install landscape-client
    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=(sudo cat /etc/machine-id) + "-" + (date =%F)
    ACCOUNT_NAME="<Your-Account-Name>"
    COMPUTER_TITLE=$(sudo cat /etc/machine-id)-$(date +%F)
    ACCOUNT_NAME="CalvinHartwell"
    URL="https://landscape.canonical.com/message-system"
    TAGS="NewMachine"

    # Place Landscape client config file
    sudo cat <<EOF > /etc/landscape/client.conf
    sudo tee /etc/landscape/client.conf > /dev/null <<EOL
    [client]
    log_level = info
    url = $URL
    @@ -22,12 +22,15 @@ computer_title = $COMPUTER_TITLE
    account_name = $ACCOUNT_NAME
    include_manager_plugins = ScriptExecution
    tags = $TAGS
    EOF
    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
    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".
  7. CalvinHartwell revised this gist Mar 10, 2020. 1 changed file with 32 additions and 0 deletions.
    32 changes: 32 additions & 0 deletions landscape-client-install.sh
    Original file line number Diff line number Diff line change
    @@ -1 +1,33 @@
    #!/bin/bash

    # install landscape-client package.
    sudo apt-get update
    sudo apt-get install landscape-client

    # Generate a unique random name for the machine based on machine-id and date-time
    # this logic can be modified as required.
    COMPUTER_TITLE=(sudo cat /etc/machine-id) + "-" + (date =%F)
    ACCOUNT_NAME="<Your-Account-Name>"
    URL="https://landscape.canonical.com/message-system"
    TAGS="NewMachine"

    # Place Landscape client config file
    sudo cat <<EOF > /etc/landscape/client.conf
    [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
    EOF

    # 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
  8. CalvinHartwell created this gist Mar 10, 2020.
    1 change: 1 addition & 0 deletions landscape-client-install.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    #!/bin/bash