Posts

Showing posts from August, 2023

Redis user permissions (ACL) and python connection

 Recently, I was working on setting up a redis cluster along with separate users for readwrite and readonly. I setup the readonly user using the below privileges (ACLs):   user redisreadonly on >mySuperSecretPassword ~* resetchannels -@all +@read +ping +asking   Once this is setup, I wrote a simple program in python to connect to the redis cluster using the readonly credentials and print the number of keys.   #!/usr/bin/env python3 """ pip3 install redis """ from redis.cluster import RedisCluster, ClusterNode # ─────── Cluster connection ─────── startup_nodes = [ ClusterNode("redis_host_1", 6379), ClusterNode("redis_host_2", 6379), ClusterNode("redis_host_3", 6379) ] rc = RedisCluster(startup_nodes=startup_nodes,decode_responses=True,username='redisreadonly',password='mySuperSecretPassw...

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...

Popular posts from this blog

Interesting Oracle Applications (EBS) Interview Questions

Modify retention period of workflow queues

Check if UTL_FILE and FND_FILE are working fine