Ansible - Debug module

Card Puncher Data Processing

About

debug module

This page is about the debug module, if you have any trouble or error, check the diagnostic page

Example

Ad hoc

With the ansible command line

Example to get the ansible_host value

ansible -i inventory.yml -m debug -a var=ansible_host all

where:

Output:

vps | SUCCESS => {
    "ansible_host": "server01.example.com"
}

One variable

tasks:
    - debug:
        var: test

Several variable

tasks:
    - debug:
        var: item
      with_items: 
        - "{{ var1 }}"
        - "{{ var2 }}"

Message

- name: 'Installation notes'
   vars:
      msg: |
        The installer is installed here:
             /tmp/install.dir.XXXXX/temp.lax
        A silent install command is started you can check it with the following command
            ps -ef | grep -i silent

        Logs can be found at
          * install log: /opt/informatica/1022/Informatica_10.2.2_Services_2019_08_28_15_52_09.log,
          * Console Redirections at install.log,
          * Error log are at /home/infa/silentErrorLog_....

        The silent installation is complete when the ervices_InstallLog<timestamp>.log file is created in the installation directory.

        The whole installation should not take more than 15 minutes.
    debug:
      msg: "{{ msg.split('\n') }}"





Discover More
Card Puncher Data Processing
Ansible - Diaganostic

This page gives information on how to debug a problem (diagnostic) for Ansible. verbosity can be given: at the command line: via the environment variable ANSIBLE_DEBUG=1 to see detailed information...



Share this page:
Follow us:
Task Runner