Running Ansible playbook using AWS Systems Manager (skipping: no hosts matched)

Hi All,

I’m not sure this is the right place to ask this question.

I’m trying to run an ansible playbook from Github using AWS Systems Manager. My repo has a hosts (ini format) file as shown below:

[dev] server.example.com

And my playbook looks like below:

— - name: test run

hosts: dev

become: true

When I run the playbook, I get the error below:

PLAY [test run] ******************************************************** skipping: no hosts matched

Any idea why it is not picking up the hosts? Can someone help me to resolve this issue?

Hi All,

I’m not sure this is the right place to ask this question.

I’m trying to run an ansible playbook from Github using AWS Systems Manager. My repo has a hosts (ini format) file as shown below:

[dev] server.example.com

And my playbook looks like below:

— - name: test run

hosts: dev

become: true

This isn’t valid nor complete.
Please provide the entire playbook using a correct formatting

Hi Dick,

Thank you for your reply. This is the Git repo https://github.com/prasanthcambridge/ansible

Basically, I’m running the Ansible playbook from the AWS Systems Manager Console → Run command → AWS-ApplyAnsiblePlaybooks → Specify the Github repo location → Choose the target instances → Run.

It works fine if I change ‘hosts: all’ in the playbook instead of the group name ‘dev’. But, I just only want to run against a group.

Is there anything I’m doing wrong here? I’m very new to Ansible.

Kind regards,
Prasanth

Hi Dick.

I also get the below warning message:

[WARNING]: Could not match supplied host pattern, ignoring: dev

Hi Dick.

I also get the below warning message:

[WARNING]: Could not match supplied host pattern, ignoring: dev

Where did you define that host group?

Regards

         Racke

Hi All,

I’m not sure this is the right place to ask this question.

I’m trying to run an ansible playbook from Github using AWS Systems Manager. My repo has a hosts (ini format) file as shown below:

[dev] server.example.com

This should not be on one line

Hi Racke,

It is defined under hosts file. Please see the links below:

https://github.com/prasanthcambridge/ansible
https://stackoverflow.com/questions/72547240/running-ansible-playbook-using-aws-systems-manager-skipping-no-hosts-matched

Kind regards,
Prasanth

Hi Racke,

It is defined under hosts file. Please see the links below:

https://github.com/prasanthcambridge/ansible
https://stackoverflow.com/questions/72547240/running-ansible-playbook-using-aws-systems-manager-skipping-no-hosts-matched

Kind regards,
Prasanth

Hello Pransath,

you are using -i localhost in the playbook command, maybe that's the problem?

Regards

        Racke

Hi Racke,

Thank you for your reply. Looks like that causes the issue. Let me do some troubleshooting and will get back to you.

Kind regards,
Prasanth