File tree 3 files changed +16
-5
lines changed
3 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,9 @@ $ git clone https://github.com/weareinteractive/ansible-environment.git franklin
33
33
34
34
Here is a list of all the default variables for this role, which are also available in ` defaults/main.yml ` .
35
35
36
+ environment_file: /etc/environment
37
+ environment_config:
38
+
36
39
```
37
40
# environment_config:
38
41
# LC_ALL: en_US.UTF-8
@@ -48,10 +51,13 @@ environment_config:
48
51
roles:
49
52
- franklinkim.environment
50
53
vars:
54
+ environment_file: /some/other/place/.env
51
55
environment_config:
52
56
LC_ALL: C
53
57
```
54
58
59
+ Default is to work on /env/environment.
60
+
55
61
## Testing
56
62
57
63
```
Original file line number Diff line number Diff line change 5
5
# environment_config:
6
6
# LC_ALL: en_US.UTF-8
7
7
#
8
+ environment_file : /etc/environment
8
9
environment_config :
Original file line number Diff line number Diff line change 1
1
---
2
2
3
+ - name : Ensure file exists
4
+ file : path={{environment_file}} owner=www-data group=www-data state=touch
5
+
3
6
- name : Remove previous values
4
7
lineinfile :
5
- dest : /etc/environment
8
+ dest : " {{ environment_file }} "
6
9
regexp : ' ^{{ item.key | upper }}'
7
10
state : absent
8
- with_dict : environment_config
11
+ with_dict : " {{ environment_config}} "
9
12
10
13
- name : Configuring environment
11
14
lineinfile :
12
- dest : /etc/environment
13
- line : ' {{ item.key | upper }}="{{ item.value }}"'
14
- with_dict : environment_config
15
+ dest : " {{ environment_file }}"
16
+ line : " {{ item.key | upper }}='{{ item.value }}'"
17
+ with_dict : " {{environment_config}}"
18
+
You can’t perform that action at this time.
0 commit comments