Command-line arguments
In this section, you will learn about the use of command-line arguments for playbook execution and how to employ some of the more commonly used ones to your advantage. We are already very familiar with one of these arguments, the --version
switch, which we use to confirm that Ansible is installed (and which version is installed).
Just as we were able to learn about the various configuration parameters directly through Ansible, we can also learn about the command-line arguments. Almost all of the Ansible executables have a --help
option that you can run to display the valid command-line parameters. Let’s try this out now:
- You can view all the options and arguments when you execute the
ansible
command line. Use the following command:$ ansible --help
You will see a great deal of helpful output when you run the preceding command; a snippet of this is shown in the following code block (you might want to pipe this into a pager, such as less
...