Posts

AWS using Ansible? Yes, it's possible!

  Although, I've used Ansible extensively for a lot of automation and orchestration tasks, using Ansible for AWS was indeed, a new territory for me.  This turned out to be a blessing, since along with using Ansible for AWS tasks, I also learnt how to use WSL (Windows Subsystem for Linux) on a Windows machine. Though WSL's been around for some time, I still hadn't come around to using it since I was mostly using my Macbook pro. Not anymore, though!  Anyway, I have listed below the steps to: Install WSL on Windows 11 23H2 patch Install AWS CLI on Ubuntu 22.04 (Exact version - 22.04.3 LTS) Install Ansible and the amazon.aws collection Use AWS CLI to get the list of  VPCs in the region - us-east-1 (or a region of your choice) Create a python file/script to get the list of VPCs in the region - us-east-1 (or a region of your choice) Create an Ansible playbook to get the list of VPCs in the region - us-east-1 (or a region of your choice.   You may download the complete installat

Fetch Languages and Platforms from MOS Patch Search using WGET

 As promised, I am back to blogging with the script to fetch the languages and platforms and their codes used during patch search/download in My Oracle Support (MOS). This script, again, uses the wget command in order to fetch this data and of course, needs one's MOS' username and password (that gets saved in a wgetrc file) as inputs. You may download the script from git. Here's the usage and the output: $ ./Fetch_Languages_And_Platforms_From_MOS_Patch_Search.sh The executable 'wget' is indeed available in the PATH variable. Proceeding further..... Enter your MOS Username: username@example.com Enter you password: 537P - Acme Packet 1100 529P - Acme Packet 3820 540P - Acme Packet 3900 561P - Acme Packet 3950 530P - Acme Packet 4500 538P - Acme Packet 4600 560P - Acme Packet 4900 534P - Acme Packet 6100 531P - Acme Packet 6300 551P - Acme Packet 6350 527P - Acme Packet OS 512P - Apple iOS 293P - Apple Mac OS X (Intel) (32-bit) 522P - Apple Mac OS X (Intel

Automate MOS Patch Downloads using WGET

Recently, I was searching for a way to completely automate the process of MOS patch downloads when I stumbled upon this blog post - a very well written blog explaining the intricacies of automating patch download from MOS using CURL. This set me thinking if it could be done using WGET command instead of CURL and I found out that it can, indeed, be done. Though the blog post that I have referenced offers a completely automated solution, it uses CURL command beacuse CURL comes installed, by default, with most of the Linux based Docker images, while wget doesn't. Most of the other blog posts that describe patch download using wget, rely on manual authentication with MOS or manually fetching the download URL from MOS. However, I present to you a completely automated way of My Oracle Support Patch Downloads using wget. NOTE: I have assumed the OS to be Linux x86-64 bit and accordingly, hard-coded the platform ID as 226P ( plat_lang=226P ). I plan to publish another blog post det

From unique values of first column, get all the values of the 2nd column and print them in the same line by separating them with commas

The what: I have a file as below: $ cat sample.csv DEPT_ID,EMP_NAME 100,Keshava 100,Madhava 100,Narayana 100,Govinda 100,Vishnu 110,Madhusudana 110,Trivikrama 110,Vamana 110,Shridhara 110,Hrishikesha 110,Padmanabha 120,Damodara 120,Sankashana 120,Vasudeva 120,Pradyumna 130,Aniruddha 130,Purushottama 130,Adhokshaja 130,Narasimha 140,Achyuta 140,Janardana 140,Upendra 140,Hari 140,Krishna  The challenge is to make it look like below: $ cat sample.csv DEPT_ID: EMP_NAME (SEPARATED BY COMMA) 100: Keshava, Madhava, Narayana, Govinda, Vishnu 110: Madhusudana, Trivikrama, Vamana, Shridhara, Hrishikesha, Padmanabha 120: Damodara, Sankashana, Vasudeva, Pradyumna, Aniruddha 130: Purushottama, Adhokshaja, Narasimha 140: Achyuta, Janardana, Upendra, Hari, Krishna The How: Method 1 - Using pure shell commands tail -n +2 sample.csv | cut -d "," -f1 | sort -u | while read dept_id; do emp_names=$(grep "${dept_id}" sample.csv | cut -d "," -f2 | tr '\n' '

Read a file and extract specific lines using Native Ansible Modules

I never realised that reading a file on a remote host and extracting specific lines from that file would be such an arduous task. As part of one of my projects, I had this requirement and without using "cat" or other shell utilities, it was quite cumbersome to read and extract the information that I was looking for. Read on to find out how it can be done using Ansible native commands. Note that I have suggested only one out of a possible many methods. Feel free to explore yourself and update the comments here! REMOTE FILE CONTENTS $ cat /tmp/IP_and_hostnames.txt $ cat /tmp/IP_and_hostnames.txt 192.168.230.165:example-host-1.example.com 192.168.230.166:example-host-2.example.com 192.168.230.167:example-host-3.example.com 192.168.230.175:example-host-1-vip.example.com 192.168.230.176:example-host-2-vip.example.com 192.168.230.177:example-host-3-vip.example.com 192.168.230.185:example-host-1-priv.example.com 192.168.230.186:e

Formatting code for blogger

CODE Copy the below code snippet: ------------------------- COPY FROM BELOW ------------------------- <pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%; white-space: pre-wrap;"> <code style="color: black; overflow-wrap: normal; word-wrap: normal;"> INPUT YOUR CODE HERE (SHELL, PYTHON, JAVA etc.,) </code></pre> ------------------------- END OF COPY ------------------------- Shell Command (bash) example: $ sendEmail -t "&lt;TO_EMAIL&gt;" -f "&lt;FROM&gt;" -u "&lt;SUBJECT&gt;" [-cc "&lt;EMAIL_IN_CC&gt;" -bcc "&lt;EMAIL_IN_BCC&gt;"] -o message-content-type=html -o message-file="&lt;INPUT_FILE_NAME&gt;" -a "&lt;FILE_TO_BE_ATTACHED&gt;"

SendEmail - the best option for emails on Linux

After any automation or scripting task is complete, I am sure some of them would need to email the output or alert to your mailbox. Linux does provide a few basic tools/utilities to cater to that requirement such as mailx or sendmail. However, their capabilities are limited to sending emails in text. But the need of the hour, if I may say so, is to have formatted emails with tables, highlighting and underlining words, attachments, the whole shebang! In other words, emails should be sent in HTML format which can have all these features and much more.  Though there are methods available to send emails using sendmail or mailx (using uuencode etc.,) they are quite cumbersome and convoluted. That's where "sendemail" utility comes in. It can send html emails so easily and with attachments as well. The software is described as "a lightweight tool written in Perl for sending SMTP email from the console". Some flavours of Linux provide it as a package (like Ubuntu, Kali

Popular posts from this blog

Solution to "End Program - WMS Idle"

Modify retention period of workflow queues

Check if UTL_FILE and FND_FILE are working fine