#!/bin/sh # # # Manage Secondary Private IP in Oracle Cloud Infrastructure with Pacemaker # # # Copyright 2016-2018 Lorenzo Garuti # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # # # Prerequisites: # # - OCI CLI installed (https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/climanualinst.htm) # - jq installed # - dynamic group with a policy attacched # - the policy must have this statement: # allow dynamic-group to use virtual-network-family in compartment id # - a reserved secondary private IP address for Compute Instances high availability # ####################################################################### # Initialization: : ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat} . ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs ####################################################################### # # Defaults # OCF_RESKEY_ocicli_default="/usr/local/bin/oci" OCF_RESKEY_api_delay_default="3" OCF_RESKEY_cidr_netmask_default="24" OCF_RESKEY_interface_alias_default="0" export OCI_CLI_AUTH=instance_principal : ${OCF_RESKEY_ocicli=${OCF_RESKEY_ocicli_default}} : ${OCF_RESKEY_api_delay=${OCF_RESKEY_api_delay_default}} : ${OCF_RESKEY_cidr_netmask=${OCF_RESKEY_cidr_netmask_default}} : ${OCF_RESKEY_interface_alias=${OCF_RESKEY_interface_alias_default}} meta_data() { cat < 1.0 Resource Agent for OCI Compute instance Secondary Private IP Addresses. It manages OCI Secondary Private IP Addresses for Compute instances with oci cli. See https://docs.oracle.com/en-us/iaas/Content/API/Concepts/cliconcepts.htm for more information about oci cli. Prerequisites: - OCI CLI installed (https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/climanualinst.htm) - jq installed - dynamic group with a policy attacched - the policy must have this statement: allow dynamic-group GROUP_NAME to use virtual-network-family in compartment id COMPARTMENT_ID - a reserved secondary private IP address for Compute Instances high availability OCI Secondary Private IP Address for Compute instances Resource Agent OCI Command line interface (CLI) tools OCI cli tools reserved secondary private ip for compute instance reserved secondary private ip for compute instance netmask for the secondary_private_ip netmask for the secondary_private_ip numeric alias for the interface numeric alias for the interface a short delay between API calls, to avoid sending API too quick a short delay between API calls END } ####################################################################### ocivip_usage() { cat <