Hi All , 

I trying to modify the sshd_config  parameter using the lineinfile  ansible 
module . I would like to delegate this to multiple host . As we have used 
the loop twice its unable to resolve the loop structure.

vars:
ssh_delegate_hosts:
  - "192.50.26.248"
  - "192.50.27.248"

- name: Change configuration in sshd_config
  ansible.builtin.lineinfile:
    path: /etc/ssh/sshd_config
    regexp: "{{ item.regexp }}"
    line: "{{ item.line }}"
  loop:
    - { regexp: '^AllowTcpForwarding', line: 'AllowTcpForwarding yes' }
    - { regexp: '^AllowAgentForwarding', line: 'AllowAgentForwarding yes' }
  loop: "{{ ssh_delegate_hosts }}"
  delegate_to: "{{ item }}"

Need your valuable  feedback  of how  to loop both  the lines and loop the 
hosts . 

Thanks and Regards,
Deepak Kumar

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5cd5230e-f36e-4990-b0ae-2820be5e2d0dn%40googlegroups.com.

Reply via email to