Problem
How to associate generated managed objects for IPAM and DNS to a different policy rather than the original one that was created by. Customers are not able to remove any policy that has existing managed objects in existence. Re-associating these managed objects with a new policy will allow for the later removal under that policy as well as the ability to delete (if so desired) the prior policy.
Cause
Customers who want to switch vendors/endpoints for IPAM and DNS. This is not currently supported by the OneFuse Platform.
Affected Versions
1.1
Workaround or Solution
It is advised that prior to do the following operation that you take a backup of your OneFuse database.
Overview
The following process details how a user can re-associate managed objects with IPAM or DNS policies.
Migrating IPAM managed objects to a new IPAM policy
python manage.py shell_plus
IpamReservation.objects.filter(policy=1).update(policy=2)
Where 1 is the id of the current IPAM policy
and 2 is the new IPAM policy
Migrating DNS managed objects to a new DNS policy
Download the attached
dns_migrate_script2.tgz
Using a FTP/SFT Client (e.g. WinSCP, FileZilla), copy the
dns_migrate_script2.tgz
to the OneFuse Appliance in a temporary directory (e.g./var/tmp
)SSH to the OneFuse Appliance as root and go into the directory the
dns_migrate_script2.tgz
was placed into (e.g./var/tmp
)ssh root@myonefuseappliance.company.domain cd /var/tmp
Unpack the tarball and extract the script folder
tar -zxvf dns_migrate_script.tgz
Go into the
scripts
directorycd scripts
Determine the two DNS Policies you want to migrate from and to and get their IDs
Edit the
migrate_dns_reservation.py
script to update the variable valuesvim migrate_dns_reservation.py
Update the following variable values accordingly:
from_policy_id
(line 5) has to be the ID number of the DNS Policyto_policy_id
(line 6) has to be the ID number of the DNS Policysplit_host_record
Keep this as default value. If migrating from an Infoblox provider to another provider, set the value toTrue
. The value can either beFalse
orTrue
Note: this does NOT change the provider of the policy, but rather migrates the existing managed object from the previous policy to the new policy
combine_a_and_ptr_to_host_record
Keep this as default value unless a Host record is not desired when migrating from a non-Infoblox provider to an Infoblox provider. The value can either beFalse
orTrue
Note: this does NOT change the provider of the policy, but rather migrates the existing managed object from the previous policy to the new policy
Example migrating from DNS Policy ID
2
migrating to DNS Policy ID5
:# This is a script must be placed in the scripts directory # python manage.py runscript migrate_dns_reservations # Enter the policy ID for the policy you want to migrate DnsReservation managed objects from from_policy_id = 2 # Enter the policy ID for the policy you want to migrate to, if set to None only change record types, don't move policy. to_policy_id = 5 # Split Host Records into A and PTR records # This is only at the managed object level, not the provider, this is to accommodate migration from a # provider that supports Host Records to a provider that does not. # Actual migration of the provider data is not handled by this utility. split_host_record = False # If there are both an A and a PTR record, create a host record # This is only at the managed object level, not the provider, this is to accommodate migration from a # provider that supports only a and ptr records to a provider that supports Host Records. # Actual migration of the provider data is not handled by this utility. combine_a_and_ptr_to_host_record = True
Save the file, press
ESC
key and type:wq!
then hitEnter
keyRun the script:
/opt/cloudbolt/manage.py shell_plus < migrate_dns_reservation.py
Additional information
If there are no DNS Reservations to migrate, you will see the following error:
NameError Traceback (most recent call last) <ipython-input-27-53fe0f0bd9cf> in <module> 2 new_records = [] 3 record_dict = {} ----> 4 for record in reservation.records: 5 print(record) 6 if record["name"] in record_dict: NameError: name 'reservation' is not defined In [28]: Do you really want to exit ([y]/n)?
0 Comments