Skip to content

Instantly share code, notes, and snippets.

@geek182
Created March 2, 2017 20:14
Show Gist options
  • Save geek182/4c4f107bb71d12b01565357c642f4081 to your computer and use it in GitHub Desktop.
Save geek182/4c4f107bb71d12b01565357c642f4081 to your computer and use it in GitHub Desktop.
remove openjdk
---
- name: get output
hosts: localhost
connection: local
tasks:
- name: list installed package
shell: yum list installed "java-*.*.*-openjdk.x86_64"
register: output_yum
- name: only executed if output_yum is true
shell: yum remove -y "java-*.*.*-openjdk.x86_64"
when: output_yum.stdout.find('openjdk') != -1
- debug:
var: output_yum
verbosity: 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment