Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- - name: Replace line in file examples
- hosts: test
- vars:
- strings:
- - 1
- - 0
- tasks:
- - name: Find the files
- become: true
- become_user: root
- ansible.builtin.find:
- paths: /usr/local/apnscp/resources/templates/plans/basic/
- file_type: file
- recurse: yes
- patterns:
- - bandwidth
- - cpu
- - aliases
- - auth
- - billing
- - crontab
- - dns
- - ftp
- - ipinfo6
- - logs
- - metrics
- - mysql
- - rampart
- - siteinfo
- - ssh
- - tomcat
- - vacation
- - apache
- - bandwidth
- - cgroup
- - diskquota
- - files
- - ipinfo
- - logrotate
- - mail
- - mlist
- - pgsql
- - reseller
- - spamfilter
- - ssl
- - users
- use_regex: true
- register: plans
- - name: Replace strings in files found
- ansible.builtin.replace:
- dest: "{{ item.path }}"
- backup: yes
- regexp: '^enabled'
- replace: "enabled {{ strings }}"
- with_items: "{{ my_find.files }}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement