From 21addac5da57ca90480dde7feddbe3e2b0eae412 Mon Sep 17 00:00:00 2001 From: Alicia Cozine <879121+acozine@users.noreply.github.com> Date: Thu, 31 Mar 2022 14:19:21 -0500 Subject: [PATCH] Docs cheatsheet - skeleton and ansible-playbook (#76655) --- docs/docsite/rst/user_guide/cheatsheet.rst | 31 ++++++++++++++++++++++ docs/docsite/rst/user_guide/index.rst | 2 ++ 2 files changed, 33 insertions(+) create mode 100644 docs/docsite/rst/user_guide/cheatsheet.rst diff --git a/docs/docsite/rst/user_guide/cheatsheet.rst b/docs/docsite/rst/user_guide/cheatsheet.rst new file mode 100644 index 00000000000..11acc85f7c6 --- /dev/null +++ b/docs/docsite/rst/user_guide/cheatsheet.rst @@ -0,0 +1,31 @@ +.. _cheatsheet: + +********************** +Ansible CLI cheatsheet +********************** + +This page shows one or more examples of each Ansible command line utility with some common flags added and a link to the full documentation for the command. This page offers a quick reminder of some common use cases only - it may be out of date or incomplete or both. For canonical documentation, follow the links to the CLI pages. + +.. contents:: + :local: + +ansible-playbook +================ + +.. code-block:: bash + + ansible-playbook -i /path/to/my_inventory_file -u my_connection_user -k /path/to/my_ssh_key -f 3 -T 30 -t my_tag -m /path/to/my_modules -b -K my_playbook.yml + +Loads ``my_playbook.yml`` from the current working directory and: + - ``-i`` - uses ``my_inventory_file`` in the path provided for :ref:`inventory ` to match the :ref:`pattern `. + - ``-u`` - connects :ref:`over SSH ` as ``my_connection_user``. + - ``-k`` - uses ``my_ssh_key`` in the path provided for SSH authentication. + - ``-f`` - allocates 3 :ref:`forks `. + - ``-T`` - sets a 30-second timeout. + - ``-t`` - runs only tasks marked with the :ref:`tag ` ``my_tag``. + - ``-m`` - loads :ref:`local modules ` from ``/path/to/my/modules``. + - ``-b`` - executes with elevated privileges (uses :ref:`become `). + - ``-K`` - prompts the user for the become password. + +See :ref:`ansible-playbook` for detailed documentation. + diff --git a/docs/docsite/rst/user_guide/index.rst b/docs/docsite/rst/user_guide/index.rst index 733078e077d..3d162967f1d 100644 --- a/docs/docsite/rst/user_guide/index.rst +++ b/docs/docsite/rst/user_guide/index.rst @@ -22,6 +22,7 @@ Getting started * I'm ready to learn about Ansible. What :ref:`basic_concepts` do I need to learn? * I want to use Ansible without writing a playbook. How do I use :ref:`ad hoc commands `? +* I'm running an Ansible command and forgot which flags to use. Do you have a :ref:`cheatsheet`? Writing tasks, plays, and playbooks =================================== @@ -91,6 +92,7 @@ If you prefer to read the entire User Guide, here's a list of the pages in order :maxdepth: 2 quickstart + cheatsheet basic_concepts intro_getting_started intro_adhoc