Skip to content

Instantly share code, notes, and snippets.

@tonk
Created October 6, 2020 06:51
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 tonk/7aaf073db77816f9cc02f8dced8fc138 to your computer and use it in GitHub Desktop.
Save tonk/7aaf073db77816f9cc02f8dced8fc138 to your computer and use it in GitHub Desktop.
---
- import_playbook: setup_tpm.yml
tags: always
- hosts: all
gather_facts: true
become: true
tasks:
- name: grab needed passwords from tpm
set_fact:
backup_passwd: "{{ lookup('tpmstore',
tpm_url,
'root@backup1.example.net',
tpm_public_key,
tpm_private_key,
tpm_certificate,
tpm_certificate_key) }}"
tags: always
- name: show it
debug:
msg: "backup: {{ backup_passwd }}"
- name: Check if backup rsync keys present
tags: backup, backup_keys
vars:
ansible_become_method: su
ansible_su_pass: "{{ backup_passwd }}"
delegate_to: backup1.example.net
command: "ls -l /backup/keys/{{ ansible_facts['hostname'] }}"
register: backup_keys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment