DEV Community

Cover image for Day 87: A Redirected Module and a Renamed Publisher
Nnamdi Felix Ibe
Nnamdi Felix Ibe

Posted on AI-assisted

Day 87: A Redirected Module and a Renamed Publisher

Practical tips on handling hidden system names

Day 87 of DevOps, Day 37 of Azure. Both tasks today turned on a name that is not the name the system uses.

An Ansible task that says yum runs the dnf module, because the first is now a redirect to the second. And an Azure image "published by Jetware" is published by jetware-srl, which no amount of guessing gets you to.

One Ansible task, one Azure task. Install and start a service on three servers, then put MySQL on a VM and prove a PHP page can reach it. The tasks come from the KodeKloud Engineer platform.

Task 1: Install vsftpd and start it

The task: a playbook that installs vsftpd on all three app servers and starts it.

Step 1: Check it isn't there

[tony@stapp01 ~]$ sudo systemctl status vsftpd
Unit vsftpd.service could not be found.
Enter fullscreen mode Exit fullscreen mode

Same discipline as the last batch, and it is what makes changed: [stapp01] mean "installed" rather than "already fine".

Step 2: The playbook

---
- hosts: all
  become: yes

  tasks:
    - name: Install vsftpd package.
      yum:
        name: vsftpd
        state: present
    - name: Starting the vsftpd service.
      service:
        name: vsftpd
        state: started
        enabled: yes
Enter fullscreen mode Exit fullscreen mode
stapp01 : ok=3  changed=2   stapp02 : ok=3  changed=2   stapp03 : ok=3  changed=2
Enter fullscreen mode Exit fullscreen mode

Both modules are idempotent, so a second run reports changed=0. Which, after Day 84's state: touch reporting a change forever, is worth saying out loud: package and service describe a desired state, and a system already in that state needs no action.

enabled: yes alongside state: started is two separate claims, and the verification shows both:

     Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled; preset: d>
     Active: active (running) since Sat 2026-05-23 14:43:50 UTC; 11s ago
Enter fullscreen mode Exit fullscreen mode

enabled in the first line means it comes back after a reboot. active (running) in the second means it is up now. Day 23 made the same point about systemctl enable --now.

Step 3: The task says yum and the module is dnf

ansible.builtin.yum's documentation page now says one thing: "This is a redirect to the ansible.builtin.dnf module."

So what executes is dnf. The task name says yum, the playbook says yum, and the module doing the work is the dnf module. Which is correct for these servers, because Day 71 established the app servers are CentOS Stream 9, where dnf is the package manager and yum is a compatibility name.

Three things follow, and they pull in different directions.

The playbook is right as written. The redirect handles it, and nothing needs changing.

It is misleading to read. Anyone debugging this is reading dnf's documentation whether they know it or not, and the two modules' parameters have not always matched.

And it is not portable. Both yum and dnf commit the playbook to the RHEL family. ansible.builtin.package dispatches to whatever the target actually uses, so the same playbook runs on Debian hosts too.

What the docs recommend

For a lab that names yum, yum is the right answer. For anything meant to outlive one distribution, package is the module that does not need rewriting later.

One other thing worth recording, and it is mildly annoying. The inventory for this task has ansible_ssh_pass back in it, for all three hosts, in plain text. Day 82's whole task was removing exactly those, and Ansible's documentation says of ansible_password, "never store this variable in plain text; always use a vault."

Each lab starts fresh, so the plain-text passwords come back with it. The fix has to be redone every time, which is a reasonable description of security work generally.

Task 2: MySQL on one VM, PHP on another

The task: a VM from a marketplace Percona image in Central US, a PHP VM in East US, and a page that connects across.

Step 1: The publisher is not the brand

The task said "published by Jetware".

az vm image list --all --publisher jetware --location centralus
(empty)
Enter fullscreen mode Exit fullscreen mode

What I found was searching on a fragment rather than guessing the whole thing:

