Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

authorized_key no return values in checking mode #37

Closed
gstorme opened this issue Jun 5, 2020 · 1 comment · Fixed by #55
Closed

authorized_key no return values in checking mode #37

gstorme opened this issue Jun 5, 2020 · 1 comment · Fixed by #55
Assignees

Comments

@gstorme
Copy link

gstorme commented Jun 5, 2020

SUMMARY

When I run a task using the authorized_key module in checking_mode and register the result, it does not contain any return values.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

authorized_key

ANSIBLE VERSION
ansible 2.9.9
  config file = /home/gregory/.ansible.cfg
  configured module search path = ['/home/gregory/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/gregory/.local/lib/python3.7/site-packages/ansible
  executable location = /home/gregory/.local/bin/ansible
  python version = 3.7.3 (default, Apr  3 2019, 05:39:12) [GCC 8.3.0]
STEPS TO REPRODUCE
- name: check if an authorized_key change is needed
  authorized_key:
    user: gregory
    key: ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQB2tZ7l62JQCTgr88sZseQp6L7syhg+a7 Gregory
  check_mode: true
  register: authkey_change

- name: check if a group change is needed for a user
  user:
    name: gregory
    group: gregory
  check_mode: true
  register: group_change

- debug:
    var: authkey_change

- debug:
    var: group_change
EXPECTED RESULTS

I would expect that the authkey_change variable contains the return values from the authorized_key task, like the group_change does have from the user task.

ACTUAL RESULTS

The authorized_key module does not have any return values in checking_mode.

TASK [test : debug] *****************************************************************************************************************************************************************************************************************************************
ok: [buster] => {
    "authkey_change": {
        "changed": false,
        "failed": false
    }
}

TASK [test : debug] *****************************************************************************************************************************************************************************************************************************************
ok: [buster] => {
    "group_change": {
        "append": false,
        "changed": false,
        "comment": "",
        "failed": false,
        "group": 1000,
        "home": "/home/gregory",
        "move_home": false,
        "name": "gregory",
        "shell": "/bin/bash",
        "state": "present",
        "uid": 1000
    }
}
@maxamillion maxamillion self-assigned this Jun 19, 2020
@maxamillion
Copy link
Collaborator

I have a patch for this but I'm waiting on another PR to merge to get the new docs fragments directory structure in place. Should be able to get the PR in tomorrow.

maxamillion added a commit to maxamillion/ansible.posix that referenced this issue Jun 19, 2020
Prevously check_mode would incorrectly return changed=False even when a
change would have taken place if ran without check_mode, with
integration tests that confirmed this incorrect behavior. Also the
module did not correctly populate the return values when run in
check_mode. Both of these issues are resolved in this PR.

Fixes ansible-collections#37

Signed-off-by: Adam Miller <[email protected]>
maxamillion added a commit to maxamillion/ansible.posix that referenced this issue Jun 19, 2020
Previously check_mode would incorrectly return changed=False even when a
change would have taken place if ran without check_mode, with
integration tests that confirmed this incorrect behavior. Also the
module did not correctly populate the return values when run in
check_mode. Both of these issues are resolved in this PR.

Fixes ansible-collections#37

Signed-off-by: Adam Miller <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants