Skip to content

Instantly share code, notes, and snippets.

@jinoj
Forked from nazarewk/ansible.cfg
Created December 8, 2018 16:34
Show Gist options
  • Select an option

  • Save jinoj/b94bddb0c350befd76b79a329b5d9bdb to your computer and use it in GitHub Desktop.

Select an option

Save jinoj/b94bddb0c350befd76b79a329b5d9bdb to your computer and use it in GitHub Desktop.

Revisions

  1. @nazarewk nazarewk revised this gist Feb 3, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions ssh config
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    ControlMaster auto
    ControlPath ~/.ssh/tmp/control_%h_%p_%r
    ControlPersist 1m

    Host jump
    HostName <jump_ip>
  2. @nazarewk nazarewk revised this gist Sep 16, 2016. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion ssh config
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@

    ControlMaster auto
    ControlPath ~/.ssh/tmp/control_%h_%p_%r

    Host jump
    HostName <jump_ip>
  3. @nazarewk nazarewk revised this gist Sep 16, 2016. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion ssh config
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,13 @@


    Host jump
    HostName <jump_ip>
    User nazarewk
    ForwardAgent yes

    Host secured-*
    User nazarewk
    ProxyJump jump
    ## ProxyJump works on OpenSSH 7.3+ (newest version as of 16.09.2016)
    # ProxyJump jump
    ProxyCommand ssh jump -W %h:%p
    ForwardAgent yes
  4. @nazarewk nazarewk revised this gist Sep 16, 2016. 2 changed files with 6 additions and 1 deletion.
    5 changes: 5 additions & 0 deletions ansible.cfg
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    [defaults]
    sudo_flags = SSH_AUTH_SOCK="$SSH_AUTH_SOCK" -H -S -n

    [ssh_connection]
    ssh_args=-o ForwardAgent=yes
    2 changes: 1 addition & 1 deletion ssh-forward.yml
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    - name: Ensuring we can ForwardAgent
    lineinfile:
    dest: "~/.profile"
    line: '[ -n "$SSH_AUTH_SOCK" ] && setfacl -m u:{{ project_user }}:rw "$SSH_AUTH_SOCK" && setfacl -m u:{{ project_user }}:x "$(dirname $SSH_AUTH_SOCK)" && alias sudo=''/usr/bin/sudo SSH_AUTH_SOCK="$SSH_AUTH_SOCK"'''
    line: '[ -n "$SSH_AUTH_SOCK" ] && setfacl -m u:{{ project_user }}:rw "$SSH_AUTH_SOCK" && setfacl -m u:{{ project_user }}:x "$(dirname $SSH_AUTH_SOCK)"'
    insertafter: EOF

    - name: Ensure we have ForwardAgent
  5. @nazarewk nazarewk created this gist Sep 15, 2016.
    9 changes: 9 additions & 0 deletions ssh config
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    Host jump
    HostName <jump_ip>
    User nazarewk
    ForwardAgent yes

    Host secured-*
    User nazarewk
    ProxyJump jump
    ForwardAgent yes
    10 changes: 10 additions & 0 deletions ssh-forward.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    - name: Ensuring we can ForwardAgent
    lineinfile:
    dest: "~/.profile"
    line: '[ -n "$SSH_AUTH_SOCK" ] && setfacl -m u:{{ project_user }}:rw "$SSH_AUTH_SOCK" && setfacl -m u:{{ project_user }}:x "$(dirname $SSH_AUTH_SOCK)" && alias sudo=''/usr/bin/sudo SSH_AUTH_SOCK="$SSH_AUTH_SOCK"'''
    insertafter: EOF

    - name: Ensure we have ForwardAgent
    command: ssh-add -l
    become: true
    become_user: "{{ project_user }}"