Skip to content

Commit 0858fbf

Browse files
committed
ci: fix ansible-lint issue in tests_user_config.yml
Signed-off-by: Rich Megginson <[email protected]>
1 parent fd99e9a commit 0858fbf

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tests/tests_user_config.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
- /etc/ssh/ssh_config.d/00-ansible.conf
88
- /etc/ssh/ssh_config
99
username: tester123
10+
__become_method: "{{ 'su' if ansible_version.full is version('2.10', '<')
11+
else 'ansible.builtin.su' }}"
1012
tasks:
1113
- name: Backup configuration files
1214
include_tasks: tasks/backup.yml
@@ -51,7 +53,7 @@
5153
- name: Stat the .ssh dir
5254
become: true
5355
become_user: "{{ username }}"
54-
become_method: su
56+
become_method: "{{ __become_method }}"
5557
stat:
5658
path: "/home/{{ username }}/.ssh"
5759
register:
@@ -68,7 +70,7 @@
6870
- name: Make sure the file is readable by user
6971
become: true
7072
become_user: "{{ username }}"
71-
become_method: su
73+
become_method: "{{ __become_method }}"
7274
stat:
7375
path: "/home/{{ username }}/.ssh/config"
7476

@@ -100,7 +102,7 @@
100102
- name: Test the effective configuration using ssh
101103
become: true
102104
become_user: "{{ username }}"
103-
become_method: su
105+
become_method: "{{ __become_method }}"
104106
command: ssh -vvv -G example
105107
register: effective
106108
when:

0 commit comments

Comments
 (0)