<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Omar Mochtar on Medium]]></title>
        <description><![CDATA[Stories by Omar Mochtar on Medium]]></description>
        <link>https://medium.com/@iomarmochtar?source=rss-498e5d146b2c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*aXRl_koLx_pbGI5nXxQgWw.jpeg</url>
            <title>Stories by Omar Mochtar on Medium</title>
            <link>https://medium.com/@iomarmochtar?source=rss-498e5d146b2c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 19:30:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@iomarmochtar/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Test Ansible Role to Internal GCP Without Direct Access and Dedicated CI Runner]]></title>
            <link>https://medium.com/@iomarmochtar/test-ansible-role-to-internal-gcp-without-direct-access-and-dedicated-ci-runner-d4a6f7ff0a47?source=rss-498e5d146b2c------2</link>
            <guid isPermaLink="false">https://medium.com/p/d4a6f7ff0a47</guid>
            <category><![CDATA[ansible]]></category>
            <category><![CDATA[identity-aware-proxy]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[ansible-molecule]]></category>
            <category><![CDATA[software-testing]]></category>
            <dc:creator><![CDATA[Omar Mochtar]]></dc:creator>
            <pubDate>Thu, 13 Nov 2025 16:47:19 GMT</pubDate>
            <atom:updated>2025-11-13T17:06:42.095Z</atom:updated>
            <content:encoded><![CDATA[<p>This is to share my experience in providing a <strong>custom solution</strong> in by extending <a href="https://github.com/ansible-community/molecule-plugins/tree/main/src/molecule_plugins/gce">molecule-plugin GCE</a> to test the Ansible role inside a Github repository. if you are very technical can just jump to <a href="https://github.com/iomarmochtar/sample-ansible-role-test-through-iap">the sample repo</a></p><p><strong>Note</strong>: As per this post written, these are the version involved. let me know in the comment if it’s not working in the upper version.</p><p>CLI Program:</p><pre>python==3.11<br>gcloud==529.0.0</pre><p>Python Libs:</p><pre>ansible==11.3.0<br>molecule==25.9.0<br>molecule-plugins[gce]==25.8.12<br>pytest-testinfra==10.2.2</pre><h3>Problem Statement</h3><p>these are the conditions and the chain of my thinking to understand the root problem:</p><ul><li>The test will be done inside CI pipeline on PR stage by utilizing <a href="https://github.com/features/actions">Github Action</a> as the executor</li><li>For some (limited) conditions, using a dedicated self hosted runner is not possible. clue: <strong>cost</strong> &amp; <strong>maintainability</strong></li><li>To ensure The Ansible Roles will be ran as expected, it’s must use the real <a href="https://cloud.google.com/products/compute">GCE</a> instance as the target and it’s available <a href="https://github.com/ansible-community/molecule-plugins/tree/main/src/molecule_plugins/gce">Molecule as a plugin</a></li><li>There will be no public access attached on the ephemeral GCE instance (Linux OS) that spawned by molecule steps</li><li>As the solution for the previous point, <a href="https://docs.cloud.google.com/iap/docs/using-tcp-forwarding">Identity Aware Proxy (IAP) tunneling</a> comes as potential one</li><li>[OOT] Since it will be executed with a <a href="https://docs.cloud.google.com/iam/docs/service-account-overview">Service Account</a>, there will be no any key generated (<a href="https://docs.cloud.google.com/iam/docs/best-practices-for-managing-service-account-keys#alternatives">see it’s best practice</a>). so it will be used <a href="https://docs.cloud.google.com/iam/docs/workload-identity-federation">Workload Identity Federation</a> as the alternative</li></ul><p><strong>BUT </strong>turns out it cannot support out of the box by the Molecule GCE plugin directly, since it’s expecting the target instance has a <strong>NAT IP or it’s reachable by internal IP</strong> (<a href="https://github.com/ansible-community/molecule-plugins/blob/a372bd35059a4b1af966339b45258767e4a2d1bc/src/molecule_plugins/gce/playbooks/tasks/create_linux_instance.yml#L61">source</a>)</p><h3>Solution</h3><p>See this design to have a bigger picture of the proposed solution</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*AyeNl0FY3_RyShdw_xFLHg.png" /><figcaption>High Level Design</figcaption></figure><p>As stated in the main problem is that, the limitation is to reach the spawned instance by SSH. that need 2 customized components</p><p><strong>1.</strong>If you read molecule-plugin code, it’s just a matter of extending the create <a href="https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_intro.html">playbook</a>:</p><ul><li><a href="https://github.com/ansible-community/molecule-plugins/blob/f153ae63f659db0071baf7bd5d754ee5ccddbed3/src/molecule_plugins/gce/playbooks/create.yml">src/molecule_plugins/gce/playbooks/create.yml</a></li><li><a href="https://github.com/ansible-community/molecule-plugins/blob/f153ae63f659db0071baf7bd5d754ee5ccddbed3/src/molecule_plugins/gce/playbooks/tasks/create_linux_instance.yml">src/molecule_plugins/gce/playbooks/tasks/create_linux_instance.yml</a></li></ul><p><strong>Note</strong>: as per we use linux instance only, so the final custom playbook will be merged into one instead</p><p><strong>2.</strong> To make molecule and ansible work with the IAP, it’s need some of helper scripts for following purpose:</p><ul><li>proxified the request by utilizing IAP tunneling through <a href="https://docs.cloud.google.com/sdk/gcloud/reference/compute/start-iap-tunnel">gcloud command</a></li><li>delaying the connection until instance’s SSH port can be is reachable, this will be use as the part of create molecule plugin playbook</li></ul><h3>Steps</h3><p>to help you see the bigger picture, this is the repository structure looks alike</p><pre>.<br>├── .github<br>│   └── workflows<br>│       └── ansible_role_test_gce.yml<br>├── demo-role<br>│   ├── molecule<br>│   │   └── default<br>│   │       ├── converge.yml<br>│   │       ├── create.yml -&gt; ../../../helpers/molecule_iap_create.yml<br>│   │       ├── molecule.yml<br>│   │       └── tests<br>│   │           └── test_default.py<br>....<br>├── helpers<br>│   ├── iap_ssh_proxy.sh<br>│   ├── iap_wait_port.py<br>│   └── molecule_iap_create.yml<br>...<br>├── requirements_dev.txt<br>└── requirements.txt</pre><p><strong>note</strong>:</p><ul><li>The sample is for one Ansible role in a repo (<em>demo-role</em>).</li><li>at the repository surface is a simplified Ansible role structure with additional molecule as test executor and scripts to put some helper</li></ul><h4>Create Cloud Resources</h4><p>The high level resources that need to be executed/created on GCP project:</p><ol><li>Enable the required project API(s)</li><li>Ensure to have the dedicated VPC with it’s NAT gateway</li><li><strong>Create Service account</strong>, as the dedicated executor inside pipeline to GCP resources</li><li><strong>Grant service account roles</strong></li><li><strong>Firewall rule</strong>, to allow connection to the target GCE instance</li><li><strong>[Optional] Workload identity federation</strong>, you can read <a href="https://cloud.google.com/blog/products/identity-security/enabling-keyless-authentication-from-github-actions">this post</a> for more detail</li></ol><p><strong>Note:</strong> in the sample repository i have put the sample of Terraform code to automate these by just to run a single command</p><h4>Prepare the Helper Scripts and Custom Molecule Create Playbook</h4><p>Under the hood, these scripts are utilizing gcloud start-iap-tunnel to proxified the request to the target instance. this heavily inspired by the same implementation in <a href="https://github.com/hashicorp/packer-plugin-googlecompute/blob/05a32c9a9b4b7d03a933d2e70649e6f8ce218a3f/builder/googlecompute/step_start_tunnel.go#L272">packer-plugin-googlecompute</a></p><ul><li>helpers<a href="https://github.com/iomarmochtar/sample-ansible-role-test-through-iap/blob/main/helpers/iap_ssh_proxy.sh">/iap_ssh_proxy.sh</a></li><li>helpers<a href="https://github.com/iomarmochtar/sample-ansible-role-test-through-iap/blob/main/helpers/iap_wait_port.py">/iap_wait_port.py</a></li><li><a href="https://github.com/iomarmochtar/sample-ansible-role-test-through-iap/blob/main/helpers/molecule_iap_create.yml">helpers/molecule_iap_create.ym</a>l, this file will be placed inside molecule directory to override the GCE plugin in creating the instance by name create.yml , if you have a lot of roles inside a repo then better to have the single place to store then put as symbolic link in each role’s molecule folders</li></ul><h3>Results</h3><p>You can see the sample of the test pipeline by <a href="https://github.com/iomarmochtar/sample-ansible-role-test-through-iap/pull/1/checks">this PR</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v3KhaaB58fnsAk5EKfJh1Q.png" /></figure><h3>Caveats</h3><p>Since it’s rely on IAP Tunneling, if any case there is a issue or degradation then your test pipeline will have a problem (<a href="https://status.cloud.google.com/incidents/UHoBgMgvvQKa18JQjdbs">sample</a>), but as per my experience it’s very rare (once happen)</p><h3>Summary</h3><ul><li>The beauty of Molecule plugins are open possibility to extend wider custom solution</li><li>by learning on how the other tool (packer) to make a specific approach then translate and adjust it to our case will make us unstoppable</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d4a6f7ff0a47" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jurnal Pemasangan Mailman3]]></title>
            <link>https://medium.com/@iomarmochtar/jurnal-pemasangan-mailman3-360e737c4215?source=rss-498e5d146b2c------2</link>
            <guid isPermaLink="false">https://medium.com/p/360e737c4215</guid>
            <category><![CDATA[mailman3]]></category>
            <category><![CDATA[mailman]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Omar Mochtar]]></dc:creator>
            <pubDate>Fri, 21 Jul 2017 15:00:20 GMT</pubDate>
            <atom:updated>2017-07-21T15:35:51.412Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/244/1*nWxngMUSKsl7JVnqKu3SrQ.png" /></figure><p>Pada beberapa bulan yang lalu salah satu customer zimbra kami memerlukan sistem moderasi untuk Distribution List mereka, namun karena by default pada sistem zimbra fitur ini tidak ada maka opsinya adalah menggunakan aplikasi tambahan, salah satu opsinya adalah <a href="https://www.gnu.org/software/mailman/">Mailman</a>.</p><p>Namun secara pribadi saya tidak suka interface web untuk me-manage mailman versi 2, tidak bagus pada zaman dimana hampir semua web apps minimal menggunakan <a href="http://getbootstrap.com/">bootstrap</a>. Meskipun sudah banyak sekali panduan pemasangannya di internet beserta dengan integrasinya dengan zimbra. Bagi yang belum pernah melihat tampilan mailman2 bisa dilihat pada gambar berikut ini.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*GcGWkDdX8a76l6rSuomYrg.png" /><figcaption>Contoh tampilan dari web admin mailman2</figcaption></figure><p>Singkat cerita pada saat saya melihat disitus mailman sendiri sudah terdapat versi 3 dimana layanannya sudah dipisah ke beberapa bagian yaitu:</p><ul><li><strong>Core</strong>, Inti dari mailman3 untuk milis engine. yang menariknya adalah terdapat rest api dan shell/console, dari 2 fitur itu menjadi point plus besar untuk saya.</li><li><strong>Postorius, </strong>web management untuk mailman3. secara konsep postorius pure berkomunikasi via rest api mailman3 core, sehingga secara proof of concept bisa jadi rujukan jika ingin membuat UI mailman3 sendiri.</li><li><strong>Hyperkitty</strong>, web management dan engine untuk layanan arsip email milis.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lkVkpc_DO-d56sCUY_4fng.png" /><figcaption>Cuplikan gambar untuk postorius</figcaption></figure><p>Catatan: Mailman3 core menggunakan python versi 3 sedangkan Postorius dan Hyperkitty menggunakan versi 2 dalam bentuk <a href="https://www.djangoproject.com/">Django</a> App dimana point plus lainnya bagi saya karena bisa digabung dalam satu Django Project yang sama.</p><p>Secara pemasangan jika ingin menggunakan dalam satu server yang sama tantangannya adalah multiversi python (3 dan 2.7) dimana Centos yang (masih) sering sekarang saya gunakan adalah 6.X dengan bawaan versi python-nya 2.6</p><p>Beruntungnya pada saat yang sama saya lagi “ngoprek” <a href="https://conda.io/">Conda</a>, yaitu environment management untuk beberapa bahasa pemograman popular untuk data scientist sehingga sangat memudahkan pemasangan multiversi python dalam satu OS.</p><p>Singkat cerita, karena sempat merasakan susahnya pemasangan mailman3 secara langsung via dokumentasinya dimana <a href="https://gitlab.com/mailman/mailman-bundler">mailman3-bundler</a> sudah usang (obsolete) saya membuatkan script untuk otomatis pemasangan mailman3 dan Django Project untuk postorius+hyperkitty. Didesain untuk Centos atau turunan redhat lainnya. pada Centos sudah ditesting di versi 6.9 dan 7.</p><p>Panduan pemasangannya bisa dilihat <a href="https://iomarmochtar.wordpress.com/2017/07/21/mailman3-easy-installation/">disini</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=360e737c4215" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>