Score:-1

why my tasks is skipping when i run ansible playbook

cn flag
- name: get user list from centOs
            ansible.builtin.shell:
                    cmd: cat /etc/passwd
            when: ansible_distribution == "CentOs"
            register: command_output
          - debug:
                  var: command_output.stdout_lines

When I run this playbook it shows like this

TASK [get user list from centOs] ***************************************************************************************************************************************
skipping: []

TASK [debug] ***********************************************************************************************************************************************************
ok: [] => {
    "command_output.stdout_lines": "VARIABLE IS NOT DEFINED!"
}
Score:0
cz flag

Your task is skipped because you specified:

when: ansible_distribution == "CentOs"

This must be a typo. There is no distribution "CentOs" defined. There is a distribution "CentOS". Try that instead.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.