Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 5970

Ansible code written in YAML format that can be used to remove MySQL and Java from an Ubuntu system?

$
0
0

I have used Ansible YAML code to install MySQL and Java on different servers. However, I now want to remove/uninstall MySQL and Java from those same servers. I have attempted to do so using code, but the software still appears to be running and installed on the target machines.

I have tried below codes.

---- hosts: [dbservers]  become: yes  tasks:    - name: Uninstall MySQL      shell: apt remove mysql-server -y- hosts: [appservers]  become: yes  tasks:    - name: Uninstall java      shell: apt remove openjdk-17-jre -y

&

---- hosts: [dbservers]  become: yes  tasks:    - name: Uninstall MySQL      apt:        name: mysql-server        state: absent- hosts: [appservers]  become: yes  tasks:    - name: Uninstall Java      apt:        name: openjdk-17-jre        state: absent

I'm getting same output for both codes.

PLAY [dbservers] ****************************************************************************TASK [Gathering Facts] **********************************************************************ok: [172.31.81.148]TASK [Uninstall MySQL] **********************************************************************changed: [172.31.81.148]PLAY [appservers] ***************************************************************************TASK [Gathering Facts] **********************************************************************ok: [172.31.26.22]TASK [Uninstall java] ***********************************************************************changed: [172.31.26.22]PLAY RECAP **********************************************************************************172.31.26.22               : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0172.31.81.148              : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0ubuntu@ip-172-31-19-201:~/AnsibleCodes$

Anyone have working(correct) YAML code for this?


Viewing all articles
Browse latest Browse all 5970

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>