exclude host in ansible adhoc command 1

exclude host in ansible adhoc command

# Adhoc command. A \ is requred before the !
ansible my_group:\!single_server -m shell -a "docker ps"

Here is what the above code is Doing:
1. We’re using the ansible command to run a command on the my_group group.
2. We’re using the -m flag to specify the module we want to use. In this case, we’re using the shell module.
3. We’re using the -a flag to specify the command we want to run. In this case, we’re running the docker ps command.

Similar Posts