Not sure how to fix this

19 views
Skip to first unread message

Jerry Eidson

unread,
Aug 29, 2017, 1:11:22 PM8/29/17
to Ansible Project
Hello All,

I've been working with Ansible a few weeks. I am trying to create a list of yum file updates. I ordinarily run
"sudo yum update --assume --changelog | tee /tmp/hostname | cut -d'.' -f1`.txt"
to get the update list created in the tmp directory.

In the play book I have this:
- name: create yum update list on server
    command: yum update --assumeno --changelog | tee /tmp/`hostname | cut -d'.' -f1`.txt


Partial output i get is:
fatal: [rvavpmgt02.asd.local]: FAILED! => {"changed": true, "cmd": ["yum", "update", "--assumeno", "--changelog", "|", "tee", "/tmp/`hostname", "|", "cut", "-d.", "-f1`.txt"], "delta": "0:00:00.115751", "end": "2017-08-29 13:06:19.590748", "failed": true, "rc": 1, "start": "2017-08-29 13:06:19.474997", "stderr": "CRITICAL:yum.cli:Command line error: option -d: invalid integer value: '.'", "stderr_lines": ["CRITICAL:yum.cli:Command line error: option -d: invalid integer value: '.'"], "stdout": "Usage: yum [options] COMMAND\n\nList of Commands:\n\ncheck

I've have tried surrounding the command with double and have also tried singe quotes to no avail. Not sure how to format.

Any Advice?

Thanks,

- jerry

Jerry Eidson

unread,
Aug 29, 2017, 1:27:31 PM8/29/17
to Ansible Project
Nevermind. I used shell: instead of command: and it runs.
Reply all
Reply to author
Forward
0 new messages