Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # create answers.json
- cat > answers.json <<EOF
- [
- {
- "name": "server-primary",
- "rtype": "A",
- "rdata": "${PRIMARY}",
- "pool": "primary"
- },
- {
- "name": "server-secondary",
- "rtype": "A",
- "rdata": "${SECONDARY}",
- "pool": "secondary"
- }
- ]
- EOF
- # create rules.json
- cat > rules.json <<'EOF'
- [
- {
- "ruleType": "FILTER",
- "defaultAnswerData": [
- {
- "answerCondition": "answer.isDisabled != true",
- "shouldKeep": true
- }
- ]
- },
- { "ruleType": "HEALTH" },
- {
- "ruleType": "PRIORITY",
- "defaultAnswerData": [
- { "answerCondition": "answer.pool == 'primary'", "value": 1 },
- { "answerCondition": "answer.pool == 'secondary'", "value": 99 }
- ]
- },
- { "ruleType": "LIMIT", "defaultCount": 1 }
- ]
- EOF
- # create failover steering policy
- STEERING_POLICY_ID=$(
- oci dns steering-policy create \
- --compartment-id "$COMPARTMENT_ID" \
- --display-name "DNS-Failover-Policy" \
- --template FAILOVER \
- --ttl 30 \
- --health-check-monitor-id "$MONITOR_ID" \
- --answers file://answers.json \
- --rules file://rules.json \
- --query 'data.id' \
- --raw-output
- )
- echo "Steering Policy OCID: $STEERING_POLICY_ID"
Advertisement
Add Comment
Please, Sign In to add comment