Hello,
I'm wondering how to specify multiple groups in a Ansible playbook??
I followed the correct syntax but it reports error "skipping: no hosts
matched"
Playbook code is as below:
- name: Install IIS on the newly provisioned Azure Windows Web Servers
hosts: webserver
gather_facts: yes
tasks:
- name: Install IIS (Web-Server and Web-Common-Http)
win_feature:
name:
- Web-Server
- Web-Common-Http
state: present
- name: Install IIS Web-Server with sub features and management tools
win_feature:
name: Web-Server
state: present
include_sub_features: True
include_management_tools: True
register: feature_install
- name: Print variable
debug:
var: feature_install
- name: reboot if installing Web-Server feature requires it
win_reboot:
when: feature_install.reboot_required
- name: Install .Net Framework 3.5 on AOS and Web Servers
hosts: webserver:&aosserver
gather_facts: yes
tasks:
- name: Install .Net Framework 3.5
win_feature:
name: NET-Framework-Features
include_sub_features: True
state: present
register: dotnet35_install
- name: Print variable
debug:
var: dontnet35_install
- name: reboot if installing Web-Server feature requires it
win_reboot:
when: dotnet35_install.reboot_required
- name: Install .Net Framework 4.5 on AOS and Web Servers
hosts: webserver:&aosserver
gather_facts: yes
tasks:
- name: Install .Net Framework 4.5
win_feature:
name: NET-Framework-45-Features
include_sub_features: True
state: present
register: dotnet45_install
- name: Print variable
debug:
var: dontnet45_install
- name: reboot if installing Web-Server feature requires it
win_reboot:
when: dotnet45_install.reboot_required
When I run, the first part of webserver works well, but for aosserver I get
the below error
TASK [reboot if installing Web-Server feature requires it]
***************************************************************************************************************
task path:
/media/sf_C_DRIVE/OnlyOnMyPC/ansible/playbooks.V4/apply-iis.yml:24
skipping: [10.100.3.11] => {
"changed": false,
"skip_reason": "Conditional result was False"
}
skipping: [10.100.3.12] => {
"changed": false,
"skip_reason": "Conditional result was False"
}
META: ran handlers
META: ran handlers
PLAY [Install .Net Framework 3.5 on AOS and Web Servers]
*****************************************************************************************************************
skipping: no hosts matched
PLAY [Install .Net Framework 4.5 on AOS and Web Servers]
*****************************************************************************************************************
skipping: no hosts matched
PLAY RECAP
***************************************************************************************************************************************************************
10.100.3.11 : ok=4 changed=0 unreachable=0 failed=0
10.100.3.12 : ok=4 changed=0 unreachable=0 failed=0
My inventory file is like below
cat inventory/hosts
[aosserver]
10.100.3.4
10.100.3.6
[webserver]
10.100.3.11
10.100.3.12
Wondering what I am doing wrong here?
Kindly assist
Thank you very much.
Kind Regards,
Ameya Agashe
--
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAG9tf-8_gP8tyWNyzXbjzOLWBi_e3L5RE6ewtxwqu6dHDVE5gg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.