diff --git a/deploy_ssh_private_key.yml b/deploy_ssh_private_key.yml index 7d01948..4e60ec9 100644 --- a/deploy_ssh_private_key.yml +++ b/deploy_ssh_private_key.yml @@ -4,13 +4,6 @@ - vars/main.yml gather_facts: false tasks: - - name: Gather facts - ansible.builtin.setup: - - - name: Set ansible_user - set_fact: - ansible_user: "{{ ansible_user_id }}" - - name: Retrieve secrets ansible.builtin.include_tasks: file: "tasks/retrieve_secret_vars.yml" diff --git a/tasks/retrieve_secret_vars.yml b/tasks/retrieve_secret_vars.yml index a9c3f61..bd82e78 100644 --- a/tasks/retrieve_secret_vars.yml +++ b/tasks/retrieve_secret_vars.yml @@ -1,4 +1,7 @@ --- +- name: Gather facts + ansible.builtin.setup: + - name: get local machine-id command: cat /etc/machine-id register: get_local_machine_id_output @@ -21,11 +24,11 @@ - name: set remote workdir path ansible.builtin.set_fact: - remote_workdir: /home/{{ ansible_user }}/.tmp_deploy_ovh + remote_workdir: "{{ ansible_user_dir }}/.tmp_deploy_ovh" - name: set local workdir path ansible.builtin.set_fact: - local_workdir: /home/{{ lookup('env', 'USER') }}/.tmp_deploy_ovh + local_workdir: "{{ lookup('env', 'HOME') }}/.tmp_deploy_ovh" - name: create remote workdir ansible.builtin.file: