Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- ADMIN_LOGIN="admin"
- ADMIN_PASSW="changeme"
- FOREMAN_URL="http://centos7-katello-devel-stable.example.com"
- ORGANIZATION="Default_Organization"
- ACTIVATION_KEY="key1"
- #
- # Host Registration to Satellite
- #
- curl --insecure --output katello-ca-consumer-latest.noarch.rpm $FOREMAN_URL/pub/katello-ca-consumer-latest.noarch.rpm
- yum localinstall katello-ca-consumer-latest.noarch.rpm -y
- subscription-manager register --org=$ORGANIZATION --activationkey=$ACTIVATION_KEY
- #
- # Host configuration from Satellite
- #
- yum install jq -y
- subscription-manager identity
- SUB_UUID=$(subscription-manager identity | grep "^system identity" | awk '{print $3}')
- # Get Host Foreman ID
- HOST_ID=$(curl -X GET -s --user $ADMIN_LOGIN:$ADMIN_PASSW \
- -H "Content-type: application/json" \
- -H "Accept: application/json" \
- -d "{\"search\":\"subscription_uuid = $SUB_UUID\"}" \
- "$FOREMAN_URL/api/hosts" | jq ".results[0].id")
- # Get registration template and run it
- curl -X GET -s --user $ADMIN_LOGIN:$ADMIN_PASSW \
- -H "Content-type: application/json" \
- -H "Accept: application/json" \
- "$FOREMAN_URL/api/hosts/$HOST_ID/template/registration" | jq -j ".template" | bash
Add Comment
Please, Sign In to add comment