Hi All,
I am very new to Ansible. I am stuck at a regular expression syntax for specifying a file name. I am actually updating a file under /etc/xinetd.d/ with some log parameters.
I am updating the below two lines to the file /etc/xinetd.d/oscssd3001. The challenge i am facing is that the filename is getting changed on most of the servers and the file is same with the reg-expression /etc/xinetd.d/oscssd*. Therefore i am searching for a way to use this in the playbook.
i am trying to append below two lines to /etc/xinetd.d/oscssd* file in all my servers.
log_on_success =
log_on_failure =
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/oscssd*"
insertbefore: '^}'
line: ' log_on_success ='
ignore_errors: yes
- name: updating with log_on_failure value in xinetd oscssd3001 configuration
lineinfile:
name: "/etc/xinetd.d/oscssd*"
insertbefore: '^}'
line: ' log_on_failure ='
ignore_errors: yes
- name: Reload of xinetd services
service:
name: xinetd
state: reloaded
Any ideas on how to achieve this.
Thanks in advance.
Regards,
Vinod.