Websitecreation playbook

27 views
Skip to first unread message

rubod singh

unread,
Sep 24, 2020, 7:57:16 AM9/24/20
to ansible...@googlegroups.com
HI Team,

can someone share or point me to a playbook that can be used to create
the iis websites dynamically on windows.

i have this currently that i found on internet but doesnt seem to be working.

---
- hosts: all

vars:
ansible_site_path: C:\inetpub\wwwroot\ansibletest
staging_path: C:\deploy
ansible_test_staging_path: "{{ staging_path
}}\\ansible-test-site-{{ ansible_date_time.year }}{{
ansible_date_time.month }}{{ ansible_date_time.day }}"


tasks:

- name: install-iis
win_feature:
name: "Web-Server"
state: present
restart: no
include_sub_features: yes
include_management_tools: no


- name: create staging path
win_file: path={{ staging_path }} state=directory

- name: default-website-index
win_copy:
src: files/index.html
dest: "C:\\inetpub\\wwwroot\\index.html"

- name: create new website's directory
win_file: path={{ ansible_site_path }} state=directory

- name: create new website
win_iis_website:
name: "Ansible Test Site"
state: started
port: 8080
physical_path: "{{ ansible_site_path }}"

- name: Open site's port on firewall
win_firewall_rule:
name: mysite8080
enable: yes
state: present
localport: 8080
action: Allow
direction: In
protocol: Tcp
force: true
tags: firewall

- name: create deploy staging path
win_file: path={{ ansible_test_staging_path }} state=directory

- name: get code to deploy staging path
win_copy:
src: files/site.zip
dest: "{{ ansible_test_staging_path }}"

- name: unzip code to site path
win_unzip:
src: "{{ ansible_test_staging_path }}\\site.zip"
dest: "{{ ansible_site_path }}"
creates: "{{ ansible_site_path }}\\index.html"

tags: unzip
Reply all
Reply to author
Forward
0 new messages