az vm image list-publishers --location centralus --query "[?contains(name,'etware')].name" -o tsv
Enter fullscreen mode Exit fullscreen mode

etware, without the leading letter, because marketplace publisher names are inconsistently capitalised and both spellings are plausible. The answer is jetware-srl.

Image identity is a four-part URN, and none of the parts are derivable from the product name:

jetware-srl : percona_mysql : percona_mysql57-ubuntu-1604 : 1.0.170503
publisher   : offer         : sku                         : version
Enter fullscreen mode Exit fullscreen mode

Day 3 found the same for Canonical's Ubuntu offers, where the lesson was that offer names cannot be guessed. Here the publisher cannot either.

Which is this morning's Ansible finding wearing different clothes. A module called yum is a redirect to one called dnf. A product called Jetware is published by jetware-srl. Both times the name you are handed is not the name the system uses, and both times the cost of assuming is one lookup you did not do.

Worth noting the image is from December 2017, on Ubuntu 16.04, with Percona 5.7.17. Marketplace images are frozen at publication, and this one has had no updates in nine years. Fine for a lab, a supply-chain problem anywhere else.

Step 2: A denial that told me nothing

az vm image terms accept --urn $URN
(AuthorizationFailed) ... does not have authorization to perform action
'...agreements/read'
Enter fullscreen mode Exit fullscreen mode

Marketplace images carry legal terms that must be accepted per subscription before deployment, and the lab identity cannot read or accept them.

The tempting conclusion is that the image cannot be deployed. That does not follow. The denial is on reading the agreement, which says nothing about whether the agreement is already accepted. My permission to query a setting and the setting's value are independent facts.

So I tried the create anyway, and it worked. The terms were already accepted for the subscription.

This is the mirror of my Day 31 mistake, where a quota error left its Location field blank and I concluded the limit was subscription-wide. Same error, opposite direction: an error about your ability to observe something is not evidence about the thing itself. Attempt the operation when it fails safely.

Step 3: Three gates, checked separately

Password authentication means no SSH key, so every in-guest operation went through Run Command, which runs as root and returns synchronously.

A remote MySQL connection has three gates, and all three failures look alike from the PHP side:

Gate Check Result
Azure network az network nsg rule list open-port-3306 at 1010
MySQL user host SELECT user,host FROM mysql.user xfusion_user / %
MySQL bind address SHOW VARIABLES LIKE 'bind_address' *

The bind address is the one most worth checking, because MySQL defaults to 127.0.0.1 in many distributions, and a localhost-only bind defeats a correct NSG rule and a correct % host with nothing to indicate why. This image binds to *.

Checking all three before touching the PHP file meant a later failure could only be the PHP file.

What the docs recommend

Two techniques from this task I would reuse, and one thing the task asks for that production should not.

Base64 for awkward payloads. The SQL contains nested quotes and has to survive the local shell, the Run Command transport and the remote shell:

export SQL_B64=$(printf '%s\n' "CREATE USER ... '%' ..." | base64 -w 0)
az vm run-command invoke ... --scripts "echo $SQL_B64 | base64 -d > /tmp/s.sql; /jet/enter mysql < /tmp/s.sql"
Enter fullscreen mode Exit fullscreen mode

Base64 output is only A-Za-z0-9+/=, none of which any shell reinterprets. The quoting problem is sidestepped rather than solved, which is better.

And probing an unfamiliar wrapper before scripting against it. /jet/enter mysql is a Jetware convention and I had no idea whether it took -e:

ls -la /jet
head -20 /jet/enter
/jet/enter mysql -e "SELECT VERSION();"
Enter fullscreen mode Exit fullscreen mode

Three cheap commands in one call, answering "does this work" and "if not, what next" at the same time. It turned out to be exec /jet/own/bin/run "$@", a thin wrapper that passes everything through.

The thing production would not do is the architecture:

