Browse Source

Create nodepool_user_home_mode variable

and default the value to 0755.

Change-Id: I2d5374c49d682a0e8b565e61d280e73fc4619863
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
Paul Belanger 8 months ago
parent
commit
28721e46e4
3 changed files with 10 additions and 3 deletions
  1. 1
    0
      defaults/main.yaml
  2. 1
    1
      molecule/tests/test_role.py
  3. 8
    2
      tasks/pre.yaml

+ 1
- 0
defaults/main.yaml View File

@@ -23,6 +23,7 @@ nodepool_task_manager:
23 23
 nodepool_user_name: nodepool
24 24
 nodepool_user_group: nodepool
25 25
 nodepool_user_home: /var/lib/nodepool
26
+nodepool_user_home_mode: 0755
26 27
 # nodepool_user_shell:
27 28
 
28 29
 nodepool_file_nodepool_yaml_dest: /etc/nodepool/nodepool.yaml

+ 1
- 1
molecule/tests/test_role.py View File

@@ -27,7 +27,7 @@ def test_nodepool_user(host):
27 27
     assert f.is_directory
28 28
     assert f.user == 'nodepool'
29 29
     assert f.group == 'nodepool'
30
-    # TODO(pabelanger): Validate mode
30
+    assert f.mode == 0o755
31 31
 
32 32
 
33 33
 def test_nodepool_config(host):

+ 8
- 2
tasks/pre.yaml View File

@@ -12,12 +12,12 @@
12 12
 # License for the specific language governing permissions and limitations
13 13
 # under the License.
14 14
 ---
15
-- name: Create group account.
15
+- name: Create group account
16 16
   become: true
17 17
   group:
18 18
     name: "{{ nodepool_user_group }}"
19 19
 
20
-- name: Create user account.
20
+- name: Create user account
21 21
   become: true
22 22
   user:
23 23
     createhome: true
@@ -25,3 +25,9 @@
25 25
     home: "{{ nodepool_user_home }}"
26 26
     name: "{{ nodepool_user_name }}"
27 27
     shell: "{{ nodepool_user_shell|default(omit) }}"
28
+
29
+- name: Set permissions on home directory
30
+  become: true
31
+  file:
32
+    path: "{{ nodepool_user_home }}"
33
+    mode: "{{ nodepool_user_home_mode }}"

Loading…
Cancel
Save