I want to delete below environment variables from etc/environment using Ansible.
export http_proxy="http://194.138.0.25:9400/"
export https_proxy="http://194.138.0.25:9400/"
export ftp_proxy="http://194.138.0.25:9400/"
Below code deletes only one env variable.
name: Delete variables from etc/environment
replace: path: /etc/environment regexp: 'export http_proxy="http://194.138.0.25:9400/"' replace: ''
- How to delete all the 3 environment variables?
- After deleting/replacing any one env variable, empty line is being added. how to avoid this?
lineinfilewithstate: absentwhich is better suited for your purpose.