Skip to content

Commit e271b9a

Browse files
committed
fixed group for perunsync
1 parent 45df699 commit e271b9a

File tree

3 files changed

+19
-18
lines changed

3 files changed

+19
-18
lines changed

defaults/main.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,6 @@ perun_msmtp_config: |
710710
perun_sync_enabled: no
711711
perun_sync_users:
712712
- user: perunsync
713-
group: perunsync
714713
comment: Perun-to-Perun synchronization
715714
src_host: idm.ics.muni.cz
716715
ssh_key_file: files/idm.ics.muni.cz/id_rsa.pub

files/perun_sync.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/usr/bin/env python3
2-
import grp
32
import os
4-
import pwd
53
import sys
64
import json
75

8-
DIR = os.getenv('HOME')
6+
DIR = os.getenv('HOME') + "/perun_sync_json"
97
RESOURCE_ATTR_NAME = "urn:perun:resource:attribute-def:def:authorizationResourceId"
8+
os.umask(0o022)
9+
1010

1111
def update_json(data):
1212
for user_uuid, user_data in data["users"].items():
@@ -38,9 +38,6 @@ def replace_files(data):
3838
json.dump(resource_data, tmp_file, indent=4)
3939
tmp_file.flush()
4040
os.fsync(tmp_file.fileno())
41-
# uid = pwd.getpwnam("perunrpc").pw_uid
42-
# gid = grp.getgrnam("perunrpc").gr_gid
43-
# os.chown(f"{filepath}.tmp", uid, gid)
4441
os.replace(f"{filepath}.tmp", f"{filepath}.json")
4542

4643

tasks/perun_sync.yml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,32 @@
2626
group: root
2727
mode: '0755'
2828

29-
- name: "create groups for each source Perun"
30-
loop: "{{ perun_sync_users }}"
29+
- name: "create group perunsync"
3130
group:
32-
name: "{{ item.group }}"
31+
name: perunsync
32+
gid: 959
33+
system: yes
3334

3435
- name: "create users for each source Perun"
3536
loop: "{{ perun_sync_users }}"
3637
user:
3738
name: "{{ item.user }}"
38-
group: "{{ item.group }}"
39+
group: perunsync
3940
comment: "{{ item.comment }}"
4041
shell: /bin/bash
4142
create_home: true
4243

44+
- name: "create directory perun_sync_json in each home"
45+
loop: "{{ perun_sync_users }}"
46+
loop_control:
47+
label: "/home/{{ item.user }}/perun_sync_json"
48+
file:
49+
state: directory
50+
path: "/home/{{ item.user }}/perun_sync_json"
51+
owner: "{{ item.user }}"
52+
group: perunsync
53+
mode: '0755'
54+
4355
- name: "add source Perun's engine ssh keys"
4456
loop: "{{ perun_sync_users }}"
4557
authorized_key:
@@ -60,10 +72,3 @@
6072
systemd:
6173
name: sshd
6274
state: reloaded
63-
64-
- name: "add perunrpc to groups for sync"
65-
loop: "{{ perun_sync_users }}"
66-
user:
67-
name: perunrpc
68-
groups: "{{ item.group }}"
69-
append: true

0 commit comments

Comments
 (0)