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

github_repo always reports changed status #2376

Closed
1 task done
larsks opened this issue Apr 29, 2021 · 4 comments · Fixed by #2386
Closed
1 task done

github_repo always reports changed status #2376

larsks opened this issue Apr 29, 2021 · 4 comments · Fixed by #2386
Labels
bug This issue/PR relates to a bug has_pr module module needs_triage plugins plugin (any type) python3 source_control

Comments

@larsks
Copy link

larsks commented Apr 29, 2021

Summary

When using the github_repo module to create a repository, the module always reports "changed" even when the repository already exists. Consider the following playbook:

- hosts: localhost
  gather_facts: false
  vars:
    github_token: "{{ lookup('env', 'GITHUB_TOKEN') }}"
  tasks:
    - name: create repository
      community.general.github_repo:
          access_token: "{{ github_token }}"
          name: "ansible-sandbox"
          state: present
          organization: "oddbit-dot-com"
          private: false

Running it once produces:

TASK [create repository] *********************************************************************
changed: [localhost]

Running it one or more additional times reports:

TASK [create repository] *********************************************************************
changed: [localhost]

Issue Type

Bug Report

Component Name

github_repo

Ansible Version

$ ansible --version
ansible 2.10.8
  config file = /home/lars/.ansible.cfg
  configured module search path = ['/home/lars/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/lars/.local/lib/python3.9/site-packages/ansible
  executable location = /home/lars/.local/bin/ansible
  python version = 3.9.4 (default, Apr  6 2021, 00:00:00) [GCC 10.2.1 20201125 (Red Hat 10.2.1-9)]

Configuration

$ ansible-config dump --only-changed
COMMAND_WARNINGS(/home/lars/.ansible.cfg) = False
RETRY_FILES_ENABLED(/home/lars/.ansible.cfg) = False

OS / Environment

Fedora 33

Steps to Reproduce

(see the playbook in the description)

Expected Results

I expect the module to report "ok" rather than "changed" if the named repository already exists.

Actual Results

No response

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibullbot
Copy link
Collaborator

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot
Copy link
Collaborator

@abikouo
Copy link
Contributor

abikouo commented Apr 30, 2021

@larsks thanks for reporting this issue.
github_repo module is used to create and edit repo when state is set to present
Existing repo will be edited if the module is run with a different value of private or description, so could you please check that the descrption of the repository was already empty value before ?

@larsks
Copy link
Author

larsks commented Apr 30, 2021

The repo was created using github_repo. In the example output I showed above, the first output created the repository. The only configuration in place (private, description, etc) was put in place by the github_repo module. As indicated, no matter how many times you run it, it continues to report changed status.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug has_pr module module needs_triage plugins plugin (any type) python3 source_control
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants