Skip to content

Ansible action plugin that automates the installation of prerequisites for Ansible to run on Windows and uses Ansible playbooks for configuration.

Notifications You must be signed in to change notification settings

antnn/win-setup-action-ansible

Repository files navigation

Ansible action plugin

that automates the installation of prerequisites for Ansible to run on Windows and uses Ansible playbooks for configuration.

Run

ansible-playbook example-win7-x64.yml --extra-vars iso_output_path="/path/to/output_config.iso"

then attach it to vm with windows iso

Windows Part

in C#

Define the Playbook Hosts and Connection:

This playbook is designed to automate the setup and configuration of a Windows environment, including downloading necessary updates, installing applications, and creating a bootable ISO with all configurations and drivers pre-included. The playbook is set to run on the local machine (127.0.0.1) with a local connection.

Set Variables:
  • pkg_dir: Directory name where packages will be stored: toinstall.
  • drivers_dir: Directory name for drivers $WinpeDriver$.
Tasks:
  • Create Temporary Work Directory:

  • Create a temporary directory for building the ISO, storing the path in iso_temp_root_build_dir.

  • Create Temp ISO Root Directory:

  • Create a subdirectory named iso within the temporary directory.

  • Creating Base Configuration Files:

  • Use win_setup to create base configuration files for Windows and Ansible, specifying admin and user credentials, and computer name.

  • Define various installation tasks for different updates and packages, each with an index and specific details (e.g., msu, exe, msi).

  • Create Package Directory:

  • Create the directory toinstall within the iso directory.

  • Download Required Packages:

  • Download various Windows updates, OpenSSH, .NET framework, and other necessary files using ansible.builtin.get_url.

  • Download Virtio Drivers:

  • Download Virtio drivers ISO file.

  • Create Drivers Directory:

  • Create the drivers directory.

  • Extract Virtio Drivers:

  • Extract specific Virtio driver files from the downloaded ISO.

  • Create a Windows Config ISO File:

  • Create the final ISO image with Joliet support, including all required files and directories (drivers_dir, pkg_dir, start.ps1, main.cs, install.json, autounattend.xml).

Key Elements:

Variables:

  • Used to simplify paths and maintain consistency.
Modules:
  • ansible.builtin.tempfile: Create temporary files/directories.
  • ansible.builtin.file: Manage file and directory states.
  • win_setup: Specific to Windows setup tasks.
  • ansible.builtin.get_url: Download files from URLs.
  • community.general.iso_extract: Extract files from ISO images.
  • community.general.iso_create: Create ISO images.
Notes:
  • TLS 1.2 Update:
  • A note is included about TLS 1.2 and a specific update (kb3140245).
Windows Configuration:
  • Admin and user credentials are hardcoded (should be changed after installation if necessary).
Installation Tasks:
  • Each installation task is defined with an index, description, type of installer (e.g., msu, exe, msi), and arguments.

This playbook is designed to automate the setup and configuration of a Windows environment, including downloading necessary updates, installing applications, and creating a bootable ISO with all configurations and drivers pre-included.

About

Ansible action plugin that automates the installation of prerequisites for Ansible to run on Windows and uses Ansible playbooks for configuration.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published