-
Notifications
You must be signed in to change notification settings - Fork 3
/
personal-keys.yaml
69 lines (60 loc) · 1.97 KB
/
personal-keys.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
- hosts: localhost
vars:
source_gpg_private_key: "./.gpg_keys/private.key"
source_gpg_public_key: "./.gpg_keys/public.key"
source_ssh_key: "./.ssh/id_rsa"
dest_ssh_key: "{{ lookup('env', 'HOME') }}/.ssh/id_rsa"
go_root: "/usr/local/go"
go_path: "{{ ansible_env.HOME }}/go"
fabric_version: "latest"
fabric_config_dir: "{{ ansible_env.HOME }}/.config/fabric"
vars_files:
- ./vars/api_keys.yml
tasks:
- name: Ensure .ssh and .gnupg directories exist
file:
path: "{{ item }}"
state: directory
mode: "0700"
loop:
- "{{ lookup('env', 'HOME') }}/.ssh"
- "{{ lookup('env', 'HOME') }}/.gnupg"
ignore_errors: no
- import_tasks: ansible/tasks/gpg.yaml
- import_tasks: ansible/tasks/ssh.yaml
- name: Set correct permissions for SSH key
file:
path: "{{ dest_ssh_key }}"
mode: "0600"
when: dest_ssh_key is file
ignore_errors: no
- name: Verify key installations
block:
- name: Check GPG key
command: gpg --list-secret-keys
register: gpg_check
changed_when: false
failed_when: gpg_check.rc != 0
- name: Check SSH key
stat:
path: "{{ dest_ssh_key }}"
register: ssh_check
rescue:
- name: Key installation failed
fail:
msg: "Failed to install keys. Please check the error messages above."
- name: Ensure ~/.config/fabric directory exists
ansible.builtin.file:
path: "{{ fabric_config_dir }}"
state: directory
mode: "0755"
- name: Copy Fabric AI .env file
ansible.builtin.template:
src: "./ansible/templates/fabric/.env"
dest: "{{ fabric_config_dir }}/.env"
mode: "0600"
- name: Copy Fabric settings.yaml file
ansible.builtin.template:
src: "./ansible/templates/fabric/settings.yaml"
dest: "{{ fabric_config_dir }}/settings.yaml"
mode: "0600"