Sensitive information exposed in Ansible logs

Protect task output from sensitive inputs and results, and review existing logs for exposure.

Description

Tasks that create accounts or change passwords can print sensitive inputs or results to the console. Some modules mask individual fields.

Potential impact

People with access to CI or operational log archives may be able to read credentials they could not otherwise access.

Remediation

Set no_log: true on sensitive tasks and check the run output for secrets. Keep the same values out of separate debug tasks and application logs. Check who can read existing logs and rotate any credentials found there.

Examples

Store and supply app_password securely in the password format the user module requires on the target operating system.

Before

yaml
---
- name: 사용자 생성
  hosts: localhost
  tasks:
    - name: 애플리케이션 계정 생성
      ansible.builtin.user:
        name: app_user
        password: "{{ app_password }}"
      no_log: false

After

yaml
---
- name: 사용자 생성
  hosts: localhost
  tasks:
    - name: 애플리케이션 계정 생성
      ansible.builtin.user:
        name: app_user
        password: "{{ app_password }}"
      no_log: true

The second task suppresses details from account creation. Logs collected before the change still need review.

References