Skip to content

fendi-321/Devops-ansible-playbook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dockerized Ansible Playbook for Windows Configuration

This project containerizes the Ansible playbook for configuring Windows servers using Docker.

Prerequisites

  • Docker installed on your system
  • Docker Compose installed
  • Access to Windows servers with WinRM enabled

Project Structure

.
├── Dockerfile              # Docker image definition
├── docker-compose.yml      # Docker Compose configuration
├── test-ansible.yml        # Ansible playbook
├── inventory.ini           # Ansible inventory file
├── vaults/                 # Directory for vault files
│   └── windows-password.yml
└── README.md              # This file

Setup Instructions

1. Create the vaults directory and password file

mkdir -p vaults

Create vaults/windows-password.yml with your credentials:

ansible_user: "YourWindowsUsername"
ansible_password: "YourWindowsPassword"

2. Update the inventory file

Edit inventory.ini to add your Windows servers:

[windows]
windows-server ansible_host=192.168.1.100

3. Build the Docker image

docker build -t ansible-windows .

4. Run the playbook

Option A: Using Docker Compose

docker-compose up

Option B: Using Docker directly

docker run --rm -v "%cd%\test-ansible.yml:/ansible/playbooks/test-ansible.yml" -v "%cd%\inventory.ini:/ansible/inventory.ini" -v "%cd%\vaults:/etc/ansible/vaults" --network host ansible-windows ansible-playbook -i /ansible/inventory.ini test-ansible.yml

Option C: Interactive shell for debugging

docker run -it --rm -v "%cd%\test-ansible.yml:/ansible/playbooks/test-ansible.yml" -v "%cd%\inventory.ini:/ansible/inventory.ini" -v "%cd%\vaults:/etc/ansible/vaults" --network host ansible-windows /bin/bash

What the Playbook Does

  1. Installs pywinrm on localhost
  2. Configures WinRM connection parameters
  3. Downloads KcsSetup.exe from the specified URL
  4. Installs the package on Windows Server

Customization

  • Update the package URL in test-ansible.yml (line with url: http://10.22.21.172:8081/share/KcsSetup.exe)
  • Modify WinRM settings if needed
  • Add more Windows servers to inventory.ini

Troubleshooting

  • Ensure WinRM is enabled on target Windows servers
  • Verify network connectivity to Windows servers
  • Check that credentials in vault file are correct
  • For WinRM port issues, ensure port 5986 is accessible

About

windows docker for localhost

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors