Skip to content

Commit d626b7b

Browse files
committed
feat: add environment file user and group vars
1 parent a9e39cb commit d626b7b

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

defaults/main.yml

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
# Path to the environment file
44
environment_file: /etc/environment
5+
# The environment file owner
6+
environment_file_owner: root
7+
# The environment file group
8+
environment_file_group: root
59
# A dictionary of config parameters i.e
610
#
711
# environment_config:

tasks/config.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
---
22

33
- name: Ensure file exists
4-
file: path={{environment_file}} owner=www-data group=www-data state=touch
4+
file:
5+
path: "{{ environment_file }}"
6+
owner: "{{ environment_file_owner }}"
7+
group: "{{ environment_file_group }}"
8+
state: touch
59

610
- name: Remove previous values
711
lineinfile:
812
dest: "{{ environment_file }}"
913
regexp: '^{{ item.key | upper }}'
1014
state: absent
11-
with_dict: "{{environment_config}}"
15+
with_dict: "{{ environment_config }}"
1216

1317
- name: Configuring environment
1418
lineinfile:
1519
dest: "{{ environment_file }}"
1620
line: "{{ item.key | upper }}='{{ item.value }}'"
17-
with_dict: "{{environment_config}}"
18-
21+
with_dict: "{{ environment_config }}"

0 commit comments

Comments
 (0)