AnsiblePilot — Ansible Automation Platform and Enterprise Ansible

AnsiblePilot covers Red Hat Ansible Automation Platform (AAP) and enterprise Ansible: install and upgrade paths, Event-Driven Ansible, security and day-2 operations, plus Luca Berton's books, videos and training.

Popular Topics

About Luca Berton

Luca Berton is an Ansible automation expert, author of 9 technical books published by Apress and Leanpub, 4 of them on Ansible, including "Ansible for VMware by Examples" and "Ansible for Kubernetes by Example", and creator of the Ansible Pilot YouTube channel. He shares practical automation knowledge through tutorials, books, and video courses to help IT professionals and DevOps engineers master infrastructure automation.

Ansible: Audit Post-Quantum Readiness After the NSA Advisory (SSH, TLS, OpenSSL)

By Luca Berton · Published 2026-12-05 · Category: troubleshooting

The NSA asked for an immediate post-quantum transition on 2 December 2026. Audit OpenSSH, OpenSSL and TLS endpoints for ML-KEM support with one Ansible playbook.

On 2 December 2026 the NSA advised the operators of US National Security Systems to "immediately accelerate" their transition to post-quantum cryptography (PQC). The same day Amazon, Anthropic, Apple, Cloudflare, Google, Microsoft, OpenAI and Oracle asked organizations, in a joint statement, "to accelerate the migration as soon as possible".

The first question for an operations team is simple: where are we today? This tutorial answers it with one read-only Ansible playbook.

The News in Four Lines

  • Why now: the NSA said frontier AI companies disclosed recent discoveries that affect some cryptography in use today. The details are not public.
  • Separately: on 30 November Anthropic published four papers. An internal Claude model found a theoretical attack on the lattice math behind ML-KEM and ML-DSA. Anthropic and independent reviewers say it has no practical effect on today's systems (The Next Web).
  • Threat level: ONCD, NSA and CISA say the advances "do not present an immediate and widespread threat".
  • Real risk: "harvest now, decrypt later". Traffic recorded today can be decrypted when a large quantum computer exists.

What the Playbook Checks

CheckWhy it matters
OpenSSH version9.9 added mlkem768x25519-sha256; 10.0 uses it by default
SSH key exchange algorithmsShows if a hybrid post-quantum algorithm is available
OpenSSL version3.5 and later support ML-KEM and ML-DSA
TLS endpointsShows if a service accepts the X25519MLKEM768 hybrid group
The playbook does not change a host. You can run it against production.

See also: Ansible for Post-Quantum Cryptography: Migrate TLS, SSH & PKI (2026 Guide)

The Audit Playbook

---
- name: Audit post-quantum readiness
  hosts: all
  gather_facts: false
  vars:
    pqc_tls_endpoints: []   # for example: ["localhost:443"]

  tasks:
    - name: Read the OpenSSH version
      ansible.builtin.command: ssh -V
      register: ssh_version
      changed_when: false

    - name: List the supported SSH key exchange algorithms
      ansible.builtin.command: ssh -Q kex
      register: ssh_kex
      changed_when: false

    - name: Read the effective sshd configuration
      ansible.builtin.command: sshd -T
      register: sshd_effective
      changed_when: false
      become: true

    - name: Read the OpenSSL version
      ansible.builtin.command: openssl version
      register: openssl_version
      changed_when: false

    - name: Test each TLS endpoint with the hybrid group
      ansible.builtin.shell: >
        openssl s_client -connect {{ item }} -groups X25519MLKEM768
        </dev/null 2>&1
      loop: "{{ pqc_tls_endpoints }}"
      register: tls_probe
      changed_when: false
      failed_when: false

    - name: Build the result for this host
      ansible.builtin.set_fact:
        pqc_report:
          openssh: "{{ ssh_version.stderr | default(ssh_version.stdout) }}"
          ssh_client_has_mlkem: "{{ 'mlkem768x25519-sha256' in ssh_kex.stdout }}"
          sshd_offers_mlkem: >-
            {{ sshd_effective.stdout_lines
               | select('match', '^kexalgorithms ')
               | select('search', 'mlkem768x25519-sha256')
               | list | length > 0 }}
          openssl: "{{ openssl_version.stdout }}"
          tls_endpoints_ok: >-
            {{ tls_probe.results | selectattr('rc', 'equalto', 0)
               | map(attribute='item') | list }}
          tls_endpoints_failed: >-
            {{ tls_probe.results | rejectattr('rc', 'equalto', 0)
               | map(attribute='item') | list }}

    - name: Show the result
      ansible.builtin.debug:
        var: pqc_report

Run it:

ansible-playbook -i inventory pqc-audit.yml
ansible-playbook -i inventory pqc-audit.yml -e '{"pqc_tls_endpoints": ["localhost:443"]}'

Notes:

  • ssh -V prints to standard error, so the playbook reads stderr first.
  • The TLS test needs OpenSSL 3.5 or later on the host that runs it. With an older OpenSSL the command fails because the group name is unknown, and the endpoint appears in tls_endpoints_failed. Read the OpenSSL version in the same report before you draw a conclusion.

Save One Report for the Fleet

Add a final play that writes one CSV file on the control node:

- name: Write the fleet report
  hosts: localhost
  gather_facts: false
  tasks:
    - name: Write the CSV file
      ansible.builtin.copy:
        dest: ./pqc-report.csv
        mode: "0644"
        content: |
          host,openssh,ssh_client_has_mlkem,sshd_offers_mlkem,openssl
          {% for h in groups['all'] if hostvars[h].pqc_report is defined %}
          {{ h }},"{{ hostvars[h].pqc_report.openssh }}",{{ hostvars[h].pqc_report.ssh_client_has_mlkem }},{{ hostvars[h].pqc_report.sshd_offers_mlkem }},"{{ hostvars[h].pqc_report.openssl }}"
          {% endfor %}

How to Read the Result

ResultNext step
sshd_offers_mlkem: trueSSH key exchange is ready on this host
sshd_offers_mlkem: false, OpenSSH below 9.9Plan the operating system upgrade
sshd_offers_mlkem: false, OpenSSH 9.9Add the algorithm to KexAlgorithms, or upgrade to 10.0
OpenSSL below 3.5TLS services that use the system library cannot offer ML-KEM yet
Endpoint in tls_endpoints_failedCheck the server software and its TLS library
Sort the hosts by the data they protect. Systems that carry long-lived secrets over public networks go first.

See also: Ansible for AI Security: Protect Models, APIs & Data Pipelines (2026 Guide)

Keep Hybrid Mode

Both mlkem768x25519-sha256 and X25519MLKEM768 are hybrid: a classical algorithm and a post-quantum algorithm together. An attacker must break both. The Anthropic result is theoretical, but it is one more reason to keep the classical part.

Next Step

When you know where the gaps are, the configuration work starts. The Ansible for Post-Quantum Cryptography guide covers the SSH, TLS and PKI changes.

Category: troubleshooting

Browse all Ansible tutorials · AnsiblePilot Home