Change primary IP after restoring image

Hi

I have created an image of one of my existing virtualmin server. when I try to create a new server using my image, I have to change primary IP address of the server before it can start responding to website browse request. This is obvious and understood. However is there a way to perform this IP change operation using command line so I can automate creation of new VPS machines using automated bash scripts? Right now I have to manually change this IP address before it can be used.

After creating new instance using image, once I login, the landing page has this message on top -

YOUR SYSTEM’S PRIMARY IP ADDRESS APPEARS TO HAVE CHANGED FROM XXX.XXX.XXX.XX TO XX.XXX.XXX.XX. VIRTUAL SERVERS USING THE OLD ADDRESS MAY BE UNREACHABLE OR SERVE THE WRONG WEB CONTENT.

When I click on Update Incorrect IP Addresses, it goes “Address and Networking” >> “Change IP Addresses” page and defaults my old and new IP address, I just have to click on Change Now.

I would like to know if I can use a command to achieve the same thing.

Thanks