Skip to content

Commit

Permalink
Merge pull request #2 from andybro19/ssh-auth
Browse files Browse the repository at this point in the history
Only set ansible_ssh_pass when provision_user_ssh_password is set
  • Loading branch information
gizmoguy authored Oct 10, 2022
2 parents ad95131 + 921ce62 commit 9d85ba4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@
name: wandansible.provision
tasks_from: credentials

- name: Run initial raspberry pi configuration as provision user
- name: Run initial raspberry pi configuration as provision user using public key SSH authentication
vars:
ansible_user: "{{ provision_user_username }}"
ansible_ssh_pass: "{{ provision_user_ssh_password }}"
ansible_ssh_private_key_file: "{{ provision_user_private_key_file }}"
ansible_become_pass: "{{ provision_user_password }}"
ansible.builtin.import_tasks: initialise.yml
when: provision_user_ssh_password == ""

- name: Run initial raspberry pi configuration as provision user using password-based SSH authentication
vars:
ansible_user: "{{ provision_user_username }}"
ansible_ssh_pass: "{{ provision_user_ssh_password }}"
ansible_become_pass: "{{ provision_user_password }}"
ansible.builtin.import_tasks: initialise.yml
when: provision_user_ssh_password != ""

0 comments on commit 9d85ba4

Please sign in to comment.