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

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CADiG6uu-kQHzq4e-2d9%3DzOEnJ9AX%2BwMtXDVHSwUnx6htO2e-gA%40mail.gmail.com.

Reply via email to