<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: DNAC Template delete users in Network Platform API</title>
    <link>https://community.cisco.com/t5/network-platform-api/dnac-template-delete-users/m-p/4823794#M8786</link>
    <description>&lt;P&gt;Hi Wsolano,&lt;BR /&gt;&lt;BR /&gt;Yes, it is possible to use a Jinja2 template on DNAC to delete local users on multiple devices. You can achieve this by using the "cli" command in the Jinja2 template and executing the command "no username &amp;lt;username&amp;gt;" for each user that needs to be deleted.&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an example Jinja2 template that deletes all local users on a Cisco IOS device:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;{% &lt;SPAN style="color:rgb(46,149,211);"&gt;for&lt;/SPAN&gt; user &lt;SPAN style="color:rgb(46,149,211);"&gt;in&lt;/SPAN&gt; &lt;SPAN style="color:rgb(233,149,12);"&gt;users&lt;/SPAN&gt; %} &lt;/P&gt;
&lt;P&gt;cli &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color:rgb(233,149,12);"&gt;command&lt;/SPAN&gt; &lt;SPAN style="color:rgb(0,166,125);"&gt;"no username {{ user }}"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt; {% endfor %}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P&gt;In the above example, "users" is a variable that contains a list of usernames that need to be deleted.&lt;/P&gt;
&lt;P&gt;You can then bind this template to a device in DNAC and provide the "users" variable as input.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"&lt;STRONG&gt;Note that deleting local users can be a risky operation, and you should ensure that you have a backup of the device configuration before running this template&lt;/STRONG&gt;."&lt;BR /&gt;&lt;BR /&gt;-----------------------------------------&lt;/P&gt;
&lt;P&gt;If you find my reply solved your question or issue, kindly click the 'Accept as Solution' button and vote it as helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also learn more about Cisco DNA Center through our live Ask the Experts (ATXs) session. Check out Cisco DNA Center ATXs Resources [&lt;A href="https://community.cisco.com/t5/networking-knowledge-base/cisco-dna-center-ask-the-experts-resources/ta-p/4394489" target="_blank"&gt;https://community.cisco.com/t5/networking-knowledge-base/cisco-dna-center-ask-the-experts-resources/ta-p/4394489&lt;/A&gt;] to view the latest schedule for upcoming sessions, as well as the useful references, e.g. online guides, FAQs.&lt;/P&gt;
&lt;P&gt;-----------------------------------------&lt;BR /&gt;&lt;BR /&gt;Thank You&lt;BR /&gt;Niranjana Ramanan&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 28 Apr 2023 07:13:22 GMT</pubDate>
    <dc:creator>nirraman</dc:creator>
    <dc:date>2023-04-28T07:13:22Z</dc:date>
    <item>
      <title>DNAC Template delete users</title>
      <link>https://community.cisco.com/t5/network-platform-api/dnac-template-delete-users/m-p/4817185#M8785</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;
&lt;P&gt;I am creating a few velocity/Jinja2 templates on DNAC to push some configurations to multiple devices. The question that I have is if there is a way to tell the template to delete all existing local users in the device. When I look at the options for variable binding at the device level I don't see users as options.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.cisco.com/c/en/us/td/docs/cloud-systems-management/network-automation-and-management/dna-center/2-3-6/user_guide/b_cisco_dna_center_ug_2_3_6/b_cisco_dna_center_ug_2_3_6_chapter_01000.html" target="_blank" rel="noopener"&gt;https://www.cisco.com/c/en/us/td/docs/cloud-systems-management/network-automation-and-management/dna-center/2-3-6/user_guide/b_cisco_dna_center_ug_2_3_6/b_cisco_dna_center_ug_2_3_6_chapter_01000.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Has anyone tried something similar?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2023 19:53:56 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/dnac-template-delete-users/m-p/4817185#M8785</guid>
      <dc:creator>wsolano</dc:creator>
      <dc:date>2023-04-18T19:53:56Z</dc:date>
    </item>
    <item>
      <title>Re: DNAC Template delete users</title>
      <link>https://community.cisco.com/t5/network-platform-api/dnac-template-delete-users/m-p/4823794#M8786</link>
      <description>&lt;P&gt;Hi Wsolano,&lt;BR /&gt;&lt;BR /&gt;Yes, it is possible to use a Jinja2 template on DNAC to delete local users on multiple devices. You can achieve this by using the "cli" command in the Jinja2 template and executing the command "no username &amp;lt;username&amp;gt;" for each user that needs to be deleted.&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an example Jinja2 template that deletes all local users on a Cisco IOS device:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;{% &lt;SPAN style="color:rgb(46,149,211);"&gt;for&lt;/SPAN&gt; user &lt;SPAN style="color:rgb(46,149,211);"&gt;in&lt;/SPAN&gt; &lt;SPAN style="color:rgb(233,149,12);"&gt;users&lt;/SPAN&gt; %} &lt;/P&gt;
&lt;P&gt;cli &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color:rgb(233,149,12);"&gt;command&lt;/SPAN&gt; &lt;SPAN style="color:rgb(0,166,125);"&gt;"no username {{ user }}"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt; {% endfor %}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P&gt;In the above example, "users" is a variable that contains a list of usernames that need to be deleted.&lt;/P&gt;
&lt;P&gt;You can then bind this template to a device in DNAC and provide the "users" variable as input.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"&lt;STRONG&gt;Note that deleting local users can be a risky operation, and you should ensure that you have a backup of the device configuration before running this template&lt;/STRONG&gt;."&lt;BR /&gt;&lt;BR /&gt;-----------------------------------------&lt;/P&gt;
&lt;P&gt;If you find my reply solved your question or issue, kindly click the 'Accept as Solution' button and vote it as helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also learn more about Cisco DNA Center through our live Ask the Experts (ATXs) session. Check out Cisco DNA Center ATXs Resources [&lt;A href="https://community.cisco.com/t5/networking-knowledge-base/cisco-dna-center-ask-the-experts-resources/ta-p/4394489" target="_blank"&gt;https://community.cisco.com/t5/networking-knowledge-base/cisco-dna-center-ask-the-experts-resources/ta-p/4394489&lt;/A&gt;] to view the latest schedule for upcoming sessions, as well as the useful references, e.g. online guides, FAQs.&lt;/P&gt;
&lt;P&gt;-----------------------------------------&lt;BR /&gt;&lt;BR /&gt;Thank You&lt;BR /&gt;Niranjana Ramanan&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Apr 2023 07:13:22 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/dnac-template-delete-users/m-p/4823794#M8786</guid>
      <dc:creator>nirraman</dc:creator>
      <dc:date>2023-04-28T07:13:22Z</dc:date>
    </item>
    <item>
      <title>Re: DNAC Template delete users</title>
      <link>https://community.cisco.com/t5/network-platform-api/dnac-template-delete-users/m-p/4997463#M8787</link>
      <description>&lt;P&gt;Sure about that? Deleting user accounts is an interactive CLI command requiring confirmation. I tried this earlier but got the following error:&lt;/P&gt;&lt;PRE&gt;Message: Unable to push the invalid CLI to the device switch01.domain.com using protocol ssh2. Invalid CLI -  Current output : no username Anakin
This operation will remove all username related configurations with same name.Do you want to continue? [confirm]
Current expects : switch01.{0,30}([^)]+)#s*z (Config Prompt)
switch01#s*z (Prompt)
[y/n] (Interactive)
ACCEPT? (yes/[no]): (Interactive)&lt;/PRE&gt;&lt;P&gt;I did not investigate this in depth, I tried a few ways to get it to hit ENTER on the question but no success.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2024 08:17:00 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/dnac-template-delete-users/m-p/4997463#M8787</guid>
      <dc:creator>eekman</dc:creator>
      <dc:date>2024-01-16T08:17:00Z</dc:date>
    </item>
  </channel>
</rss>

