Monday, June 17, 2019

Ansible key-chain management

I'm writing a play to update the key-chain on a cisco XE, but I'm struggling to find a good solution.

As now the datetime is grabbed from the control machine, altered and pushed to the device, this is good for set it up the first time.

When you want to update the datetime it became more difficult because one key is active and cannot be touch and the other one should be updated with the time of the second plus it own duration.

A few solutions I though are:

- Split the keys in two playbook, so you can run the play for the correct key. How to grub the datetime from the other one?

- Input datetime manually

--- - hosts: all gather_facts: False tasks: - name: Get datetime setup: gather_subset: - min delegate_to: localhost run_once: True - name: Set facts datetime # Format: 08:30:00 17 Jun 2019 set_fact: start_time: "" start_time2: "" stop_time: "" stop_time2: "" - debug: var: start_time, start_time2 verbosity: 1 run_once: True - name: Change key-chain KEYs - 1 ios_config: commands: - key-string cisco1 - cryptographic-algorithm hmac-sha-1 - accept-lifetime local   - send-lifetime local   parents: - key chain KEYs - key 1 - name: Change key-chain KEYs - 2 ios_config: commands: - key-string cisco2 - cryptographic-algorithm hmac-sha-1 - accept-lifetime local   - send-lifetime local   parents: - key chain KEYs - key 2 


No comments:

Post a Comment