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

Role fails on debian9 AWS ami #99

Closed
pkaramol opened this issue Nov 21, 2018 · 3 comments
Closed

Role fails on debian9 AWS ami #99

pkaramol opened this issue Nov 21, 2018 · 3 comments

Comments

@pkaramol
Copy link

pkaramol commented Nov 21, 2018

I have been using the role with success on to create amis based off the following search patterns (and always getting the most recent result):

*debian-jessie-amd64-hvm*
*ubuntu-bionic-18.04-amd64-server*
*ubuntu-xenial-16.04-amd64-server*

However when attempting with:

*debian-stretch-amd64-hvm*

the role fails as follows:

    amazon-ebs: TASK [docker : Add Docker repository.] *****************************************
    amazon-ebs: Wednesday 21 November 2018  16:18:44 +0200 (0:00:00.092)       0:01:05.876 ****
    amazon-ebs: An exception occurred during task execution. To see the full traceback, use -vvv. The error was: Shared connection to 127.0.0.1 closed.
    amazon-ebs: fatal: [default]: FAILED! => changed=false
    amazon-ebs:   module_stderr: |-
    amazon-ebs:     Traceback (most recent call last):
    amazon-ebs:       File "/home/admin/.ansible/tmp/ansible-tmp-1542809924.26-27445738831388/AnsiballZ_apt_repository.py", line 113, in <module>
    amazon-ebs:         _ansiballz_main()
    amazon-ebs:       File "/home/admin/.ansible/tmp/ansible-tmp-1542809924.26-27445738831388/AnsiballZ_apt_repository.py", line 105, in _ansiballz_main
    amazon-ebs:         invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
    amazon-ebs:       File "/home/admin/.ansible/tmp/ansible-tmp-1542809924.26-27445738831388/AnsiballZ_apt_repository.py", line 48, in invoke_module
    amazon-ebs:         imp.load_module('__main__', mod, module, MOD_DESC)
    amazon-ebs:       File "/tmp/ansible_apt_repository_payload_a7mtty/__main__.py", line 550, in <module>
    amazon-ebs:       File "/tmp/ansible_apt_repository_payload_a7mtty/__main__.py", line 542, in main
    amazon-ebs:       File "/usr/lib/python2.7/dist-packages/apt/cache.py", line 464, in update
    amazon-ebs:         raise FetchFailedException(e)
    amazon-ebs:     apt.cache.FetchFailedException: E:The repository 'https://download.docker.com/linux/debian NA Release' does not have a Release file.
@geerlingguy
Copy link
Owner

That failure indicates Ansible is not able to determine the release version—it uses the variable ansible_distribution_release to build the repo URL.

See: https://github.com/geerlingguy/ansible-role-docker/blob/master/defaults/main.yml#L20

I would suggest you force override the variable in this situation, since I'm guessing you won't be able to fix the upstream AMI:

docker_apt_repository: "deb [arch={{ docker_apt_arch }}] https://download.docker.com/linux/debian stretch Release"

@pkaramol
Copy link
Author

pkaramol commented Nov 23, 2018

I performed the following on my site.yml

    - name: pre_tasks --> Force set ansible_distribution_release variable cause it is not set in stretch ami
      set_fact:
         ansible_distribution_release: "stretch"
      when: ansible_distribution_release == "NA" and ansible_distribution_version == "stretch/sid"

but now it fails as follows;
(any suggestions? the same role works ok when spinning up a jessie ami.

as it if tries to find the task file to include in the wrong place;

    amazon-ebs: TASK [geerlingguy.docker : include_tasks] **************************************
    amazon-ebs: Friday 23 November 2018  10:22:22 +0200 (0:00:00.045)       0:00:58.088 *******
    amazon-ebs: fatal: [default]: FAILED! =>
    amazon-ebs:   reason: |-
    amazon-ebs:     Unable to retrieve file contents
    amazon-ebs:     Could not find or access '/home/pkara/Workspace/gitlab/aws_ami/ansible/setup-Debian.yml' on the Ansible Controller.
    amazon-ebs:     If you are using a module and expect the file to exist on the remote, see the remote_src option

overriding the {{ docker_apt_repository }} variable failed as follows:

    amazon-ebs: TASK [geerlingguy.docker : Install Docker.] ************************************
    amazon-ebs: Friday 23 November 2018  10:48:05 +0200 (0:00:03.073)       0:01:05.176 *******
    amazon-ebs: fatal: [default]: FAILED! => changed=false
    amazon-ebs:   msg: No package matching 'docker-ce' is available

@pkaramol
Copy link
Author

Nevermind, this fixed it:

    - name: pre_tasks --> Force set ansible_distribution_release variable cause it is not set in stretch ami
      set_fact:
         ansible_distribution_release: "stretch"
         ansible_distribution_version: "9"
      when: ansible_distribution_release == "NA" and ansible_distribution_version == "stretch/sid"

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