Activity 1: Lets install Java 11 (openjdk 11)
- Our desired state is to install java 11
- The target os is ubuntu 20.04
- Manual Steps:
- Refer Here for the steps
- Commands
sudo apt update
sudo apt install openjdk-11-jdk
- Lets verify if the manual steps are working correctly or not
- Lets create a virtual machine
- Ensure the manual steps are working
- Please follow the classroom recordings for creating vm and verifying the manual steps
- In Ansible to automate the manual steps, we have two approaches
- Adhoc command: We execute the automation by building a command
ansible -i inventory -m ping all
- Playbook:
- We describe our desired state as a Playbook in a YAML File
- As of now our playbook can be defined as collection of tasks, In Ansible to execute a task we use Ansible Modules.
- Ansible module is the smallest unit of ansible where we can express our desired state.
- Structure:
“`yaml
</ul>
<hr />
<ul>
<li>name: <description>
hosts: <hosts from inventory>
become: <yes/no>
tasks:<ul>
<li>name: <description of individual step>
<module>:
<parameter-1-name>: <parameter-1-value>
..
<parameter-n-name>: <parameter-n-value></li>
</ul>
</li>
<li>“` - For running the playbook we use the command
ansible-playbook
- Adhoc command: We execute the automation by building a command
apt in ansible
to find the right module Refer Here

