rvm / rvm1-ansible

The official ansible RVM role to install and manage your Ruby versions.
MIT License
271 stars 136 forks source link

import gpg tasks fail in check mode #136

Closed yithian closed 7 years ago

yithian commented 7 years ago

When running a playbook that uses the rvm_io.ruby role in check mode (ansible-playbook ... -C), the tasks to import GPG keys via the command and shell modules both fail. The failure from the shell module gpg key task (Import GPG keys the other way) causes the entire run to exit.

It appears to be due to the fact that the command task doesn't actually execute during check mode, which means that its output doesn't get registered to the gpg_result variable. Then when the tasks examine gpg_result for its rc key during the until clause, it's not present.

TASK [rvm_io.ruby : Import GPG keys] *******************************************
fatal: [hostname]: FAILED! => {"failed": true, "msg": "The conditional check 'gpg_result.rc == 0' failed. The error was: error while evaluating conditional (gpg_result.rc == 0): 'dict object' has no attribute 'rc'"}
...ignoring

TASK [rvm_io.ruby : Import GPG keys the other way] *****************************
fatal: [hostname]: FAILED! => {"failed": true, "msg": "The conditional check 'rvm1_gpg_keys != '' and gpg_result.rc != 0' failed. The error was: error while evaluating conditional (rvm1_gpg_keys != '' and gpg_result.rc != 0): 'dict object' has no attribute 'rc'\n\nThe error appears to have been in '/etc/ansible/roles/rvm_io.ruby/tasks/rvm.yml': line 34, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Import GPG keys the other way\n  ^ here\n"}
        to retry, use: --limit @.../webserver.retry
xacaxulu commented 5 years ago

+1