Skip to content

Commit

Permalink
Set variable "ansible_ssh_private_key_file"
Browse files Browse the repository at this point in the history
  • Loading branch information
vitabaks committed Sep 15, 2023
1 parent d84f205 commit fad21ce
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions config_pgcluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@
- vars/main.yml
- vars/system.yml
pre_tasks:
# if 'provision' and a temporary ssh key are used
- name: "Set variable: ansible_ssh_private_key_file"
ansible.builtin.set_fact:
ansible_ssh_private_key_file: "~{{ lookup('env', 'USER') }}/.ssh/{{ hostvars['localhost']['tmp_ssh_key_name'] }}"
when:
- provision | lower != 'none'
- hostvars['localhost']['ssh_key_name'] is defined
- hostvars['localhost']['ssh_key_name'] == hostvars['localhost']['tmp_ssh_key_name']
tags: always

- name: Include OS-specific variables
ansible.builtin.include_vars: "vars/{{ ansible_os_family }}.yml"

Expand Down
10 changes: 10 additions & 0 deletions deploy_pgcluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@
environment: "{{ proxy_env | default({}) }}"

pre_tasks:
# if 'provision' and a temporary ssh key are used
- name: "Set variable: ansible_ssh_private_key_file"
ansible.builtin.set_fact:
ansible_ssh_private_key_file: "~{{ lookup('env', 'USER') }}/.ssh/{{ hostvars['localhost']['tmp_ssh_key_name'] }}"
when:
- provision | lower != 'none'
- hostvars['localhost']['ssh_key_name'] is defined
- hostvars['localhost']['ssh_key_name'] == hostvars['localhost']['tmp_ssh_key_name']
tags: always

- name: Include OS-specific variables
ansible.builtin.include_vars: "vars/{{ ansible_os_family }}.yml"
tags: always
Expand Down

0 comments on commit fad21ce

Please sign in to comment.