Commit 0460704a authored by Reimar Stier's avatar Reimar Stier

Add path /opt/bin to environment

parent 9a6c8228
......@@ -9,3 +9,21 @@
service: name="gdm" state="restarted"
when: _shell_output.changed
- name: Define paths to be added
set_fact:
environment_file: "/etc/environment"
environment_path_add: "/opt/bin/"
- name: Check if path in environment
shell: "grep '/opt/bin/' {{ environment_file }}"
register: _environment_check
failed_when: false
changed_when: false
- name: Ensure path is added to environment
lineinfile:
path: "{{ environment_file }}"
regexp: '^PATH="(.*)"$'
line: 'PATH="{{ environment_path_add }}:\1"'
backrefs: yes
when: _environment_check.rc != 0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment