mirror of
				https://github.com/kevinveenbirkenbach/computer-playbook.git
				synced 2025-10-31 02:10:05 +00:00 
			
		
		
		
	Added user root
This commit is contained in:
		
							
								
								
									
										26
									
								
								roles/user-root/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								roles/user-root/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,26 @@ | ||||
| - name: Check if the SSH key for root already exists | ||||
|   ansible.builtin.stat: | ||||
|     path: "/root/.ssh/id_rsa.pub" | ||||
|   register: ssh_key | ||||
|  | ||||
| - name: Generate a SSH key for root if it does not exist | ||||
|   ansible.builtin.openssh_keypair: | ||||
|     path: "/root/.ssh/id_rsa" | ||||
|     type: rsa | ||||
|     size: 4096 | ||||
|   when: not ssh_key.stat.exists and run_once_user_administrator is not defined | ||||
|  | ||||
| - name: Display the public SSH key | ||||
|   command: cat /root/.ssh/id_rsa.pub | ||||
|   register: public_key | ||||
|   when: not ssh_key.stat.exists and run_once_user_administrator is not defined | ||||
|  | ||||
| - name: Output the public SSH key | ||||
|   debug: | ||||
|     msg: "{{ public_key.stdout }}" | ||||
|   when: not ssh_key.stat.exists and run_once_user_administrator is not defined | ||||
|  | ||||
| - name: run the user_administrator tasks once | ||||
|   set_fact: | ||||
|     run_once_user_administrator: true | ||||
|   when: run_once_user_administrator is not defined | ||||
		Reference in New Issue
	
	Block a user