This is exactly what the dynamic inventory is meant for. Basically if queries the aws api to fetch a list of the instances that are up, and provides that as the inventory.
https://docs.ansible.com/ansible/latest/user_guide/intro_dynamic_inventory.html#inventory-script-example-aws-ec2 On Fri, 8 May 2020 at 23:09, Work-Hard <[email protected]> wrote: > Hi Dick, > I just to make sure on your suggestion that I have over 100 hosts that > brought up and down dynamically. My goal is that the tasks should stop > reporting HUGE errors in the output and we save them to be reviewed by > external companies. Is it possible ? > > On Friday, May 8, 2020 at 11:16:31 AM UTC-7, Dick Visser wrote: >> >> You could use the ec2.py dynamic inventory to at least target the >> instances that are powered on. It's more elegant than ignoring errors etc >> >> On Fri, 8 May 2020 at 17:45, Work-Hard <[email protected]> wrote: >> >>> Brian if I remove ignore_unreachable=true. The playbook halts to >>> continue the playbook. >>> >>> >>> >>> >>> On Friday, May 8, 2020 at 7:47:19 AM UTC-7, Brian Coca wrote: >>>> >>>> if you want to stop that ... dont use ignore_unreachable=true, the >>>> 'default' behaviour is to remove the host from play and not try >>>> executing subsequent tasks (that of course fail again). >>>> >>>> >>>> -- >>>> ---------- >>>> Brian Coca >>>> >>>> -- >>> 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/cabf81b2-0451-417e-b108-df53a91f3dff%40googlegroups.com >>> <https://groups.google.com/d/msgid/ansible-project/cabf81b2-0451-417e-b108-df53a91f3dff%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- >> Sent from a mobile device - please excuse the brevity, spelling and >> punctuation. >> > -- > 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/89732f66-d11f-4dab-86b4-c560e035c52a%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/89732f66-d11f-4dab-86b4-c560e035c52a%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Sent from a mobile device - please excuse the brevity, spelling and punctuation. -- 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/CAL8fbwNsEbEj8RR_Hq0en3x-vXEap2oteepmWX6E18JPsEJ7%2BQ%40mail.gmail.com.
