mirror of
				https://github.com/kevinveenbirkenbach/computer-playbook.git
				synced 2025-11-03 19:58:14 +00:00 
			
		
		
		
	Shorted generic- to gen-
This commit is contained in:
		
							
								
								
									
										23
									
								
								roles/gen-hostname/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								roles/gen-hostname/README.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
			
		||||
# Hostname
 | 
			
		||||
 | 
			
		||||
This Ansible role ensures that the target host’s system hostname is set to the inventory hostname.
 | 
			
		||||
 | 
			
		||||
## Description
 | 
			
		||||
 | 
			
		||||
- Uses the built-in `hostname` module to apply the `inventory_hostname` value  
 | 
			
		||||
- Idempotent: only changes the system name if it differs  
 | 
			
		||||
- No external dependencies
 | 
			
		||||
 | 
			
		||||
## Overview
 | 
			
		||||
 | 
			
		||||
1. **Task**  
 | 
			
		||||
   - `set hostname to {{ inventory_hostname }}`  
 | 
			
		||||
     Applies the desired hostname.
 | 
			
		||||
2. **Module**  
 | 
			
		||||
   - Leverages Ansible’s [`hostname`](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/hostname_module.html) module.
 | 
			
		||||
 | 
			
		||||
## Features
 | 
			
		||||
 | 
			
		||||
* Simple and lightweight
 | 
			
		||||
* Automatically adapts to your inventory names
 | 
			
		||||
* Safe to run repeatedly
 | 
			
		||||
							
								
								
									
										19
									
								
								roles/gen-hostname/meta/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								roles/gen-hostname/meta/main.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
			
		||||
# roles/gen-hostname/meta/main.yml
 | 
			
		||||
---
 | 
			
		||||
galaxy_info:
 | 
			
		||||
  author: "Kevin Veen-Birkenbach"
 | 
			
		||||
  description: "Set the system hostname based on the inventory_hostname"
 | 
			
		||||
  license: "CyMaIS NonCommercial License (CNCL)"
 | 
			
		||||
  license_url: "https://s.veen.world/cncl"
 | 
			
		||||
  company: |
 | 
			
		||||
    Kevin Veen-Birkenbach
 | 
			
		||||
    Consulting & Coaching Solutions
 | 
			
		||||
    https://www.veen.world
 | 
			
		||||
  galaxy_tags:
 | 
			
		||||
    - system
 | 
			
		||||
    - hostname
 | 
			
		||||
  repository: "https://github.com/kevinveenbirkenbach/cymais"
 | 
			
		||||
  issue_tracker_url: "https://github.com/kevinveenbirkenbach/cymais/issues"
 | 
			
		||||
  documentation: "https://github.com/kevinveenbirkenbach/cymais/roles/gen-hostname"
 | 
			
		||||
  run_after: []
 | 
			
		||||
dependencies: []
 | 
			
		||||
							
								
								
									
										3
									
								
								roles/gen-hostname/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								roles/gen-hostname/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
			
		||||
- name: set hostname to {{ inventory_hostname }}
 | 
			
		||||
  hostname:
 | 
			
		||||
    name: "{{ inventory_hostname }}"
 | 
			
		||||
		Reference in New Issue
	
	Block a user