# Simple Playbook for Cowsay Galaxy Role Fails

**URL:** <https://forum.ansible.com/t/simple-playbook-for-cowsay-galaxy-role-fails/6684>\
**Category:** Get Help\
**Tags:** galaxy-ng\
**Created:** [June 20, 2024, 1:56pm UTC](https://forum.ansible.com/t/simple-playbook-for-cowsay-galaxy-role-fails/6684 "2024-06-20T13:56:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmennens](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/cmennens/32/3081_2.png) [@cmennens](https://forum.ansible.com/u/cmennens)\
**Post date:** [June 20, 2024, 1:56pm UTC](https://forum.ansible.com/t/simple-playbook-for-cowsay-galaxy-role-fails/6684/1 "2024-06-20T13:56:45Z")

</div>

I downloaded & installed the Galaxy role for cowsay as follows here:

```auto
ansible-galaxy install jsecchiero.cowsay --force
- downloading role 'cowsay', owned by jsecchiero
- downloading role from https://github.com/jsecchiero/ansible-cowsay/archive/master.tar.gz
- extracting jsecchiero.cowsay to /home/cloud-user/.ansible/roles/jsecchiero.cowsay
/usr/lib64/python3.6/tarfile.py:2221: RuntimeWarning: The default behavior of tarfile extraction has been changed to disallow common exploits (including CVE-2007-4559). By default, absolute/parent paths are disallowed and some mode bits are cleared. See https://access.redhat.com/articles/7004769 for more details.
  RuntimeWarning)
- jsecchiero.cowsay (master) was installed successfully

```

Here is my playbook:

````auto
---
- hosts: localhost
  become: yes
  vars_prompt:
    - name: cowsay_say
      prompt: "Enter message"
      private: no
  roles:
    - role: jsecchiero.cowsay
      vars:
        cowsay_say: "{{ cowsay_say }}"```

When I run the playbook, I get the following error:

```TASK [jsecchiero.cowsay : hello world] ***********************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": true, "cmd": "/usr/games/cowsay HELLO WORLD!", "delta": "0:00:00.002728", "end": "2024-06-20 13:49:54.354890", "msg": "non-zero return code", "rc": 127, "start": "2024-06-20 13:49:54.352162", "stderr": "/bin/sh: /usr/games/cowsay: No such file or directory", "stderr_lines": ["/bin/sh: /usr/games/cowsay: No such file or directory"], "stdout": "", "stdout_lines": []}

````

Am I not understanding this galaxy role module? I want to use it with a custom message in my playbook tasks but it’s failing for some odd reason.

---

<div class="post-metadata">

**Author:** ![chris](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chris/32/293_2.png) [@chris](https://forum.ansible.com/u/chris)\
**Post date:** [June 20, 2024, 2:18pm UTC](https://forum.ansible.com/t/simple-playbook-for-cowsay-galaxy-role-fails/6684/2 "2024-06-20T14:18:17Z")

</div>

Is the `cowsay` package installed on the Ansible controller?

Shouldn’t the message be quoted [here](https://github.com/jsecchiero/ansible-cowsay/blob/master/tasks/main.yml#L8C1-L8C40):

```yaml
  shell: "/usr/games/cowsay {{ roar }}"

```

For example:

```yaml
  shell: "/usr/games/cowsay '{{ roar }}'"

```

Note that the [GitHub project](https://github.com/jsecchiero/ansible-cowsay) hasn’t been updated since it was created 5 years ago…

---

<div class="post-metadata">

**Author:** ![Denney-tech](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/denney-tech/32/1556_2.png) [@Denney-tech](https://forum.ansible.com/u/Denney-tech)\
**Post date:** [June 20, 2024, 4:00pm UTC](https://forum.ansible.com/t/simple-playbook-for-cowsay-galaxy-role-fails/6684/3 "2024-06-20T16:00:58Z")

</div>

The error sounds like `/usr/games/cowsay` doesn’t exist, even though the previous step should make sure cowsay is installed. It uses the `package` module to install cowsay, so the role potentially works on any distro, but I think only Ubuntu and other debian based distros install anything to `/usr/games/`. Regardless of what distro you may be using, the `cowsay` binary probably installed somewhere else.

Like @chris said, the role is +5 years old, and you should probably make your own. The owner is fairly active on github though, so you could submit an issue or fork and fix it yourself and send a PR back if you’re feeling up to it.

---

<div class="post-metadata">

**Author:** ![tonk](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/tonk/32/214_2.png) [@tonk](https://forum.ansible.com/u/tonk)\
**Post date:** [June 26, 2024, 6:38am UTC](https://forum.ansible.com/t/simple-playbook-for-cowsay-galaxy-role-fails/6684/4 "2024-06-26T06:38:07Z")

</div>

As RHEL 9 doesn’t have a native Cowsay package I have created a Cowsay lookup plugin and a Cowsay module.

Have a look at: [GitHub - ansilabnl/demo\_one: Demo repository for Ansible training](https://github.com/ansilabnl/demo_one)
