Hi Team,

I am trying to create a playbook to add the allow users and hostname 
dynamically in SSHD config. Ansible playbook should check the entry and add 
it if its not exist. 

I have written the below code and it is duplicating the same content and 
its not checking idempotent. The  below code is not adding *@* 
*@dcecpn0.spt.com. Can you please check and provide your suggestions.

  lineinfile:
    path: "{{ security_ssh_config_path }}"
    backrefs: yes  
    regexp: '(^AllowUsers(?!.*b{{ security_ssh_allowed_users }}@{{ 
security_ssh_allowed_hosts }}\b).*)$'
    line: '\1 {{ security_ssh_allowed_users }}@{{ 
security_ssh_allowed_hosts }}'
    state: present

Thanks 
Amit.

-- 
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/48fb2ead-ea9f-46a0-bd5c-97daceac69c5n%40googlegroups.com.

Reply via email to