Hi Experts,

Please help me with your guidance here.

I want to comment a line in one config file and need to uncomment the other 
lline using ansible.

My file content as below. 
________________________________________________________________________________________________________________________

        <include location="conf/basicUserRegistry.xml"/>                    
                       -------------------------this i want to comment 
    <!--include location="conf/ldapUserRegistry.xml"/-->                    
                        --------------------------- this line i want to 
uncomment

__________________________________________________________________________________________________________________________

I tried with the below play book and its not showing any error even though 
its not changing any changes to the file.

---------------------------------------------------------------------------------------------------------------------------------------------------

- name: enable LDAP
  hosts: localhost
  tasks:
   - name: disbale basic user-registry
     lineinfile:
       path: 
/opt/IBM/605CLM/JazzTeamServer/server/liberty/servers/clm/server.xml
       regexp: '^\s*<include location="conf/basicUserRegistry.xml">.*$'
       line: '<!--include location="conf/basicUserRegistry.xml"-->;'
       backrefs: yes
     become: true
-----------------------------------------------------------------------------------------------------------------------------------------------------------
---

- name: enable LDAP USER_REGISTRY
  hosts: localhost
  tasks:
    lineinfile:
      dest: 
/opt/IBM/605CLM/JazzTeamServer/server/liberty/servers/clm/server.xml
      regexp: '^(.*)<!--include 
location="conf/ldapUserRegistry.xml"-->(.*)$'
      line: '<include location="conf/ldapUserRegistry.xml">;'
      backrefs: yes

_____________________________________________________________________________________________________________


Output:


PLAY [enable LDAP] 
******************************************************************************************************************************************

TASK [Gathering Facts] 
**************************************************************************************************************************************
ok: [localhost]

TASK [disbale basic user-registry] 
**************************************************************************************************************************
ok: [localhost]

PLAY RECAP 
**************************************************************************************************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=0


-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6d146abd-a390-4d54-9179-e7a7711d8abc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to