Parameterize Windows PSRP inventory settings

This commit is contained in:
Fabio Scotto di Santolo
2026-04-01 17:47:42 +02:00
parent 2782e97f71
commit c2135b66cc
3 changed files with 50 additions and 28 deletions

View File

@@ -1,4 +1,5 @@
---
hostname: deadalus-win
ansible_host: windows-host.example.invalid
ansible_user: your-windows-user
ansible_host: "{{ windows_psrp_host | default(vault_windows_psrp_host | default('')) }}"
ansible_user: "{{ windows_psrp_user | default(vault_windows_psrp_user | default('')) }}"
ansible_password: "{{ windows_psrp_password | default(vault_windows_psrp_password | default('')) }}"

View File

@@ -49,6 +49,23 @@
- hosts: workstation_host_windows
gather_facts: false
pre_tasks:
- name: Load local vault variables when available
tags: [always]
ansible.builtin.include_vars:
file: "{{ playbook_dir }}/../secrets/vault.yml"
when: lookup('ansible.builtin.fileglob', playbook_dir + '/../secrets/vault.yml', errors='ignore') != ''
- name: Ensure Windows PSRP connection settings are defined
tags: [always]
ansible.builtin.assert:
that:
- (ansible_host | default('') | length) > 0
- (ansible_user | default('') | length) > 0
fail_msg: >-
Define windows_psrp_host and windows_psrp_user via extra vars or secrets/vault.yml
before running the workstation_host_windows play.
roles:
- profile_workstation_host_windows