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

141 views
Skip to first unread message

Prasanth S Nair

unread,
Jun 8, 2022, 11:13:00 AM6/8/22
to Ansible Project
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?

Dick Visser

unread,
Jun 8, 2022, 2:58:46 PM6/8/22
to ansible...@googlegroups.com
On Wed, 8 Jun 2022 at 17:13, Prasanth S Nair <shan...@gmail.com> wrote:
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  

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?

--
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 ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/440f9002-5195-43c9-9538-eb2e4fc91bf3n%40googlegroups.com.
--
Sent from Gmail Mobile

Prasanth S Nair

unread,
Jun 9, 2022, 10:14:47 AM6/9/22
to ansible...@googlegroups.com
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


You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/zpA94Hzj92c/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAF8BbLaJX%3Dyb%3DDJTG3S1iPswvDkEMk4A16-dcXgvA7RKuME%2BkQ%40mail.gmail.com.

Prasanth S Nair

unread,
Jun 10, 2022, 4:49:57 AM6/10/22
to ansible...@googlegroups.com
Hi Dick.

I also get the below warning message:

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


Stefan Hornburg (Racke)

unread,
Jun 10, 2022, 4:53:18 AM6/10/22
to ansible...@googlegroups.com
On 10/06/2022 10:49, Prasanth S Nair wrote:
> 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

>
> On Thu, Jun 9, 2022 at 3:14 PM Prasanth S Nair <shan...@gmail.com> wrote:
>
> 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
>
>
> On Wed, Jun 8, 2022 at 7:58 PM Dick Visser <dnmv...@gmail.com> wrote:
>
>
>
> On Wed, 8 Jun 2022 at 17:13, Prasanth S Nair <shan...@gmail.com> wrote:
>
> 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 <http://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
>
> 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?
>
> --
> 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 ansible-proje...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/440f9002-5195-43c9-9538-eb2e4fc91bf3n%40googlegroups.com <https://groups.google.com/d/msgid/ansible-project/440f9002-5195-43c9-9538-eb2e4fc91bf3n%40googlegroups.com?utm_medium=email&utm_source=footer>.
>
> --
> Sent from Gmail Mobile
> --
> You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/zpA94Hzj92c/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAF8BbLaJX%3Dyb%3DDJTG3S1iPswvDkEMk4A16-dcXgvA7RKuME%2BkQ%40mail.gmail.com <https://groups.google.com/d/msgid/ansible-project/CAF8BbLaJX%3Dyb%3DDJTG3S1iPswvDkEMk4A16-dcXgvA7RKuME%2BkQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.
>
> --
> 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 ansible-proje...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAN-bB3Tw_C62h%2BgRDjGN9fpqcUcZisj6XyTBxnvj9YMzO1rrQA%40mail.gmail.com <https://groups.google.com/d/msgid/ansible-project/CAN-bB3Tw_C62h%2BgRDjGN9fpqcUcZisj6XyTBxnvj9YMzO1rrQA%40mail.gmail.com?utm_medium=email&utm_source=footer>.


--
Automation expert - Ansible and friends
Linux administrator & Debian maintainer
Perl Dancer & conference hopper

OpenPGP_signature

Dick Visser

unread,
Jun 10, 2022, 6:14:12 AM6/10/22
to ansible...@googlegroups.com
On Wed, 8 Jun 2022 at 17:13, Prasanth S Nair <shan...@gmail.com> wrote:
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 

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?

--
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 ansible-proje...@googlegroups.com.

Prasanth S Nair

unread,
Jun 10, 2022, 6:40:33 AM6/10/22
to ansible...@googlegroups.com

Stefan Hornburg (Racke)

unread,
Jun 10, 2022, 7:40:53 AM6/10/22
to ansible...@googlegroups.com
On 10/06/2022 12:40, Prasanth S Nair wrote:
> 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

