Commit f5996c73 authored by Reimar Stier's avatar Reimar Stier

Fix path in conda installer; update env path

parent 0460704a
......@@ -23,9 +23,10 @@
- name: Add miniconda bin to path
lineinfile:
path: /etc/profile
path: /etc/profile.d/conda.sh
regexp: '^export PATH={{ conda_installer_dir }}/bin:\$PATH$'
line: "export PATH={{ conda_installer_dir }}/bin:$PATH"
create: true
- name: conda - read permission for all
file:
path: "{{ conda_installer_path }}"
......
......@@ -23,5 +23,8 @@
post_tasks:
- import_tasks: tasks/xfce4_configuration.yml
- name: post configuration tasks
block:
- import_tasks: tasks/xfce4_configuration.yml
- import_tasks: tasks/add_path_to_env.yml
tags: desktop_config
- name: Define paths to be added
set_fact:
environment_file: "/etc/environment"
environment_shell_file: "/etc/profile.d/custom.sh"
environment_path_add: "/opt/bin/"
environment_path_default: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
- name: Ensure default path is present in environment
block:
- name: Check default path
shell: "grep -E '^PATH=' {{ environment_file }}"
register: _environment_check
failed_when: false
changed_when: false
- name: Ensure default path is present
lineinfile:
path: "{{ environment_file }}"
regexp: '^PATH=.*'
line: 'PATH="{{ environment_path_default }}"'
create: true
when: _environment_check.rc != 0
- name: Ensure custom path is present in environment
block:
- name: Check custom path
shell: "grep '{{ environment_path_add }}:' {{ environment_file }}"
register: _environment_check
failed_when: false
changed_when: false
- name: Add custom path if not present
lineinfile:
path: "{{ environment_file }}"
regexp: '^PATH="?([^"\n]+)"?$'
line: 'PATH="{{ environment_path_add }}:\1"'
backrefs: true
create: true
when: _environment_check.rc != 0
- name: Add path to shell profile
lineinfile:
path: "{{ environment_shell_file }}"
regexp: '^export PATH={{ environment_path_add }}:\$PATH$'
line: "export PATH={{ environment_path_add }}:$PATH"
create: true
......@@ -9,21 +9,3 @@
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