Member-only story

Three options to Safely Limit Ansible Playbooks Execution to a Single Machine

Three options to limit the execution of a potentially harmful Ansible Playbook to only one host.

Luca Berton
5 min readMar 31, 2022

Three options to Safely Limit Ansible Playbooks Execution to a Single Machine.

Today we’re going to talk about the three options to limit the execution of a potentially harmful Ansible Playbook to only one host.

I’m Luca Berton and welcome to today’s episode of Ansible Pilot.

Limit Ansible Playbook to only one HOSTNAME

  • use `--limit` at runtime
  • `hosts: HOSTNAME` Ansible Playbook
  • `hosts: “{{ HOSTS }}”` Ansible Playbook

Let’s deep dive into our use case to Limit Ansible Playbook to only one HOSTNAME.

I’m going to show three different ways to achieve this result:

using the `--limit` parameter at runtime, limit the HOSTNAME in the Playbook code and the most advanced way is to define a variable in the Ansible Playbook that you could populate on-demand.

--

--

Luca Berton
Luca Berton

Written by Luca Berton

I help creative Automation DevOps, Cloud Engineer, System Administrator, and IT Professional to succeed with Ansible Technology to automate more things everyday

No responses yet