Re: [ansible-project] Need help in exploring how to use regular expression to find the correct file name in a play book
On 25.04.2017 15:35, vinod kumar wrote: I am writing a play book to add below two lines to a service config file under /etc/xinetd.d/. The filename generally starts with oscssd*. As i have multiple servers, this file name is getting changed and playbook is not working as expected as the filename is getting change. Please let me know how can i incorporate the regular expression to find the correct file name. /etc/xinetd.d/oscssd* is not working with lineinfile module. Use the find module to find the file(s) en register the output in a variable and use the result to change the files. -- Kai Stian Olstad -- 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/1f132250f115ac954777f8e6a24db8f8%40olstad.com. For more options, visit https://groups.google.com/d/optout.
Re: [ansible-project] Need help in exploring how to use regular expression to find the correct file name in a play book
Might be better to list the files you want to edit as vars on each of the hosts in your inventory. On 25 April 2017 at 14:35, vinod kumar wrote: > Hi All, > > I am writing a play book to add below two lines to a service config file > under /etc/xinetd.d/. The filename generally starts with oscssd*. As i have > multiple servers, this file name is getting changed and playbook is not > working as expected as the filename is getting change. > > Please let me know how can i incorporate the regular expression to find the > correct file name. /etc/xinetd.d/oscssd* is not working with lineinfile > module. > > cat xinetd.yml > --- > - name: xined log reduction playbook > hosts: test-servers > become: True > become_method: sudo > tasks: > - name: updating with log_on_success value in xinetd oscssd3001 > configuration > lineinfile: > name: "/etc/xinetd.d/oscssd3001" > insertbefore: '^}' > line: 'log_on_success =' > ignore_errors: yes > - name: updating with log_on_failure value in xinetd oscssd3001 > configuration > lineinfile: > name: "/etc/xinetd.d/oscssd3001" > insertbefore: '^}' > line: 'log_on_failure =' > ignore_errors: yes > - name: updating with log_on_success value in xinetd oscssd5001 > configuration > lineinfile: > name: "/etc/xinetd.d/oscssd5001" > insertbefore: '^}' > line: 'log_on_success =' > ignore_errors: yes > - name: updating with log_on_failure value in xinetd oscssd5001 > configuration > lineinfile: > name: "/etc/xinetd.d/oscssd5001" > insertbefore: '^}' > line: 'log_on_failure =' > ignore_errors: yes > - name: Reload of xinetd services > service: > name: xinetd > state: reloaded > > > Thanks in advance. > > Regards, > Vinod. > > -- > 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/96f43351-b409-46d1-9bea-b16d2abc58b5%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- 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/CAK5eLPQDNM9ZRZbDU1atF1Tx-WG-zsUUk1%3Dv%3D00YVPxD3CzpsQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
[ansible-project] Need help in exploring how to use regular expression to find the correct file name in a play book
Hi All, I am writing a play book to add below two lines to a service config file under /etc/xinetd.d/. The filename generally starts with oscssd*. As i have multiple servers, this file name is getting changed and playbook is not working as expected as the filename is getting change. Please let me know how can i incorporate the regular expression to find the correct file name. /etc/xinetd.d/oscssd* is not working with lineinfile module. cat xinetd.yml --- - name: xined log reduction playbook hosts: test-servers become: True become_method: sudo tasks: - name: updating with log_on_success value in xinetd oscssd3001 configuration lineinfile: name: "/etc/xinetd.d/oscssd3001" insertbefore: '^}' line: 'log_on_success =' ignore_errors: yes - name: updating with log_on_failure value in xinetd oscssd3001 configuration lineinfile: name: "/etc/xinetd.d/oscssd3001" insertbefore: '^}' line: 'log_on_failure =' ignore_errors: yes - name: updating with log_on_success value in xinetd oscssd5001 configuration lineinfile: name: "/etc/xinetd.d/oscssd5001" insertbefore: '^}' line: 'log_on_success =' ignore_errors: yes - name: updating with log_on_failure value in xinetd oscssd5001 configuration lineinfile: name: "/etc/xinetd.d/oscssd5001" insertbefore: '^}' line: 'log_on_failure =' ignore_errors: yes - name: Reload of xinetd services service: name: xinetd state: reloaded Thanks in advance. Regards, Vinod. -- 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/96f43351-b409-46d1-9bea-b16d2abc58b5%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.