| 
									
										
										
										
											2022-10-11 23:51:42 -04:00
										 |  |  | - include_role:
 | 
					
						
							|  |  |  |     name: per_user
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-12 20:16:27 -04:00
										 |  |  | - name: Create ssh directory
 | 
					
						
							|  |  |  |   file:
 | 
					
						
							|  |  |  |     name: "{{ account_homedir.stdout }}/.ssh"
 | 
					
						
							|  |  |  |     state: directory
 | 
					
						
							|  |  |  |     mode: 0700
 | 
					
						
							|  |  |  |     owner: "{{ account_name.stdout }}"
 | 
					
						
							|  |  |  |     group: "{{ group_name.stdout }}"
 | 
					
						
							| 
									
										
										
										
											2022-10-11 23:51:42 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-12 20:16:27 -04:00
										 |  |  | - name: Set authorized keys
 | 
					
						
							|  |  |  |   authorized_key:
 | 
					
						
							|  |  |  |     user: "{{ account_name.stdout }}"
 | 
					
						
							|  |  |  |     key: |
 | 
					
						
							|  |  |  |       {% for user in users[account_name.stdout].authorized_keys %}
 | 
					
						
							|  |  |  |       {{ lookup('file', './files/keys/' + user + '.pub') }}
 | 
					
						
							|  |  |  |       {% endfor %}
 | 
					
						
							|  |  |  |     exclusive: true
 | 
					
						
							|  |  |  |   notify: "restart sshd"
 | 
					
						
							| 
									
										
										
										
											2022-10-11 23:51:42 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | - import_tasks: tasks/peruser_freebsd.yaml
 | 
					
						
							|  |  |  |   when: 'os_flavor == "freebsd"'
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | - import_tasks: tasks/peruser_linux.yaml
 | 
					
						
							|  |  |  |   when: 'os_flavor == "linux"'
 |