Ansible playbook to remove a rpm package

937 views
Skip to first unread message

Swordfish Binary

unread,
Apr 23, 2021, 10:18:46 AM4/23/21
to ansibl...@googlegroups.com

I am trying to remove a rpm package using ansible playbook. I tried to do as shown below but its not working. Any idea how this rpm package can be removed. Note: This rpm package is not present in yum

 ---
- hosts: all
  gather_facts: false
  become: true
  tasks:
    - name: stop rscd server
      systemd:
        state: stopped
        name: rscd
      register: output
      notify:
        - remove rscd

  handlers:
    - name: remove rscd
      shell: rpm -e '{{ item }}'

The above playbook when I run it runs but it just stops the process alone but never removes the package. Any idea what I am doing wrong?

Warron French

unread,
Apr 23, 2021, 2:27:21 PM4/23/21
to Ansible Development
Does the package have any dependencies that are also required by other packages?

Have you attempted and rpm -e rscd from the cli on the machine in question.  I always prototype my scripts and programs on the cli to ensure their is a strong potential for a successful execution of whatever I am doing.

Frank Dias

unread,
Apr 27, 2021, 12:33:13 PM4/27/21
to Warron French, Ansible Development
Your handler is references an item but you do not list the item

--
You received this message because you are subscribed to the Google Groups "Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-deve...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-devel/204ecfb2-e700-413a-adcc-6d8b02cbcf08n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages