cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2033
Views
10
Helpful
7
Replies

ACI bulk object deletion

Qwr!
Level 1
Level 1

Having several objects with "TEMP_" for example, tenant TEMP_tenant_A, vrf TEMP_vrf_A, TEMP_LIP_A etc. 

was looking for a quick way to delete those objects. Postman is an option, but since the "TEMP_" objects are scattered all over the place, it's difficult to create and manage a collection.

The other option I came across is to via  /mit/uni/infra. I attempted to delete a file or folder containing "TEMP_" but was unsuccessful using CLI or SCP.  missed the opportunity to take a backup, so restoring is not an option for now.

for i in `find *TEMP_*`
do 
echo "removing $i" 
modelete $i
done
moconfig commit

sudo find -type d -name *TEMP_*| xargs sudo rm -rf

search and delete in winsCP

1 Accepted Solution

Accepted Solutions

RedNectar
VIP
VIP

Hi @Qwr! ,

I'm not sure if this is a question that  you'd like answered, or a contribution to help others out - because you've (almost) given the answer to your comment ...


was looking for a quick way to delete those objects. 

... when you listed the modelete method - but unfortunately as written it won't necessarily get ALL objects starting with TEMP_

So if you are looking for an answer to get ALL objects, you'll need to do this (my additions in red) - it will throw a lot of errors which you can ignore (because it's trying to delete relationships that won't exist when the objects they link to are deleted) but it will (fingers crossed) work!

apic1# bash
admin@apic1:~> cd /mit/uni/infra/
admin@apic1:infra~> for i in `find . -name *TEMP_*`
> do 
> echo "removing $i" 
> modelete $i
> done
# POTENTIALLY LOTS OF OUTPUT #
admin@apic1:infra~> moconfig commit

You won't be able to use any sudo commands on the APIC without TAC support

RedNectar aka Chris Welsh.
Forum Tips: 1. Paste images inline - don't attach. 2. Always mark helpful and correct answers, it helps others find what they need.

View solution in original post