mirror of
				https://github.com/borgbase/ansible-role-borgbackup.git
				synced 2025-11-04 01:19:32 +01:00 
			
		
		
		
	Switch created to perform the backup as root or service account. If a service account is to be used, it will be created.
This commit is contained in:
		
							parent
							
								
									1a3131cefc
								
							
						
					
					
						commit
						4c2377e188
					
				
							
								
								
									
										20
									
								
								tasks/02_user_management.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								tasks/02_user_management.yml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,20 @@
 | 
				
			|||||||
 | 
					---
 | 
				
			||||||
 | 
					# So in different positions in that role we need the user home
 | 
				
			||||||
 | 
					# Since we cannot be sure that this FSH is compatible we will determine it.
 | 
				
			||||||
 | 
					- name: Get home if borgbackup_user == "root"
 | 
				
			||||||
 | 
					  when: borgbackup_user == "root"
 | 
				
			||||||
 | 
					  ansible.builtin.user:
 | 
				
			||||||
 | 
					    name: "{{ borgbackup_user }}"
 | 
				
			||||||
 | 
					    state: present
 | 
				
			||||||
 | 
					  register: user_info
 | 
				
			||||||
 | 
					  changed_when: false
 | 
				
			||||||
 | 
					  check_mode: true  # Important, otherwise user will be created
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- name: Save the user_info, we need them for the home_dir
 | 
				
			||||||
 | 
					  ansible.builtin.set_fact:
 | 
				
			||||||
 | 
					    backup_user_info: "{{ user_info }}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- name: Create User if borgbackup_user != "root"
 | 
				
			||||||
 | 
					  ansible.builtin.include_tasks:
 | 
				
			||||||
 | 
					    file: noauto_create_backup_user_and_group.yml
 | 
				
			||||||
 | 
					...
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user