battleschool
battleschool copied to clipboard
[feature:mac_pkg] Add Uninstall option, i.e. Remove Installation, aka Make 'Absent' a Mac app.
This is commented very nicely but it tripped me up :). I'll be looking at this a bit, since it's something I'd like. https://github.com/spencergibb/battleschool/search?utf8=✓&q=remove&type=Code https://github.com/spencergibb/battleschool/blob/44d53439400b4078e3041013b1f9ee5995fb33bf/share/library/mac_pkg
// DOC at top of file=
description:
- Installs Mac .pkg or .app files, optionally unarchiving the package first
version_added: "1.1"
options:
state:
description:
- state of the package
choices: [ 'present', 'absent' ]
required: false
default: present
...//ETC
#TODO: implement remove
elif p["state"] in ["absent", "removed"]:
#remove_package(module, pkgutil_path, pkg)
module.fail_json(changed=False, msg="remove package NOT IMPLEMENTED")
Example of a failing play;
$ sudo ansible-playbook -vv -i ~/ansinv -M /usr/share/battleschool/library/ ~/.battleschool/playbooks/adium-uninstall.yml
....
TASK: [un-install Adium] ******************************************************
<localhost> REMOTE_MODULE mac_pkg pkg_type=app url=http://sourceforge.net/projects/adium/files/Adium_1.5.9.dmg/download archive_type=dmg archive_path=Adium.app state=absent
failed: [localhost] => {"failed": true}
msg: value of state must be one of: present,installed, got: absent