i basically want to take dynamic information from my remote host whether in it is redhat or debian, and accordingly execute particular file which would be installing http packages based on os flavour.
[root@ansi1 ansible]# cat include.yml
---
- hosts: all
tasks:
- name: Getting os info
include_vars: "{{ ansible_os_family }}.yml"
- include: setup-RedHat.yml
when: ansible_os_family == 'RedHat'
[root@ansi1 ansible]#
[root@ansi1 ansible]#
[root@ansi1 ansible]#
[root@ansi1 ansible]# cat setup-RedHat.yml
---
- hosts: all
tasks:
- name: htttp install
yum: name=httpd state=present
ansible-playbook include.yml
Error:
ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.
The error appears to have been in '/etc/ansible/setup-RedHat.yml': line 2, column 4, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
---
- hosts: all
^ here
The error appears to have been in '/etc/ansible/setup-RedHat.yml': line 2, column 4, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
---
- hosts: all
^ here