File tree Expand file tree Collapse file tree 3 files changed +19
-18
lines changed Expand file tree Collapse file tree 3 files changed +19
-18
lines changed Original file line number Diff line number Diff line change @@ -710,7 +710,6 @@ perun_msmtp_config: |
710710perun_sync_enabled : no
711711perun_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
Original file line number Diff line number Diff line change 11#!/usr/bin/env python3
2- import grp
32import os
4- import pwd
53import sys
64import json
75
8- DIR = os .getenv ('HOME' )
6+ DIR = os .getenv ('HOME' ) + "/perun_sync_json"
97RESOURCE_ATTR_NAME = "urn:perun:resource:attribute-def:def:authorizationResourceId"
8+ os .umask (0o022 )
9+
1010
1111def 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
Original file line number Diff line number Diff line change 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 :
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
You can’t perform that action at this time.
0 commit comments