описал playbook в ansible
суть playbook'a в изменении конфига rsyslog
- hosts: test
become: yes
tasks:
- name: check all value string
shell: 'grep -ir "^\*.\*\ @*" /etc/rsyslog.conf'
ignore_errors: yes
register: grep_out
- name: check single string
shell: grep -ir '^[a-z].*@1.2.3.4:514' /etc/rsyslog.conf
ignore_errors: yes
register: grep_single_out
- name: rem string
shell: sed -i '/^*.*\ @*/ s/^/#/g' /etc/rsyslog.conf
when: grep_out is succeeded
- name: rem single string
shell: sed -i '/*.*\ @1.2.3.4/ s/^/#/g' /etc/rsyslog.conf
when: grep_single_out is succeeded
- name: change conf
lineinfile:
dest: /etc/rsyslog.conf
line: '*.* @1.2.3.4:514'
notify:
- restart rsyslogd
handlers:
- name: restart rsyslogd
service:
name: rsyslog
state: restarted
[Errno 13] Permission denied: u'/etc/ansible/playbooks/rsyslogd.retry'
проверяю
#df -iTh
Filesystem Type Inodes IUsed IFree IUse% Mounted on
/dev/mapper/rhel-root xfs 41K 39K 2.4K 95% /
.......
#vi /1
E297: Write error in swap file
"/1" [New File]
Press ENTER or type command to continue
#mount
....
/dev/mapper/rhel-root on / type xfs (rw,relatime,attr2,inode64,noquota)
......
#find / -xdev -type f | cut -d "/" -f 2 | sort | uniq -c | sort -n
17 root
331 var
1771 etc
32609 usr