Good day.

I want tp parse root's history to return the last occurrence of yum update 
that includes the string "disablerepo". I would have thought that this 
would work:











*---- hosts: all  gather_facts: false  become: yes  tasks:    - name: Get 
last yum update which includes "disablerepo"      shell: 'history | grep -m 
1 disablerepo'      register: out*

but, I get this error:













*fatal: [myhost1]: FAILED! => changed=true  ansible_facts:    
discovered_interpreter_python: /usr/bin/python3  cmd: history | grep -m 1 
disablerepo  delta: '0:00:00.013135'  end: '2024-03-21 09:54:12.391498'  
msg: non-zero return code  rc: 1  start: '2024-03-21 09:54:12.378363'  
stderr: ''  stderr_lines: <omitted>  stdout: ''  stdout_lines: <omitted>*

The command "history | grep -m 1 disablerepo" works fine at the command 
line. I've tried every manner of escaping characters and changing the 
command itself, but get errors regardless. How can I get the desired 
results?

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1d4dfd6c-913a-4360-a204-5a1ad6644109n%40googlegroups.com.

Reply via email to