Skip to content

Commit daafa60

Browse files
ziegenbergQalthos
authored andcommitted
fix: add set-environment and unset-environment in executable_options for systemctl
Fixes: #4784 Signed-off-by: Daniel Ziegenberg <[email protected]>
1 parent b294d5b commit daafa60

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

examples/playbooks/rule-command-instead-of-module-pass.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@
2626
ansible.builtin.command: systemctl show-environment
2727
changed_when: false
2828

29+
- name: Set systemd environment
30+
ansible.builtin.command: systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"
31+
changed_when: false
32+
33+
- name: Unset systemd environment
34+
ansible.builtin.command: systemctl unset-environment MYSQLD_OPTS
35+
changed_when: false
36+
2937
- name: Get systemd runlevel
3038
ansible.builtin.command: systemctl get-default
3139
changed_when: false

src/ansiblelint/rules/command_instead_of_module.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ class CommandsInsteadOfModulesRule(AnsibleLintRule):
7676
"kill",
7777
"set-default",
7878
"set-property",
79+
"set-environment",
80+
"unset-environment",
7981
"show-environment",
8082
"status",
8183
"reset-failed",

0 commit comments

Comments
 (0)