mirror of
				https://github.com/kevinveenbirkenbach/computer-playbook.git
				synced 2025-11-04 04:08:15 +00:00 
			
		
		
		
	Renamed desk roles and added vars/main.yml files where mising
This commit is contained in:
		
							
								
								
									
										64
									
								
								cli/ensure_vars_main.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								cli/ensure_vars_main.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,64 @@
 | 
				
			|||||||
 | 
					#!/usr/bin/env python3
 | 
				
			||||||
 | 
					import argparse
 | 
				
			||||||
 | 
					import os
 | 
				
			||||||
 | 
					from pathlib import Path
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def main():
 | 
				
			||||||
 | 
					    parser = argparse.ArgumentParser(
 | 
				
			||||||
 | 
					        description="Generate (or preview) missing vars/main.yml for all roles with a given prefix"
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					    parser.add_argument(
 | 
				
			||||||
 | 
					        "--prefix",
 | 
				
			||||||
 | 
					        required=True,
 | 
				
			||||||
 | 
					        help="Role-name prefix to scan for (e.g. 'desk-')"
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					    parser.add_argument(
 | 
				
			||||||
 | 
					        "--preview",
 | 
				
			||||||
 | 
					        action="store_true",
 | 
				
			||||||
 | 
					        help="If set, only show what would be done without making changes"
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					    args = parser.parse_args()
 | 
				
			||||||
 | 
					    prefix = args.prefix
 | 
				
			||||||
 | 
					    preview = args.preview
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Locate roles/ directory relative to this script
 | 
				
			||||||
 | 
					    script_dir = Path(__file__).resolve().parent
 | 
				
			||||||
 | 
					    roles_dir = (script_dir / "../roles").resolve()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if not roles_dir.is_dir():
 | 
				
			||||||
 | 
					        print(f"Error: roles directory not found at {roles_dir}")
 | 
				
			||||||
 | 
					        return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    missing = []
 | 
				
			||||||
 | 
					    for role in sorted(roles_dir.iterdir()):
 | 
				
			||||||
 | 
					        if not role.is_dir():
 | 
				
			||||||
 | 
					            continue
 | 
				
			||||||
 | 
					        if not role.name.startswith(prefix):
 | 
				
			||||||
 | 
					            continue
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        vars_dir = role / "vars"
 | 
				
			||||||
 | 
					        vars_main = vars_dir / "main.yml"
 | 
				
			||||||
 | 
					        if not vars_main.exists():
 | 
				
			||||||
 | 
					            missing.append((role.name, vars_main))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if not missing:
 | 
				
			||||||
 | 
					        print(f"No missing vars/main.yml files found for prefix '{prefix}'")
 | 
				
			||||||
 | 
					        return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for role_name, vars_main in missing:
 | 
				
			||||||
 | 
					        app_id = role_name[len(prefix):]
 | 
				
			||||||
 | 
					        content = f"application_id: \"{app_id}\"\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if preview:
 | 
				
			||||||
 | 
					            print(f"Would create: {vars_main}")
 | 
				
			||||||
 | 
					            print(f"With content:\n{content}")
 | 
				
			||||||
 | 
					        else:
 | 
				
			||||||
 | 
					            # ensure directory exists
 | 
				
			||||||
 | 
					            vars_main.parent.mkdir(parents=True, exist_ok=True)
 | 
				
			||||||
 | 
					            # write file
 | 
				
			||||||
 | 
					            with open(vars_main, "w") as f:
 | 
				
			||||||
 | 
					                f.write(content)
 | 
				
			||||||
 | 
					            print(f"Created {vars_main}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if __name__ == "__main__":
 | 
				
			||||||
 | 
					    main()
 | 
				
			||||||
@@ -14,7 +14,7 @@ galaxy_info:
 | 
				
			|||||||
    - browser
 | 
					    - browser
 | 
				
			||||||
  repository: "https://github.com/kevinveenbirkenbach/cymais"
 | 
					  repository: "https://github.com/kevinveenbirkenbach/cymais"
 | 
				
			||||||
  issue_tracker_url: "https://github.com/kevinveenbirkenbach/cymais/issues"
 | 
					  issue_tracker_url: "https://github.com/kevinveenbirkenbach/cymais/issues"
 | 
				
			||||||
  documentation: "https://github.com/kevinveenbirkenbach/cymais/tree/main/roles/util-desk-browser-firefox"
 | 
					  documentation: "https://github.com/kevinveenbirkenbach/cymais/tree/main/roles/desk-firefox"
 | 
				
			||||||
  min_ansible_version: "2.9"
 | 
					  min_ansible_version: "2.9"
 | 
				
			||||||
  platforms:
 | 
					  platforms:
 | 
				
			||||||
    - name: Archlinux
 | 
					    - name: Archlinux
 | 
				
			||||||
@@ -6,7 +6,7 @@ This Ansible role serves as a wrapper to install and configure multiple browsers
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
## Overview
 | 
					## Overview
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The **util-desk-browser** role orchestrates the deployment of two specialized roles: **util-desk-browser-chromium** and **util-desk-browser-firefox**. By executing both roles, it provides a unified solution for browser management, making it easier to maintain a secure and consistent browsing environment across your systems.
 | 
					The **util-desk-browser** role orchestrates the deployment of two specialized roles: **desk-chromium** and **desk-firefox**. By executing both roles, it provides a unified solution for browser management, making it easier to maintain a secure and consistent browsing environment across your systems.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Purpose
 | 
					## Purpose
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -34,5 +34,5 @@ galaxy_info:
 | 
				
			|||||||
  issue_tracker_url: https://s.veen.world/cymaisissues
 | 
					  issue_tracker_url: https://s.veen.world/cymaisissues
 | 
				
			||||||
  documentation: https://s.veen.world/cymais
 | 
					  documentation: https://s.veen.world/cymais
 | 
				
			||||||
dependencies:
 | 
					dependencies:
 | 
				
			||||||
  - util-desk-browser-chromium
 | 
					  - desk-chromium
 | 
				
			||||||
  - util-desk-browser-firefox
 | 
					  - desk-firefox
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,7 +18,7 @@ To reduce setup time and ensure consistency across developer workstations, this
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
- **Installs Visual Studio Code:** A powerful code editor with a wide plugin ecosystem.
 | 
					- **Installs Visual Studio Code:** A powerful code editor with a wide plugin ecosystem.
 | 
				
			||||||
- **Extensible Design:** Acts as a base layer for more specific development stacks (e.g., web, Python, embedded).
 | 
					- **Extensible Design:** Acts as a base layer for more specific development stacks (e.g., web, Python, embedded).
 | 
				
			||||||
- **Persona Integration:** Extends the `util-gen-administrator` for technical users with a development focus.
 | 
					- **Persona Integration:** Extends the `util-gen-admin` for technical users with a development focus.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Credits 📝
 | 
					## Credits 📝
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,5 +24,5 @@ galaxy_info:
 | 
				
			|||||||
  issue_tracker_url: https://s.veen.world/cymaisissues
 | 
					  issue_tracker_url: https://s.veen.world/cymaisissues
 | 
				
			||||||
  documentation: https://s.veen.world/cymais
 | 
					  documentation: https://s.veen.world/cymais
 | 
				
			||||||
dependencies:
 | 
					dependencies:
 | 
				
			||||||
  - util-gen-administrator
 | 
					  - util-gen-admin
 | 
				
			||||||
  - pkgmgr
 | 
					  - pkgmgr
 | 
				
			||||||
@@ -8,7 +8,7 @@ Learn more about Linux network tools on the [Arch Wiki - Network Tools](https://
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
## Overview
 | 
					## Overview
 | 
				
			||||||
 | 
					
 | 
				
			||||||
This role enhances the base `util-gen-administrator` role by adding tools specifically for analyzing, debugging, and monitoring network traffic and connectivity.
 | 
					This role enhances the base `util-gen-admin` role by adding tools specifically for analyzing, debugging, and monitoring network traffic and connectivity.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Purpose
 | 
					## Purpose
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -23,4 +23,4 @@ galaxy_info:
 | 
				
			|||||||
  issue_tracker_url: https://s.veen.world/cymaisissues
 | 
					  issue_tracker_url: https://s.veen.world/cymaisissues
 | 
				
			||||||
  documentation: https://s.veen.world/cymais
 | 
					  documentation: https://s.veen.world/cymais
 | 
				
			||||||
dependencies:
 | 
					dependencies:
 | 
				
			||||||
  - util-gen-administrator
 | 
					  - util-gen-admin
 | 
				
			||||||
@@ -5,7 +5,7 @@
 | 
				
			|||||||
  include_role:
 | 
					  include_role:
 | 
				
			||||||
    name: "{{ item }}"
 | 
					    name: "{{ item }}"
 | 
				
			||||||
  loop:
 | 
					  loop:
 | 
				
			||||||
    - util-gen-administrator
 | 
					    - util-gen-admin
 | 
				
			||||||
    - drv-non-free
 | 
					    - drv-non-free
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- name: util-desk-office-tools
 | 
					- name: util-desk-office-tools
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,7 +9,7 @@ ROLES_DIR = Path(__file__).resolve().parent.parent.parent / "roles"
 | 
				
			|||||||
class TestApplicationIdConsistency(unittest.TestCase):
 | 
					class TestApplicationIdConsistency(unittest.TestCase):
 | 
				
			||||||
    def test_application_id_matches_docker_prefix(self):
 | 
					    def test_application_id_matches_docker_prefix(self):
 | 
				
			||||||
        failed_roles = []
 | 
					        failed_roles = []
 | 
				
			||||||
        prefixes = ("web-app-", "web-svc-")
 | 
					        prefixes = ("web-app-", "web-svc-", "desk-")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for role_path in ROLES_DIR.iterdir():
 | 
					        for role_path in ROLES_DIR.iterdir():
 | 
				
			||||||
            if not role_path.is_dir():
 | 
					            if not role_path.is_dir():
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user