PHP (eastus)  --public internet-->  MySQL (centralus, port 3306)
Enter fullscreen mode Exit fullscreen mode

MySQL's wire protocol is not encrypted by default, so credentials cross the internet in the clear. az vm open-port with no source restriction opens 3306 to 0.0.0.0/0, defended by password123. And every query pays cross-region latency for no benefit.

The real shape is both VMs in peered VNets talking over private IPs, the NSG rule scoped to the peer's address space, TLS on the connection, and credentials from Key Vault instead of literals in a PHP file. Or Azure Database for MySQL with a private endpoint and no VM at all.

What I learned

Two names, neither of which was the name.

yum is the more interesting one because it is invisible. The playbook works, the output is clean, and the module that ran is not the one written in the file. You only find out by reading a documentation page that contains a single sentence.

jetware-srl is the louder version. An empty result from a search is at least a signal that something is wrong, and the fix was searching a fragment instead of a guess.

The one I would take into real work is the denial. An AuthorizationFailed on reading the marketplace agreement looks like a wall, and all it says is that I cannot see the answer. The answer happened to be yes. Twice now in this series I have reasoned from the absence of information as though it were information, and twice the one command I had already written would have settled it.

So here is the Day 87 question. What have you concluded recently from an error that only told you what you were not allowed to look at?

Day 87 down. Thirteen to go.

Top comments (8)

Collapse
 
timmyzinin profile image
Tim Zinin •

The yum to dnf redirect is a good example of a name that stays readable while the implementation changes. Do you log the resolved module during runs, or rely on the collection documentation when reviewing the playbook later?

Collapse
 
ndcodes profile image
Nnamdi Felix Ibe •

Honestly, I do neither🙃

The resolution isn't just prose, though. ansible-core carries a routing table at lib/ansible/config/ansible_builtin_runtime.yml, and the entry is literally yum: redirect: ansible.builtin.dnf. So reviewing it is a grep against the version you're running compared to a memory test.

Which has a consequence I'd missed: that file ships with ansible-core, not with my repo. The thing deciding which module my playbook executes is pinned by my core version, and an upgrade can change it without the playbook changing.

I think -vvv also prints the module file path, making it visible per run, but I haven't confirmed the wording, so I'd check that before relying on it.

I really do appreciate your comment. Thank you, and I hope I answered your question.

Collapse
 
timmyzinin profile image
Tim Zinin •

That distinction is helpful: the redirect is versioned with ansible-core, so a documentation check alone is not enough for reproducibility. I like the idea of checking lib/ansible/config/ansible_builtin_runtime.yml on the target core and using -vvv only after verifying the exact output on that version. That makes the resolved implementation inspectable without changing the playbook just for logging.

Thread Thread
 
ndcodes profile image
Nnamdi Felix Ibe •

Exactly that. The routing table is the inspectable version, and the playbook stays as it is. Worth adding that ansible_pkg_mgr in gathered facts shows which backend the package module would pick, which is adjacent but not the same question as whether yum redirected.

Collapse
 
timmyzinin profile image
Tim Zinin •

Your AuthorizationFailed example is a useful reminder that a read denial and the underlying state are separate facts. I have found the same distinction important when a source returns 403 or times out: I record it as inaccessible, not missing, so it does not become a false remediation item. Checking the operation when it is safe and reversible is a good way to avoid turning lack of visibility into a wrong conclusion.

Collapse
 
ndcodes profile image
Nnamdi Felix Ibe •

I have noted your comment about recoding it as Inaccessible, not missing. The false remediation item is the real cost, because it looks like work and produces nothing.

Collapse
 
busy_nikita profile image
Nikita •

The through-line of "the name you're handed isn't the name the system uses" is a good frame, and the AuthorizationFailed section is the best part. The distinction between "I can't observe the setting" and "the setting has a value" generalizes well beyond marketplace terms.

