2018-10-24 10:51:45 +00:00
|
|
|
- name: Validate privatekey1 (test - RSA key with size 4096 bits)
|
|
|
|
shell: "ssh-keygen -lf {{ output_dir }}/privatekey1 | grep -o -E '^[0-9]+'"
|
|
|
|
register: privatekey1
|
|
|
|
|
|
|
|
- name: Validate privatekey1 (assert - RSA key with size 4096 bits)
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- privatekey1.stdout == '4096'
|
|
|
|
|
|
|
|
|
|
|
|
- name: Validate privatekey2 (test - RSA key with size 2048 bits)
|
|
|
|
shell: "ssh-keygen -lf {{ output_dir }}/privatekey2 | grep -o -E '^[0-9]+'"
|
|
|
|
register: privatekey2
|
|
|
|
|
|
|
|
- name: Validate privatekey2 (assert - RSA key with size 2048 bits)
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- privatekey2.stdout == '2048'
|
|
|
|
|
|
|
|
|
|
|
|
- name: Validate privatekey3 (test - DSA key with size 1024 bits)
|
|
|
|
shell: "ssh-keygen -lf {{ output_dir }}/privatekey3 | grep -o -E '^[0-9]+'"
|
|
|
|
register: privatekey3
|
|
|
|
|
|
|
|
- name: Validate privatekey3 (assert - DSA key with size 4096 bits)
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- privatekey3.stdout == '1024'
|
|
|
|
|
|
|
|
|
|
|
|
- name: Validate privatekey4 (test - Ensure key has been removed)
|
|
|
|
stat:
|
|
|
|
path: '{{ output_dir }}/privatekey4'
|
|
|
|
register: privatekey4
|
|
|
|
|
|
|
|
- name: Validate privatekey4 (assert - Ensure key has been removed)
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- privatekey4.stat.exists == False
|
2019-03-05 16:07:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
- name: Validate privatekey5 (assert - Public key module output equal to the public key on host)
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "publickey_gen.public_key == lookup('file', output_dir ~ '/privatekey5.pub').strip('\n')"
|