Remove packages

Hi,

Is there a way, other that with a bash script, to do this
command please (in Ansible of course.. :slight_smile: )?

$ apt-get remove package*

Thank you,

It is really easy just use apt module with state=absent

http://docs.ansible.com/apt_module.html

$ apt-get remove package*

From http://docs.ansible.com/apt_module.html:

`

Remove “foo” package

  • apt: name=foo state=absent

`

Cheers,
Paul

Thanks but I did see that.

Still it doesn't seem to remove all related packages as the "*"
implies.

For example, I tried to remove apache and all related packages,
and apache2-doc is still installed, as some others.

So 2 solutions : list all packages and remove them one by one, or
the "*" feature in a bash script.

Cheers,

$ apt-get remove package*

Reading a bit more carefully, if your problem is with the glob, maybe try a playbook like this:

`

Thank you, it does the trick. :slight_smile:

Hello,

This works just fine for me:

`

  • name: uninstall apache-related packages
    apt: >
    pkg={{ item }}
    state=absent
    purge=yes
    force=yes
    with_items:
  • apache2*
    sudo: yes

`