Created
January 30, 2020 12:40
-
-
Save ekollof/120e89e3e9ed75279e322b445f01bade to your computer and use it in GitHub Desktop.
ansible playbook getting/registering sshfp records with cloudflare
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: get SSHFP records | |
shell: "ssh-keygen -r {{ ansible_nodename }} | awk '{print $4, $5, $6}'" | |
register: sshfp_entries | |
- name: Register SSHFP with CloudFlare | |
cloudflare_dns: | |
zone: "hackerheaven.org" | |
record: "{{ ansible_hostname }}" | |
type: SSHFP | |
account_email: "{{ cloudflare_email }}" | |
account_api_token: "{{ cloudflare_api_token }}" | |
algorithm: "{{ item.split()[0] }}" | |
hash_type: "{{ item.split()[1] }}" | |
value: "{{ item.split()[2] }}" | |
state: present | |
loop: "{{ sshfp_entries.stdout_lines }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment