1
0

Move user-level environment variables

This commit is contained in:
Anton Vakhrushev 2017-12-24 18:12:40 +03:00
parent 8c05f0eb67
commit 9273681092
2 changed files with 16 additions and 2 deletions

View File

@ -23,8 +23,19 @@
with_items: '{{ owner_ssh_keys }}' with_items: '{{ owner_ssh_keys }}'
- name: 'Set up environment variables for {{ owner_name }}.' - name: 'Set up environment variables for {{ owner_name }}.'
template:
src: envs.j2
dest: '/home/{{ owner_name }}/.envs'
- name: 'Remove environment variables for {{ owner_name }} from bashrc.'
lineinfile: lineinfile:
dest: '/home/{{ owner_name }}/.bashrc' path: '/home/{{ owner_name }}/.bashrc'
regexp: '^export {{ item.key }}=' regexp: '^export {{ item.key }}='
line: 'export {{ item.key }}="{{ item.value }}"' state: absent
with_dict: '{{ owner_envs }}' with_dict: '{{ owner_envs }}'
- name: 'Include environment variables for {{ owner_name }} in bashrc.'
lineinfile:
path: '/home/{{ owner_name }}/.bashrc'
regexp: '^\. ~\/\.envs'
line: '. ~/.envs'

View File

@ -0,0 +1,3 @@
{% for name, value in owner_envs.iteritems() %}
export {{ name }}={{ value }}
{% endfor %}