diff --git a/examples/playbooks/rule-command-instead-of-module-pass.yml b/examples/playbooks/rule-command-instead-of-module-pass.yml index ef08ce3412..535117433a 100644 --- a/examples/playbooks/rule-command-instead-of-module-pass.yml +++ b/examples/playbooks/rule-command-instead-of-module-pass.yml @@ -26,6 +26,14 @@ ansible.builtin.command: systemctl show-environment changed_when: false + - name: Set systemd environment + ansible.builtin.command: systemctl set-environment MYSQLD_OPTS="--skip-grant-tables" + changed_when: false + + - name: Unset systemd environment + ansible.builtin.command: systemctl unset-environment MYSQLD_OPTS + changed_when: false + - name: Get systemd runlevel ansible.builtin.command: systemctl get-default changed_when: false diff --git a/src/ansiblelint/rules/command_instead_of_module.py b/src/ansiblelint/rules/command_instead_of_module.py index af6cda3c05..e7e9378c33 100644 --- a/src/ansiblelint/rules/command_instead_of_module.py +++ b/src/ansiblelint/rules/command_instead_of_module.py @@ -76,6 +76,8 @@ class CommandsInsteadOfModulesRule(AnsibleLintRule): "kill", "set-default", "set-property", + "set-environment", + "unset-environment", "show-environment", "status", "reset-failed",