Run Ansible on dynamic hosts

In your playbook server.yml, specify:

hosts: “{{ variable_host | default(‘default_host’)}}”

Then when run, pass extra-vars:

ansible-playbook server.yml –extra-vars “variable_host=newtarget(s)”