Ansible is open source software that automates software provisioning, configuration management, and application deployment. Ansible connects via SSH, remote PowerShell or via other remote APIs.
In this example, I am using it to install and configure an OL7.5 VM after it was provisioned in OCI.
List the Servers to Configure
$ ansible-playbook generic-server-setup.yml --list-hosts
playbook: generic-server-setup.yml
play #1 (dr-others): dr-others TAGS: []
pattern: [u'dr-others']
hosts (1):
10.201.5.74
List the Tasks to Execute
$ ansible-playbook generic-server-setup.yml --list-tasks
playbook: generic-server-setup.yml
play #1 (dr-others): dr-others TAGS: []
tasks:
oci-console-user : create group TAGS: []
oci-console-user : create user TAGS: []
oci-console-user : create directory TAGS: []
oci-console-user : Set authorized key took from file TAGS: []
oci-console-user : common user alias TAGS: []
oci-console-user : set password TAGS: []
linux_rpms : install RPMs TAGS: [pkgs]
configure_sudoers : put entry in /etc/sudoers TAGS: [osuser]
create_linux_user : create group TAGS: [osuser]
create_linux_user : create user TAGS: [osuser]
create_linux_user : create directory TAGS: [osuser]
create_linux_user : Set authorized key took from file TAGS: [osuser]
create_linux_user : common user alias TAGS: [osuser]
create_linux_user : root alias TAGS: [osuser]
credential-rotation : show file TAGS: [osuser]
credential-rotation : display the result TAGS: [osuser]
credential-rotation : copy credential-rotation.sh TAGS: [osuser]
credential-rotation : run credential-rotation.sh TAGS: [osuser]
dns-disable-ipv6 : put entry in /etc/sysconfig/network TAGS: [dns]
dns-update-search-domains : touch /etc/dhcp/dhclient.conf TAGS: [dns]
dns-update-search-domains : put entry in /etc/dhcp/dhclient.conf TAGS: [dns]
dns-update-search-domains : Update search domains for Phoenix TAGS: [dns]
snmp-setup : put entry in /etc/snmp/snmpd.conf TAGS: [snmp]
snmp-setup : comment out entry in /etc/snmp/snmpd.conf TAGS: [snmp]
snmp-setup : comment out entry in /etc/snmp/snmpd.conf TAGS: [snmp]
snmp-setup : comment out entry in /etc/snmp/snmpd.conf TAGS: [snmp]
snmp-setup : Stop service snmp TAGS: [snmp]
snmp-setup : Start service snmp TAGS: [snmp]
snmp-setup : Enable service snmp TAGS: [snmp]
configure_iscsi : copy iscsiadd.sh TAGS: [iscsi]
configure_iscsi : put line in /etc/rc.local TAGS: [iscsi]
configure_iscsi : make /etc/rc.d/rc.local executable TAGS: [iscsi]
configure_iscsi : show lsblk TAGS: [iscsi]
configure_iscsi : display the disks TAGS: [iscsi]
configure_iscsi : attach the iscsi volumes TAGS: [iscsi]
configure_iscsi : show lsblk TAGS: [iscsi]
timezone : set timezone to {{ time_zone }} TAGS: [tz]
enable-display-back : X11DisplayOffset setting TAGS: [sshd]
enable-display-back : X11UseLocalhost setting TAGS: [sshd]
ntp_config : show file TAGS: [ntp]
ntp_config : display the result TAGS: [ntp]
ntp_config : install RPMs TAGS: [ntp]
ntp_config : copy update-ntp.sh TAGS: [ntp]
ntp_config : run update-ntp.sh TAGS: [ntp]
ntp_config : put entry in /etc/ntp.conf TAGS: [ntp]
ntp_config : put entry in /etc/ntp.conf TAGS: [ntp]
ntp_config : put entry in /etc/ntp.conf TAGS: [ntp]
ntp_config : put entry in /etc/ntp.conf TAGS: [ntp]
ntp_config : put entry in /etc/ntp.conf TAGS: [ntp]
ntp_config : start and enable the NTP service on OL6 TAGS: [ntp]
ntp_config : start and enable the NTP service on OL7 TAGS: [ntp]
ntp_config : stop and disable the chronyd service TAGS: [ntp]
ntp_config : display the ntpq output TAGS: [ntp]
ntp_config : display the result TAGS: [ntp]
reboot_vm : reboot VM TAGS: [reboot_vm]
set_fact TAGS: [reboot_vm]
reboot_vm : wait for server to come down TAGS: [reboot_vm]
reboot_vm : wait for server to come back up TAGS: [reboot_vm]
Run the Ansible playbook
Here is the beginning of the playbook run.

… and here is the end of the playbook run.

Note the ntp_config has “if” logic for different OS version.
Ansible is a versatile tool and easily allows you to automate the configuration of cloud VMs.