You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
733 B

  1. ---
  2. - name: set bastion host IP
  3. set_fact:
  4. bastion_ip: "{{ hostvars[groups['bastion'][0]]['ansible_host'] | d(hostvars[groups['bastion'][0]]['ansible_ssh_host']) }}"
  5. delegate_to: localhost
  6. connection: local
  7. # As we are actually running on localhost, the ansible_ssh_user is your local user when you try to use it directly
  8. # To figure out the real ssh user, we delegate this task to the bastion and store the ansible_user in real_user
  9. - name: Store the current ansible_user in the real_user fact
  10. set_fact:
  11. real_user: "{{ ansible_user }}"
  12. - name: create ssh bastion conf
  13. become: false
  14. delegate_to: localhost
  15. connection: local
  16. template:
  17. src: ssh-bastion.conf
  18. dest: "{{ playbook_dir }}/ssh-bastion.conf"