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.

18 lines
693 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. # As we are actually running on localhost, the ansible_ssh_user is your local user when you try to use it directly
  7. # To figure out the real ssh user, we delegate this task to the bastion and store the ansible_user in real_user
  8. - name: Store the current ansible_user in the real_user fact
  9. set_fact:
  10. real_user: "{{ ansible_user }}"
  11. - name: create ssh bastion conf
  12. become: false
  13. delegate_to: localhost
  14. template:
  15. src: ssh-bastion.conf
  16. dest: "{{ playbook_dir }}/ssh-bastion.conf"