I'd add one caveat to "attempt the operation when it fails safely": a failed az vm create isn't always clean. Depending on where it fails, you can be left with an orphaned NIC, public IP, or NSG that you pay for or trip over on the next attempt. Putting the whole thing in a resource group you can delete wholesale makes the attempt much cheaper. A concrete example of the same trap is S3, where a missing key returns 403 instead of 404 if you lack s3:ListBucket. The error conflates "doesn't exist" with "you're not allowed to know."

On the yum/dnf redirect, I agree the invisibility is the real problem. Two notes:

ansible.builtin.package is only portable for the subset of parameters the backends share, and package names themselves still diverge across families (httpd vs apache2, for example). vsftpd happens to be named the same everywhere, which is why it works here, but the portability isn't free in general.
If you do use package, ansible_pkg_mgr in gathered facts tells you which backend it picked, which would have surfaced the dnf answer in the run output without the docs lookup.

The plain-text ansible_ssh_pass coming back every lab is a fair jab at security work in general. If you ever want a muscle-memory version of the fix, ansible-vault encrypt_string for the one variable, or key-based auth, takes about two minutes and you'd stop re-fixing it by hand.

On the three gates, I'd push back slightly on "all three failures look alike from the PHP side." They usually don't if you look at the error code, and that's a useful shortcut:

Timeout (connect hangs): NSG or a guest firewall dropping packets silently.
Connection refused / 2002: nothing listening on that interface, which is the bind_address case.
1130 "Host is not allowed to connect" or 1045 "Access denied": network is fine, and it's the grants or credentials.

So nc -zv 3306 from the PHP VM, followed by the mysql client, narrows it to one gate before you check anything else. It's also worth adding a fourth gate to your table: the guest OS firewall (ufw/iptables), which is a classic fourth silent dropper on older Ubuntu images even when Azure's NSG is wide open.

The base64 trick is neat, but remember it's encoding, not protection. The password and SQL are still readable in shell history and in the Run Command output and activity logs, which is a good reason for the Key Vault note in your production section.

The image-age callout deserves emphasis too. Ubuntu 16.04 reached the end of standard support in 2021 and Percona 5.7 is EOL as well, so this is a lab-only artifact. Your "frozen at publication" framing is exactly right, and it's worth checking publication dates before trusting any marketplace image.

To answer your closing question, mine was a 403 on a CloudFormation stack that turned out to be a missing iam:PassRole. The error read like the resource was off-limits, when it was really that my role couldn't hand off a different role. I lost an hour assuming a bucket policy problem. Looking forward to Days 88 to 100.

Collapse
 
ndcodes profile image
Nnamdi Felix Ibe •

Whoa!! Thanks for comprehensive comment. I ahve noted the pushback.

You're right that the three gates don't look alike, and my sentence was lazy. The error code does distinguish them, and I should have written the table that way round.

One refinement going back the other way, though. For the architecture in this post, PHP in East US reaching MySQL in Central US over TCP, a refused connection gives 2003 rather than 2002. MySQL's client error reference has 2002 as CR_CONNECTION_ERROR, "Can't connect to local MySQL server through socket", and 2003 as CR_CONN_HOST_ERROR, "Can't connect to MySQL server on '%s:%u'". 2002 is the local socket case, which this never is.

The fourth gate is a fair addition and I'd have missed it. This image happened not to have ufw enabled, which is luck rather than design.

On ansible_pkg_mgr you're right that it exists, and I have checked that too. It's a real fact collector in ansible-core. I'd keep one distinction, though. It tells you which backend package would dispatch to on that host, not that my yum task was redirected to dnf. Those agree here and they're answers to different questions, settled by different mechanisms. The redirect lives in the routing table.

The rest I'm simply taking. An orphaned NIC and public IP after a failed create is exactly why "attempt it when it fails safely" needs a disposable resource group attached to it. And base64 being encoding , since the password is in the Run Command output and the activity log either way.

iam:PassRole is a good answer to the closing question. An error that names the wrong resource costs more.

Thank you for taking the time over this.