Skip to content

Commit

Permalink
Refactor vars
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Lievano committed Jul 22, 2022
1 parent 32969da commit 6e792ef
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 4 additions & 0 deletions local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

connection: local

vars_files:
- "vars/common.yml"
- "vars/{{ ansible_facts['os_family'] }}.yml"

vars:
source_key: "./ssh_keys/id_local"
dest_key: "{{ lookup('env', 'HOME') }}/.local/share/ssh/id_local"
Expand Down
Empty file added tasks/Debian.yml
Empty file.
8 changes: 1 addition & 7 deletions tasks/kitty.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
- name: Check Kitty installation (Debian)
when: ansible_facts['os_family'] == "Debian"
stat:
path: "{{ lookup('env', 'HOME') }}/.local/kitty.app"
register: kitty_app

- name: Check Kitty installation (Darwin)
when: ansible_facts['os_family'] == "Darwin"
stat:
path: "/Applications/kitty.app"
path: "{{ kitty_app_path }}"
register: kitty_app

- name: Install Kitty
Expand Down
10 changes: 5 additions & 5 deletions tasks/ssh.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
- name: Ensure .ssh directory exists
file:
dest: "{{ dest_key | dirname }}"
dest: "{{ local_dest_key | dirname }}"
mode: 0700
state: directory

- name: Install ssh local key
copy:
src: "{{ source_key }}"
dest: "{{ dest_key }}"
src: "{{ local_key }}"
dest: "{{ local_dest_key }}"
mode: 0600

- name: Install ssh local public key
copy:
src: "{{ source_key }}.pub"
dest: "{{ dest_key }}.pub"
src: "{{ local_key }}.pub"
dest: "{{ local_dest_key }}.pub"
mode: 0644

- name: Install ssh github key
Expand Down
1 change: 1 addition & 0 deletions vars/Darwin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
kitty_app_path: "/Applications/kitty.app"
1 change: 1 addition & 0 deletions vars/Debian.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
kitty_app_path: "{{ lookup('env', 'HOME') }}/.local/kitty.app"

0 comments on commit 6e792ef

Please sign in to comment.