UNPKG

hosty

Version:

A code based opinionated way to self-host and manage web apps.

11 lines 705 B
import { dirname } from 'path'; import { builtin, crypto } from '../ansible/tasks/index.js'; import { block } from './block.js'; export function generate_ssh_key({ path, passphrase }) { return block(`Generate ssh key at ${path}`, {}, [ builtin.stat('Check if SSH key exists', { path }, { register: 'ssh_key' }), builtin.file('Ensure .ssh directory exists', { path: dirname(path), state: 'directory', owner: '{{ansible_user}}', mode: '0700' }, { when: 'not ssh_key.stat.exists', become: true }), crypto.ssh_key('Generate SSH key', { type: 'rsa', path, passphrase }, { when: 'not ssh_key.stat.exists', become: true }), ]).get(); } //# sourceMappingURL=generate_ssh_key.js.map