anaconda/tests/check_and_set_remote_user.yml
Radek Vykydal 1471316eac Import Anaconda functional tests from RHEL 8
Related: rhbz#1961087
2021-06-28 16:27:19 +02:00

26 lines
594 B
YAML

---
# Check if remote_user is reachable by ansible and set ansible.cfg
# if so.
- hosts: gating_test_runner
become: True
gather_facts: False
remote_user: "{{ remote_user }}"
tasks:
- name: Try a raw command as a check
raw: echo "CHECK OK"
register: result
- debug:
msg: "{{ result }}"
- name: Set ansible.cfg remote user to "{{ remote_user }}"
become: no
local_action:
module: lineinfile
path: ./remote_config/ansible.cfg
regexp: ^remote_user
line: "remote_user = {{ remote_user }}"
when: result.stdout_lines[0] == "CHECK OK"