You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello!
I have a playbook where i want to transfer from a remote host to another host and use a service user and its keys in the default location /home/user/.ssh i can move files when i put the keys to ~/.ssh/, but with my other playbook it stops at the sncronize task and just stops when i end the template and the log just stops and schows nor errors.
The Playbook:
`---
name: Generate SSH keypair on remote hosts and distribute keys
hosts:
192.168.151.141
192.168.151.237
become: true
tasks:
name: Create a "sync_src" group
ansible.builtin.group_by:
key: sync_src
when: ansible_default_ipv4.address == '192.168.151.237'
name: Create a "sync_dst" group
ansible.builtin.group_by:
key: sync_dst
when: ansible_default_ipv4.address == '192.168.151.141'
name: Create SSH keypair in /tmp
hosts: localhost
tasks:
Hello!
I have a playbook where i want to transfer from a remote host to another host and use a service user and its keys in the default location /home/user/.ssh i can move files when i put the keys to ~/.ssh/, but with my other playbook it stops at the sncronize task and just stops when i end the template and the log just stops and schows nor errors.
The Playbook:
`---
name: Generate SSH keypair on remote hosts and distribute keys
hosts:
192.168.151.141
192.168.151.237
become: true
tasks:
name: Create a "sync_src" group
ansible.builtin.group_by:
key: sync_src
when: ansible_default_ipv4.address == '192.168.151.237'
name: Create a "sync_dst" group
ansible.builtin.group_by:
key: sync_dst
when: ansible_default_ipv4.address == '192.168.151.141'
name: Create SSH keypair in /tmp
hosts: localhost
tasks:
ansible.builtin.openssh_keypair:
path: /tmp/id_rsa_remcpyusr
type: rsa
force: true
comment: "remcpyusr"
run_once: true
name: Distribute the SSH public key
hosts: sync_dst
tasks:
ansible.builtin.copy:
src: /tmp/id_rsa_remcpyusr.pub
dest: /home/remcpyusr/.ssh/authorized_keys
owner: remcpyusr
mode: '0644'
force: yes
name: Distribute the SSH private key
hosts: sync_src
tasks:
ansible.builtin.copy:
src: /tmp/id_rsa_remcpyusr
dest: /home/remcpyusr/.ssh/id_rsa
owner: remcpyusr
mode: '0600'
force: yes
name: Synchronize files to target host
hosts: sync_dst
tasks:
ansible.builtin.synchronize:
src: '{{ item }}'
dest: remcpyusr@{{ ansible_default_ipv4.address }}:{{ item }}
rsync_opts:
- "--rsh='ssh -i /home/remcpyusr/.ssh/id_rsa'"
delegate_to: '{{ groups["sync_src"] | random }}'
when: "'sync_dst' in group_names"
loop:
job_3856.txt
The really nice peaople in the ansible forum have sadly no idea what the issue could be.
Im very grateful for your input!!
MDuerre
The text was updated successfully, but these errors were encountered: