GithubHelp home page GithubHelp logo

eldhodevops / docker-windows-ansible Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 20 KB

Install docker on windows-server using Ansible script and run application via iis webserver

Python 87.43% PowerShell 12.53% HTML 0.03%

docker-windows-ansible's Introduction

docker-windows-ansible

Install docker on windows-server using Ansible script

Docker installation on windows-server and run iis contianer

Prerequisites

Ansible only:

. Ansible 2.5.0+ installed on Ubuntu for Windows (pip installation recommended). . Additional python packages installed for WinRM (follow Ansible Windows Setup Guide). . Windows Server . WinRM properly configured on Windows node.

Ansible usage

Prepare Ansible Host system

  • Setup for ansible host on Ubuntu system ( It can be use your Laptop , do not use Servers)
apt-get update
apt-get -y install software-properties-common
apt-add-repository -y ppa:ansible/ansible
apt-get update
apt-get install -y ansible python-pip
pip install pywinrm

Prepare Windows Node to access Ansible Remotely (On windows server)

  • To use this script to enable https port 5986, run the following in PowerShell:

$url = "https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1"
$file = "$env:temp\ConfigureRemotingForAnsible.ps1"

(New-Object -TypeName System.Net.WebClient).DownloadFile($url, $file)

powershell.exe -ExecutionPolicy ByPass -File $file
winrm enumerate winrm/config/Listener
  • Install chocolatey package manager to avoid error while running ansible-playbook
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

Prepare inventory file

A sample inventory file has been provided in Ansible playbook directory.

your inventory should be defined as:

[node-windows]
#xxserverIPxx windows_node_hostname=xxxxx

Prepare authentication to Node

All the sample files has been provided in Ansible playbook group_var directory. you need to edit with example below

  • Edit windows username and password inside the file group_vars/node-windows.yml
ansible_user: xxusernamexx
# Ensure you don't have ansible_ssh_pass var set in your own group_vars/all.yml, it will overwrite this.
ansible_password: xxpasswordxx
ansible_port: 5986
ansible_connection: winrm
ansible_winrm_transport: ntlm
ansible_winrm_operation_timeout_sec: 120
ansible_winrm_read_timeout_sec: 140
# The following is necessary for Python 2.7.9+ (or any older Python that has backported SSLContext, eg, Python 2.7.5 on RHEL7) when using default WinRM self-signed certificates:
ansible_winrm_server_cert_validation: ignore
ansible_become_user: System
ansible_become_method: runas

Run playbook

ansible-playbook -i inventory/docker.ini install-docker.yml

Run iis contianer

Edit the docker.ini and inventory/group_vars/node-windows.yml with respective login details and IP address

ansible-playbook -i inventory/docker.ini run-docker-windows.yml

You will be able to view contents of index.htm as provided in contents folder, try server IP:8011 to view via browser!!

If you wish to use any other webserer, just edit "run-iis-container/roles/windows/iis/templates/Dockerfile-iis-server.j2" the template and run.

Also please make sure that you have updated the source_path to your local path in "run-iis-container/roles/windows/iis/defaults/main.yml" before run

That's it:)

docker-windows-ansible's People

Contributors

eldhodevops avatar

Stargazers

 avatar

Watchers

James Cloos avatar

Forkers

anuddeeph1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.