diff --git a/default.config.yml b/default.config.yml index 67cdd70..790d385 100644 --- a/default.config.yml +++ b/default.config.yml @@ -499,4 +499,4 @@ pre_provision_tasks: # Glob pattern to ansible task files to run after all other tasks are finished. post_provision_tasks: - tasks/post-provision.yml - - tasks/ssh-post.yml + # - tasks/ssh-post.yml # needs refactoring diff --git a/tasks/ssh-post.yml b/tasks/ssh-post.yml index 0c8f767..817c394 100644 --- a/tasks/ssh-post.yml +++ b/tasks/ssh-post.yml @@ -10,18 +10,20 @@ set -o pipefail "ps -p {{ lookup('ansible.builtin.env', 'SSH_AGENT_PID') }}" register: ssh_agent_started - when: ssh_agent_pid != '' # should be checking type == int + when: ssh_agent_pid != '' changed_when: false -- name: Check if key has been added to ssh-agent. - ansible.builtin.shell: | - set -o pipefail - ssh-add -l | grep "no identities" - register: ssh_key_added - changed_when: false +# - name: Check if key has been added to ssh-agent. +# ansible.builtin.shell: | +# set -o pipefail +# ssh-add -l | grep "no identities" +# when: ssh_agent_started.rc == 0 +# register: ssh_key_not_added +# failed_when: ssh_key_not_added.rc >= 2 +# changed_when: false -# - name: Ensure ssh-agent is running and add SSH key to the ssh-agent. -# shell: | -# eval "$(ssh-agent)" -# ssh-add --apple-use-keychain ~/.ssh/id_ed25519 -# when: ssh_agent_started.skipped == true +- name: Ensure ssh-agent is running and add SSH key to the ssh-agent. + shell: | + eval "$(ssh-agent)" + ssh-add --apple-use-keychain ~/.ssh/id_ed25519 + when: ssh_agent_started.rc == 0