Cisco Generate Crypto Keys

236 views
Skip to first unread message

eng.oma...@gmail.com

unread,
Jan 11, 2022, 8:07:08 AM1/11/22
to Ansible Project
Hello,

I'm trying to generate new RSA keys & Certificates on Cisco switches/routers. 
The process should be as below. My problem is that i want to execute the first command. then wait to see ([OK]) in the output before proceeding with next commands. But i couldn't find a way to parse the output of the 1st command in any module i have seen. Any ideas?

router(config)# crypto key generate rsa label RSA-Key modulus 4096
The name for the keys will be: RSA-Key

% The key modulus size is 4096 bits
% Generating 4096 bit RSA keys, keys will be non-exportable...
[OK] (elapsed time was 100 seconds)

router(config)#crypto pki trustpoint Self-Signed-Certificate
router(ca-trustpoint)#enrollment selfsigned
router(ca-trustpoint)#subject-name O=GeneratedCertificate,CN=Self-Signed-Certificate
router(ca-trustpoint)#hash sha256
router(ca-trustpoint)#rsakeypair RSA-Key

router(config)#crypto pki enroll Self-Signed-Certificate
% Include the router serial number in the subject name? [yes/no]: no
% Include an IP address in the subject name? [no]: no
Generate Self Signed Router Certificate? [yes/no]: yes

Router Self Signed Certificate successfully created


Dick Visser

unread,
Jan 11, 2022, 9:31:38 AM1/11/22
to ansible...@googlegroups.com
Register the output, display it using the debug module, then use the pause module to confirm 

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/5db4ceaa-2fce-400e-8b75-2c274a774d37n%40googlegroups.com.
--
Sent from a mobile device - please excuse the brevity, spelling and punctuation.
Reply all
Reply to author
Forward
0 new messages