How to on ansible command line options?
-
Here are some common options used on the ansible command line.
--ask-pass or k - prompts for a password, if ssh keys are not being used. In ansible you generally do not want any interaction unless for testing, so ssh key are better.
-f 5 - runs the command on five servers at a time.
Running ansible commands as other users, let's just say it's not root, it's testuser.
--become-user testuser and --ask-become-pass (-K) will prompt for testuser's password.--list-hosts - this is a great option for checking to see which hosts are in a ansible host group name
$ ansible perth --list-hosts hosts (1): ip-xxxx.us-west-2.compute.internal
-v - more verbose
-vvv - even more verbose
© Lightnetics 2024