Skip to content

Commit

Permalink
Get system username
Browse files Browse the repository at this point in the history
  • Loading branch information
vitabaks committed Dec 10, 2024
1 parent 5d56206 commit 6b065a3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions automation/molecule/default/prepare.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- name: "Update docker network(s)"
hosts: localhost
gather_facts: true
gather_facts: false
become: false
tasks:
- name: "Create docker network: test_docker_network"
Expand All @@ -26,9 +26,15 @@
environment:
PIP_BREAK_SYSTEM_PACKAGES: "1"

- name: Get system username
become: false
ansible.builtin.command: whoami
register: system_user
changed_when: false

- name: Generate molecule SSH key on control node
ansible.builtin.user:
name: "{{ ansible_facts.user }}"
name: "{{ system_user.stdout }}"
generate_ssh_key: true
ssh_key_bits: 2048
ssh_key_file: ~/.ssh/molecule_rsa
Expand Down

0 comments on commit 6b065a3

Please sign in to comment.