01-11-2022 05:21 AM - edited 01-12-2022 12:51 AM
Hello,
I'm trying to generate new RSA keys & Certificates on Cisco switches/routers using Ansible...
The process should be as below. I'm aware of how to push commands from Ansible. But the problem with this RSA key generate command that it can take a long time to finish, and that further commands are dependent on this.
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
@Ansible
01-11-2022 07:46 AM
check some script :
01-12-2022 12:51 AM
I'm aware of how to push commands from Ansible. But the problem with this RSA key generate command that it can take a long time to finish, and that further commands are dependent on this.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide