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 - mattermost-desktop
- wireguard-tools - wireguard-tools
#additional_aur_packages: #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" - ".gitconfig"
- ".gtkrc-2.0" - ".gtkrc-2.0"
- ".local" - ".local"
- ".ssh"
- ".themes" - ".themes"
- "scripts" - "scripts"
tags: config 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) - name: Copy new files and directories (root)
ansible.posix.synchronize: ansible.posix.synchronize:
src: "{{ item }}" src: "{{ item }}"

View File

@ -217,18 +217,6 @@
tags: packages tags: packages
become: true 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 - name: Host | Install host specific packages
community.general.pacman: community.general.pacman:
state: present state: present

View File

@ -1,5 +1,17 @@
--- ---
- hosts: localhost - 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: roles:
# install packages # install packages
- role: packages - role: packages