In VI we use the / to search for a pattern in the file.
When we use something like ansible-navigator doc ansible.builtin.file it brings you to the page but is there a way to search the doc. For instance for /sym to find info for symlink?
So there are two ways for using ansible-navigator the one method is leveraging the TUI (interactive mode) and the other method is leveraging the CLI (standard mode).
The TUI in interactive mode just brings up the listing of documentation to view the contents and this can be navigated with the arrow keys on the keyboard for scrolling. It does not provide a method to "search" using something like "/" which you can use in editors and things like more/less, etc.
However, it is possible to use the ansible-navigator doc command in the STDOUT mode and the output is redirected to STDOUT for the command line allowing the use of the "/".
[student@workstation ~]$ ansible-navigator doc yum -m stdout
Results
> ANSIBLE.BUILTIN.YUM (/usr/lib/python3.9/site-packages/ansible/modules/yum.> Installs, upgrade, downgrades, removes, and lists packages and groups with the `yum' package manager. This module only works on Python 2. If you require Python 3 support see the [ansible.builtin.dnf] module. ADDED IN: historical * note: This module has a corresponding action plugin. OPTIONS (= is mandatory): - allow_downgrade Specify if the named package and version is allowed to downgrade a maybe already installed higher version of that package. Note that setting allow_downgrade=True can make this module behave in a non-idempotent way. The task could end up with a set of packages that does not match the complete list of specified packages to install (because dependencies between the downgraded package and others can cause changes to the packages which were in the earlier transaction). [Default: no] type: bool /EXAM
So this opens it to where it is able to accept input like "/" to search for something like EXAM to take you to the EXAMPLES section.
EXAMPLES: - name: Install the latest version of Apache ansible.builtin.yum: name: httpd state: latest - name: Install Apache >= 2.4 ansible.builtin.yum: name: httpd>=2.4 state: present - name: Install a list of packages (suitable replacement for 2.11 loop deprecat> ansible.builtin.yum: name: - nginx - postgresql - postgresql-server state: present - name: Install a list of packages with a list variable ansible.builtin.yum: name: "{{ packages }}" vars: :
So it is possible to search, but you need to remember to use STDOUT for ansible-navigator instead of INTERACTIVE mode. This can be done by using -m stdout appended to the end of the command.
So there are two ways for using ansible-navigator the one method is leveraging the TUI (interactive mode) and the other method is leveraging the CLI (standard mode).
The TUI in interactive mode just brings up the listing of documentation to view the contents and this can be navigated with the arrow keys on the keyboard for scrolling. It does not provide a method to "search" using something like "/" which you can use in editors and things like more/less, etc.
However, it is possible to use the ansible-navigator doc command in the STDOUT mode and the output is redirected to STDOUT for the command line allowing the use of the "/".
[student@workstation ~]$ ansible-navigator doc yum -m stdout
Results
> ANSIBLE.BUILTIN.YUM (/usr/lib/python3.9/site-packages/ansible/modules/yum.> Installs, upgrade, downgrades, removes, and lists packages and groups with the `yum' package manager. This module only works on Python 2. If you require Python 3 support see the [ansible.builtin.dnf] module. ADDED IN: historical * note: This module has a corresponding action plugin. OPTIONS (= is mandatory): - allow_downgrade Specify if the named package and version is allowed to downgrade a maybe already installed higher version of that package. Note that setting allow_downgrade=True can make this module behave in a non-idempotent way. The task could end up with a set of packages that does not match the complete list of specified packages to install (because dependencies between the downgraded package and others can cause changes to the packages which were in the earlier transaction). [Default: no] type: bool /EXAM
So this opens it to where it is able to accept input like "/" to search for something like EXAM to take you to the EXAMPLES section.
EXAMPLES: - name: Install the latest version of Apache ansible.builtin.yum: name: httpd state: latest - name: Install Apache >= 2.4 ansible.builtin.yum: name: httpd>=2.4 state: present - name: Install a list of packages (suitable replacement for 2.11 loop deprecat> ansible.builtin.yum: name: - nginx - postgresql - postgresql-server state: present - name: Install a list of packages with a list variable ansible.builtin.yum: name: "{{ packages }}" vars: :
So it is possible to search, but you need to remember to use STDOUT for ansible-navigator instead of INTERACTIVE mode. This can be done by using -m stdout appended to the end of the command.
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.