Changed source path for files moved into lockdown role that are used in copy module tasks

This commit is contained in:
Alex Tavarez
2025-10-21 14:05:51 -04:00
parent 8647bb2a06
commit 8d4ef1a461
3 changed files with 9 additions and 12 deletions

View File

@@ -88,7 +88,7 @@
block: block:
- name: Transfer private SSH keys - name: Transfer private SSH keys
ansible.builtin.copy: ansible.builtin.copy:
src: ssh/{{ item }}.ppk src: ssh/{{ ansible_facts['user_id'] }}/{{ item }}.ppk
dest: "{{ ansible_facts['user_dir'] }}/.ssh/{{ item }}.ppk" dest: "{{ ansible_facts['user_dir'] }}/.ssh/{{ item }}.ppk"
force: yes force: yes
backup: yes backup: yes
@@ -100,7 +100,7 @@
register: created_ssh_private_keys register: created_ssh_private_keys
- name: Transfer public SSH keys - name: Transfer public SSH keys
ansible.builtin.copy: ansible.builtin.copy:
src: ssh/{{ item }}.pub src: ssh/{{ ansible_facts['user_id'] }}/{{ item }}.pub
dest: "{{ ansible_facts['user_dir'] }}/.ssh/{{ item }}.pub" dest: "{{ ansible_facts['user_dir'] }}/.ssh/{{ item }}.pub"
force: yes force: yes
backup: yes backup: yes

View File

@@ -27,7 +27,7 @@
- name: Acquire GPG private keys - name: Acquire GPG private keys
when: files_mode when: files_mode
ansible.builtin.copy: ansible.builtin.copy:
src: gnupg/{{ item }}.asc src: gnupg/{{ ansible_facts['user_id'] }}/{{ item }}.asc
dest: "{{ ansible_facts['user_dir'] }}/.gnupg/{{ item }}.priv.asc" dest: "{{ ansible_facts['user_dir'] }}/.gnupg/{{ item }}.priv.asc"
force: yes force: yes
backup: yes backup: yes

View File

@@ -7,14 +7,11 @@
- vars/ssh_keys.yml - vars/ssh_keys.yml
vars: vars:
ansible_user: "{{ passwords[0].username }}" ansible_user: "{{ passwords[0].username }}"
ansible_ssh_user: "{{ passwords[0].username }}"
# @NOTE one of below two lines should be commented/uncommented in a mutually exclusive fashion # @NOTE one of below two lines should be commented/uncommented in a mutually exclusive fashion
# ansible_ssh_private_key_file: "{{ chosen_native_ssh_private_key_file | default(chosen_local_ssh_private_key_file, true) }}" # @NOTE only works with soft-coded SSH key list building # ansible_ssh_private_key_file: "{{ chosen_native_ssh_private_key_file | default(chosen_local_ssh_private_key_file, true) }}" # @NOTE only works with soft-coded SSH key list building
ansible_ssh_private_key_file: "{{ chosen_local_ssh_private_key_file }}" ansible_ssh_private_key_file: "{{ chosen_local_ssh_private_key_file }}" # @NOTE references an inventory / group variable
# @NOTE below three lines should only be uncommented when above two are commented and vice versa; key-based authentication should have already been enabled prior to running this playbook # @NOTE below three lines should only be uncommented when above two are commented and vice versa; key-based authentication should have already been enabled prior to running this playbook
# ansible_password: "{{ passwords[0].password }}" # ansible_password: "{{ passwords[0].password }}"
# ansible_ssh_pass: "{{ passwords[0].username }}"
# ansible_ssh_password: "{{ passwords[0].username }}"
ansible_python_interpreter: “{{ ansible_playbook_python }}” ansible_python_interpreter: “{{ ansible_playbook_python }}”
personal_computers: locals # @NOTE can change to *_households group or {{ name }}_{{ surname }} group name personal_computers: locals # @NOTE can change to *_households group or {{ name }}_{{ surname }} group name
vars_prompt: vars_prompt:
@@ -43,7 +40,7 @@
- name: Create global bash aliases - name: Create global bash aliases
become: yes become: yes
ansible.builtin.copy: ansible.builtin.copy:
src: files/all/bash/bash_aliases src: bash/bash_aliases
dest: /etc/bash_aliases dest: /etc/bash_aliases
owner: root owner: root
group: root group: root
@@ -58,7 +55,7 @@
- name: Create global bash functions - name: Create global bash functions
become: yes become: yes
ansible.builtin.copy: ansible.builtin.copy:
src: files/all/bash/bash_functions src: bash/bash_functions
dest: /etc/bash_functions dest: /etc/bash_functions
owner: root owner: root
group: root group: root
@@ -110,7 +107,7 @@
state: present state: present
- name: Create XDG user home directory environment variables - name: Create XDG user home directory environment variables
ansible.builtin.copy: ansible.builtin.copy:
src: "files/servers/{{ ansible_facts['user_id'] }}/xdg/user-dirs.dirs" src: "xdg/{{ ansible_facts['user_id'] }}/user-dirs.dirs"
dest: "{{ ansible_facts['user_dir'] }}/.config/user-dirs.dirs" dest: "{{ ansible_facts['user_dir'] }}/.config/user-dirs.dirs"
owner: root owner: root
group: root group: root
@@ -140,7 +137,7 @@
state: present state: present
- name: Create XDG user home directory environment variables - name: Create XDG user home directory environment variables
ansible.builtin.copy: ansible.builtin.copy:
src: "files/locals/{{ ansible_facts['user_id'] }}/xdg/user-dirs.dirs" src: "xdg/{{ ansible_facts['user_id'] }}/user-dirs.dirs"
dest: "{{ ansible_facts['user_dir'] }}/.config/user-dirs.dirs" dest: "{{ ansible_facts['user_dir'] }}/.config/user-dirs.dirs"
owner: root owner: root
group: root group: root
@@ -159,7 +156,7 @@
block: block:
- name: Create user SSH configuration - name: Create user SSH configuration
ansible.builtin.copy: ansible.builtin.copy:
src: "files/locals/ssh/{{ ansible_facts['user_id'] }}/config" src: "ssh/{{ ansible_facts['user_id'] }}/config"
dest: "{{ ansible_facts['user_dir'] }}/.ssh/config" dest: "{{ ansible_facts['user_dir'] }}/.ssh/config"
follow: yes follow: yes
force: yes force: yes