>
> On Fri, Jun 10, 2022 at 9:53 AM Stefan Hornburg (Racke) <ra...@linuxia.de> wrote:
>
>
> On 10/06/2022 10:49, Prasanth S Nair wrote:
> > 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
>
> >
> > On Thu, Jun 9, 2022 at 3:14 PM Prasanth S Nair <shan...@gmail.com> wrote:
> >
> >     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
> >
> >
> >     On Wed, Jun 8, 2022 at 7:58 PM Dick Visser <dnmv...@gmail.com> wrote:
> >
> >
> >
> >         On Wed, 8 Jun 2022 at 17:13, Prasanth S Nair <shan...@gmail.com> wrote:
> >
> >             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 <http://server.example.com> <http://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
> >
> >             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?
> >
> >             --
> >             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 ansible-proje...@googlegroups.com <mailto:ansible-project%2Bunsu...@googlegroups.com>.
> >             To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/440f9002-5195-43c9-9538-eb2e4fc91bf3n%40googlegroups.com <https://groups.google.com/d/msgid/ansible-project/440f9002-5195-43c9-9538-eb2e4fc91bf3n%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/ansible-project/440f9002-5195-43c9-9538-eb2e4fc91bf3n%40googlegroups.com?utm_medium=email&utm_source=footer>>.
> >
> >         --
> >         Sent from Gmail Mobile
> >         --
> >         You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
> >         To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/zpA94Hzj92c/unsubscribe.
> >         To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com <mailto:ansible-project%2Bunsu...@googlegroups.com>.
> >         To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAF8BbLaJX%3Dyb%3DDJTG3S1iPswvDkEMk4A16-dcXgvA7RKuME%2BkQ%40mail.gmail.com <https://groups.google.com/d/msgid/ansible-project/CAF8BbLaJX%3Dyb%3DDJTG3S1iPswvDkEMk4A16-dcXgvA7RKuME%2BkQ%40mail.gmail.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/ansible-project/CAF8BbLaJX%3Dyb%3DDJTG3S1iPswvDkEMk4A16-dcXgvA7RKuME%2BkQ%40mail.gmail.com?utm_medium=email&utm_source=footer>>.
> >
> > --
> > 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 ansible-proje...@googlegroups.com <mailto:ansible-project%2Bunsu...@googlegroups.com>.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAN-bB3Tw_C62h%2BgRDjGN9fpqcUcZisj6XyTBxnvj9YMzO1rrQA%40mail.gmail.com <https://groups.google.com/d/msgid/ansible-project/CAN-bB3Tw_C62h%2BgRDjGN9fpqcUcZisj6XyTBxnvj9YMzO1rrQA%40mail.gmail.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/ansible-project/CAN-bB3Tw_C62h%2BgRDjGN9fpqcUcZisj6XyTBxnvj9YMzO1rrQA%40mail.gmail.com?utm_medium=email&utm_source=footer>>.
>
>
> --
> Automation expert - Ansible and friends
> Linux administrator & Debian maintainer
> Perl Dancer & conference hopper
>
> --
> You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/zpA94Hzj92c/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com <mailto:ansible-project%2Bunsu...@googlegroups.com>.
> --
> 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 ansible-proje...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAN-bB3RviwyXjxw8CWdBtggQHq%2BA98e%3DvhqrMcqv0erD%3Dg9Eag%40mail.gmail.com <https://groups.google.com/d/msgid/ansible-project/CAN-bB3RviwyXjxw8CWdBtggQHq%2BA98e%3DvhqrMcqv0erD%3Dg9Eag%40mail.gmail.com?utm_medium=email&utm_source=footer>.
OpenPGP_signature

Prasanth S Nair

unread,
Jun 13, 2022, 5:08:22 AM6/13/22
to ansible...@googlegroups.com
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

To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/0fd89430-b881-7dfd-950a-9ba7c79275b8%40linuxia.de.
Reply all
Reply to author
Forward
0 new messages