Use templating for ssh to provide different paths

This commit is contained in:
exu 2024-10-15 09:56:08 +02:00
parent 16b6e9f045
commit 0defa4022e
6 changed files with 24 additions and 13 deletions

View File

@ -3,3 +3,5 @@ additional_pacman_packages:
- mattermost-desktop
- wireguard-tools
#additional_aur_packages:
ssh_key_git: "{{ ansible_user_dir }}/.ssh/id_ed25519"

View File

@ -0,0 +1,2 @@
---
ssh_key_git: "{{ ansible_user_dir }}/.ssh/id_ed25519_git"

View File

@ -45,11 +45,18 @@
- ".gitconfig"
- ".gtkrc-2.0"
- ".local"
- ".ssh"
- ".themes"
- "scripts"
tags: config
- name: Copy new templated files
ansible.builtin.template:
src: "{{ item }}"
dest: "~/"
loop:
- ".ssh/config.j2"
tags: config
- name: Copy new files and directories (root)
ansible.posix.synchronize:
src: "{{ item }}"

View File

@ -217,18 +217,6 @@
tags: packages
become: true
- name: Host | Check if host variables exist
ansible.builtin.stat:
path: "host_vars/{{ ansible_hostname }}.yml"
register: host_file
tags: packages
- name: Host | Get host specific variables
include_vars:
file: "host_vars/{{ ansible_hostname }}.yml"
when: host_file.stat.exists
tags: packages
- name: Host | Install host specific packages
community.general.pacman:
state: present

View File

@ -1,5 +1,17 @@
---
- hosts: localhost
pre_tasks:
- name: Host | Check if host variables exist
ansible.builtin.stat:
path: "host_vars/{{ ansible_hostname }}.yml"
register: host_file
tags: always
- name: Host | Get host specific variables
include_vars:
file: "host_vars/{{ ansible_hostname }}.yml"
when: host_file.stat.exists
tags: always
roles:
# install packages
- role: packages