added hostname setting
This commit is contained in:
		
							
								
								
									
										16
									
								
								liebchen.yml
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								liebchen.yml
									
									
									
									
									
								
							@@ -184,7 +184,7 @@
 | 
				
			|||||||
  - name: Update default dock confuguration
 | 
					  - name: Update default dock confuguration
 | 
				
			||||||
    command: dconf update
 | 
					    command: dconf update
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  - name: Search for string in file
 | 
					  - name: Search for inventory in file
 | 
				
			||||||
    command:
 | 
					    command:
 | 
				
			||||||
      cmd: grep -oP inventory_number=\\K\\d+ /etc/inventory_number.cmdline
 | 
					      cmd: grep -oP inventory_number=\\K\\d+ /etc/inventory_number.cmdline
 | 
				
			||||||
    register: result
 | 
					    register: result
 | 
				
			||||||
@@ -200,5 +200,19 @@
 | 
				
			|||||||
        {{ result.stdout_lines[0] }}
 | 
					        {{ result.stdout_lines[0] }}
 | 
				
			||||||
    when: result.rc == 0
 | 
					    when: result.rc == 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  - name: Search for hostname in file
 | 
				
			||||||
 | 
					    command:
 | 
				
			||||||
 | 
					      cmd: grep -oP inventory_number=\\K\\w+ /etc/inventory_number.cmdline
 | 
				
			||||||
 | 
					    register: result_hostname
 | 
				
			||||||
 | 
					    # Since it is a reporting task
 | 
				
			||||||
 | 
					    # which needs to deliver a result in any case
 | 
				
			||||||
 | 
					    failed_when: result_hostname.rc != 0 and result_hostname.rc != 1
 | 
				
			||||||
 | 
					    check_mode: false
 | 
				
			||||||
 | 
					    changed_when: false
 | 
				
			||||||
 | 
					  - name: Set hostname
 | 
				
			||||||
 | 
					    command: hostnamectl set-hostname {{ result_hostname.stdout_lines[0] }}
 | 
				
			||||||
 | 
					    when: result_hostname.rc == 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  - name: Enable login screen after install
 | 
					  - name: Enable login screen after install
 | 
				
			||||||
    command: systemctl start systemd-logind.service
 | 
					    command: systemctl start systemd-logind.service
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user