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

error when lists are empty #9

Open
rob42 opened this issue Nov 7, 2016 · 1 comment
Open

error when lists are empty #9

rob42 opened this issue Nov 7, 2016 · 1 comment

Comments

@rob42
Copy link

rob42 commented Nov 7, 2016

In ansible 2.2 on kubuntu 16.04 I get an error for apt_default_key_urls and apt_default_repositories when the lists are empty (default):

failed: [35.162.23.231] (item=apt_default_repositories) => {
    "failed": true, 
    "invocation": {
        "module_args": {
            "filename": null, 
            "install_python_apt": true, 
            "mode": null, 
            "repo": "apt_default_repositories", 
            "state": "present", 
            "update_cache": true, 
            "validate_certs": true
        }, 
        "module_name": "apt_repository"
    }, 
    "item": "apt_default_repositories", 
    "msg": "Invalid repository string: apt_default_repositories"
}

Problem is fixed by adding when: apt_default_key_urls to avoid empty lists, eg:

- name: APT | Make sure the default keys are added
  apt_key:
    url: "{{item}}"
    state: present
  with_items: apt_default_key_urls
  when: apt_default_key_urls

@danielmotaleite
Copy link

Please check https://github.com/AutomationWithAnsible/ansible-apt as this one is not maintained anymore

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

No branches or pull requests

2 participants