Skip to content

Instantly share code, notes, and snippets.

@ekollof
Created January 30, 2020 12:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ekollof/120e89e3e9ed75279e322b445f01bade to your computer and use it in GitHub Desktop.
Save ekollof/120e89e3e9ed75279e322b445f01bade to your computer and use it in GitHub Desktop.
ansible playbook getting/registering sshfp records with cloudflare
- 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