<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>IaC &amp; Automation on Tuna Cinsoy</title><link>https://tunacinsoy.com/areas/iac/</link><description>Recent content in IaC &amp; Automation on Tuna Cinsoy</description><generator>Hugo -- gohugo.io</generator><language>en-gb</language><lastBuildDate>Mon, 24 Aug 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://tunacinsoy.com/areas/iac/index.xml" rel="self" type="application/rss+xml"/><item><title>ServiceNow Automation</title><link>https://tunacinsoy.com/posts/servicenow/</link><pubDate>Mon, 24 Aug 2026 00:00:00 +0000</pubDate><guid>https://tunacinsoy.com/posts/servicenow/</guid><description>&lt;p&gt;&lt;strong&gt;Q) How the background logic of ServiceNow look like?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;ServiceNow is essentially a relational database (MariaDB/MySQL) wrapped in a web interface and business logic engine. Every form you see is simply a UI view representing a row in a table.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Q) What&amp;rsquo;s the difference between playbook and a flow?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Think of a Playbook like a checklist or script for an agent to follow and a Flow like an automated robot running actions in the background based on logic.&lt;/p&gt;</description></item><item><title>Bash</title><link>https://tunacinsoy.com/posts/bash/</link><pubDate>Mon, 27 Apr 2026 00:00:00 +0000</pubDate><guid>https://tunacinsoy.com/posts/bash/</guid><description>&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Find out the public IP address of the originating server.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;curl ifconfig.me
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;hr&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Check the ownership of a folder or a file.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ls -l &amp;lt;folder_path&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;hr&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# List out the filenames that contain searched text, within the current folder.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;grep -rl &lt;span class="s1"&gt;&amp;#39;grep -rl &amp;#39;&lt;/span&gt;&amp;lt;text_that_needs_to_be_replaced&amp;gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt; .
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;hr&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Update given text with the replacement text for all occurrences in file1.txt&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sed -i -e &lt;span class="se"&gt;\ &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;s/&amp;lt;text_that_needs_to_be_replaced/&amp;lt;text_to_replace&amp;gt;/g&amp;#39;&lt;/span&gt; file1.txt
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;hr&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# If we do not know which files contain replacement text -&amp;gt; `grep` searches all of the files for the text, and it does it recursively (`-r`), and outputs only the names of the files that contain the searched text `(-l)`; then `xargs` is used to execute a command from cli; `sed` is used for stream editing, and `-i` flag edits file in place so that they will be updated; and `-e` flag is used to specify the command to be executed. `s/&amp;lt;text_that_needs_to_be_replaced/&amp;lt;text_to_replace&amp;gt;/g&amp;#39;` `s` for substitute. and `g` for replacing all occurrences in each line, not the first line.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;grep -rl &lt;span class="s1"&gt;&amp;#39;&amp;lt;text_that_needs_to_be_replaced&amp;gt;&amp;#39;&lt;/span&gt; . &lt;span class="p"&gt;|&lt;/span&gt; xargs sed -i -e &lt;span class="se"&gt;\ &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;s/&amp;lt;text_that_needs_to_be_replaced/&amp;lt;text_to_replace&amp;gt;/g&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;hr&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# find all files (`-type f`) within the current directory, and for each of them, execute (`-exec`) stream editor (`sed`) command. Within this command, modify files in place (`-i`), and execute the following option after `-e`; `s` stands for substitute, followed by the text to be substituted, and then the substitution text, followed by `g`(all occurrences in each file will be replaced), then `{}` will be filled with the file names that will be found by `find` (so, it will be like `sed -i -e &amp;#39;s/&amp;lt;your_dockerhub_user&amp;gt;/mydockeruser/g&amp;#39; ./file1.txt`).&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;find ./ -type f -exec sed -i -e &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="se"&gt;&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;s/&amp;lt;your_dockerhub_user&amp;gt;/&amp;lt;your actual docker hub user&amp;gt;/g&amp;#39;&lt;/span&gt; &lt;span class="o"&gt;{}&lt;/span&gt; &lt;span class="se"&gt;\;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# OR&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;find ./ -type f &lt;span class="p"&gt;|&lt;/span&gt; xargs sed -i -e &lt;span class="s1"&gt;&amp;#39;s/&amp;lt;your_dockerhub_user&amp;gt;/&amp;lt;your actual docker hub user&amp;gt;/g&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;hr&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# open a picture/image&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;xdg-open &amp;lt;file_name&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;hr&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# List owners and groups of files&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ls -l
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# or with eza&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;eza -lgh
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Change ownership of a file&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo chown newowner:newgroup filename
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;hr&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# find the path to a specific file conveniently.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;find . -name &amp;lt;file_name &lt;span class="s2"&gt;&amp;#34;outputs.tf&amp;#34;&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;hr&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# If `/home/user/projects` does not already exist, the `-p` flag will ensure that `mkdir` creates both `/home/user/projects` and `/home/user/projects/my_project` directories. If any of these directories already exist, they will be left unchanged, and the command will proceed without error.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mkdir -p /home/user/projects/my_project
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;hr&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Return IPv4 records&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dig +short A &amp;lt;domain_name google.com&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Return IPv6 records&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dig +short AAAA &amp;lt;domain_name google.com&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;hr&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# This command searches through the `./manifests/blog-app` directory for lines containing &amp;#34;image:&amp;#34;, extracts the third field from these lines (which is assumed to be the image name or tag), sorts them uniquely by the part before the colon (`:`), and saves the result to the `./images` file.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;grep -ir &lt;span class="s2"&gt;&amp;#34;image:&amp;#34;&lt;/span&gt; ./manifests/blog-app &lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="se"&gt;\ &lt;/span&gt;awk &lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;print $3&amp;#39;&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; sort -t: -u -k1,1 &amp;gt; ./images
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;hr&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# ssh into one of the machines hosted on any platform that has external ip address.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ssh -p &lt;span class="m"&gt;22&lt;/span&gt; &amp;lt;user_name tuna&amp;gt;@&amp;lt;external_ip_address 4.185.25.147&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;hr&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Check who has sudo privileges &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;getent group sudo
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Q) What are the different sections of the manual?&lt;/strong&gt;&lt;/p&gt;</description></item><item><title>Powershell</title><link>https://tunacinsoy.com/posts/powershell/</link><pubDate>Fri, 20 Feb 2026 00:00:00 +0000</pubDate><guid>https://tunacinsoy.com/posts/powershell/</guid><description>&lt;p&gt;&lt;strong&gt;Q) How to test connectivity to a specific endpoint?&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-ps1" data-lang="ps1"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;Test-NetConnection&lt;/span&gt; &lt;span class="n"&gt;-ComputerName&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;&amp;lt;FQDN&amp;gt;&amp;#34;&lt;/span&gt; &lt;span class="n"&gt;-Port&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;PORT&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>Terraform</title><link>https://tunacinsoy.com/posts/terraform/</link><pubDate>Fri, 20 Feb 2026 00:00:00 +0000</pubDate><guid>https://tunacinsoy.com/posts/terraform/</guid><description>&lt;p&gt;&lt;strong&gt;Q) How to reference a module that is stored and released with a tag, in a specific repository in Github?&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-hcl" data-lang="hcl"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;module&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;naming&amp;#34;&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt; source&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt; &amp;#34;git::https://github.com/&amp;lt;ORG_NAME&amp;gt;/&amp;lt;REPO_NAME&amp;gt;.git//terraform/naming?ref&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;naming&lt;/span&gt;&lt;span class="err"&gt;/&lt;/span&gt;&lt;span class="k"&gt;v0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="err"&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="the-divine-trinity"&gt;The Divine Trinity&lt;/h2&gt;
&lt;p&gt;&lt;img src="https://tunacinsoy.com/posts/terraform/terraform-concept.png" alt="alt text"&gt;&lt;/p&gt;
&lt;h3 id="terraform-plan"&gt;terraform plan&lt;/h3&gt;
&lt;p&gt;TL:DR; &lt;strong&gt;What do I need to do to make Actual State match the Desired State?&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Check the desired state&lt;/li&gt;
&lt;li&gt;Check state file (address book) to find out which resources does Terraform manage, see their resource IDs (requires state lock)&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;terraform refresh&lt;/code&gt; to make a call to cloud provider API to check the status of resources in state file&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Create an execution plan based on the delta between desired state and actual state for resources that are listed in state file&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;hr&gt;
&lt;h3 id="terraform-apply"&gt;terraform apply&lt;/h3&gt;
&lt;p&gt;TL:DR; &lt;strong&gt;How do I execute the changes to force Actual State to match the Desired State?&lt;/strong&gt;&lt;/p&gt;</description></item><item><title>Ansible</title><link>https://tunacinsoy.com/posts/ansible/</link><pubDate>Sat, 27 Sep 2025 00:00:00 +0000</pubDate><guid>https://tunacinsoy.com/posts/ansible/</guid><description>&lt;p&gt;&lt;strong&gt;Q) What is Ansible?&lt;/strong&gt;&lt;br&gt;
Ansible is a configuration management tool that follows Configuration-as-Code (CaC) principle. It uses ssh to communicate with managed nodes, thus we do not need to install agents on these nodes. The architecture of Ansible contains control node, and managed nodes. Control node must have Ansible installed, and the managed nodes should allow SSH connection that is coming from control node. The architecture can be seen down below.
&lt;img src="https://tunacinsoy.com/posts/ansible/ansible-arch.png" alt="ansible-architecture"&gt;&lt;/p&gt;</description></item></channel></rss>