Issue installing this role fails on Ubuntu 16.04
OPSJono opened this issue · comments
Ansible throws an error when running the role.
Initially I was trying to install 10.x - even though it's not stated as supported in the readme.
So I changed to one of the examples in the defaults/main.yml
- still no luck.
I'm attempting to run this via Vagrant on Qemu/KVM.
Base box used: https://vagrantcloud.com/yk0/ubuntu-xenial/
Happy to assist with any debugging or provide more information if needed.
Host OS: Fedora 29.
Output of ansible --version
on host machine.
ansible 2.7.1
config file = None
configured module search path = ['/home/jonathan/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.7/site-packages/ansible
executable location = /usr/local/bin/ansible
python version = 3.7.1 (default, Nov 5 2018, 14:07:04) [GCC 8.2.1 20181011 (Red Hat 8.2.1-4)]
When running vagrant up --provision
Vagrant reports:
Bringing machine 'atlas' up with 'libvirt' provider...
==> atlas: Running provisioner: ansible...
Vagrant has automatically selected the compatibility mode '2.0'
according to the Ansible version installed (2.7.1).
Alternatively, the compatibility mode can be specified in your Vagrantfile:
https://www.vagrantup.com/docs/provisioning/ansible_common.html#compatibility_mode
atlas: Running ansible-playbook...
Error:
TASK [geerlingguy.nodejs : Add NodeSource repositories for Node.js.] ***********
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: apt.cache.FetchFailedException: W:The repository 'https://deb.nodesource.com/node_8.x Debian Release' does not have a Release file., W:Data from such a repository can't be authenticated and is therefore potentially dangerous to use., W:See apt-secure(8) manpage for repository creation and user configuration details., E:Failed to fetch https://deb.nodesource.com/node_8.x/dists/Debian/main/binary-amd64/Packages 404 Not Found, E:Failed to fetch https://deb.nodesource.com/node_8.x/dists/Debian/main/binary-i386/Packages 404 Not Found, E:Some index files failed to download. They have been ignored, or old ones used instead.
failed: [atlas] (item=deb https://deb.nodesource.com/node_8.x Debian main) => {"changed": false, "item": "deb https://deb.nodesource.com/node_8.x Debian main", "module_stderr": "Traceback (most recent call last):\n File \"<stdin>\", line 113, in <module>\n File \"<stdin>\", line 105, in _ansiballz_main\n File \"<stdin>\", line 48, in invoke_module\n File \"/tmp/ansible_apt_repository_payload_hHYGoh/__main__.py\", line 550, in <module>\n File \"/tmp/ansible_apt_repository_payload_hHYGoh/__main__.py\", line 542, in main\n File \"/usr/lib/python2.7/dist-packages/apt/cache.py\", line 487, in update\n raise FetchFailedException(e)\napt.cache.FetchFailedException: W:The repository 'https://deb.nodesource.com/node_8.x Debian Release' does not have a Release file., W:Data from such a repository can't be authenticated and is therefore potentially dangerous to use., W:See apt-secure(8) manpage for repository creation and user configuration details., E:Failed to fetch https://deb.nodesource.com/node_8.x/dists/Debian/main/binary-amd64/Packages 404 Not Found, E:Failed to fetch https://deb.nodesource.com/node_8.x/dists/Debian/main/binary-i386/Packages 404 Not Found, E:Some index files failed to download. They have been ignored, or old ones used instead.\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: apt.cache.FetchFailedException: W:The repository 'https://deb.nodesource.com/node_8.x Debian Release' does not have a Release file., W:Data from such a repository can't be authenticated and is therefore potentially dangerous to use., W:See apt-secure(8) manpage for repository creation and user configuration details., E:Failed to fetch https://deb.nodesource.com/node_8.x/dists/Debian/main/source/Sources 404 Not Found, E:Failed to fetch https://deb.nodesource.com/node_8.x/dists/Debian/main/binary-amd64/Packages 404 Not Found, E:Failed to fetch https://deb.nodesource.com/node_8.x/dists/Debian/main/binary-i386/Packages 404 Not Found, E:Some index files failed to download. They have been ignored, or old ones used instead.
failed: [atlas] (item=deb-src https://deb.nodesource.com/node_8.x Debian main) => {"changed": false, "item": "deb-src https://deb.nodesource.com/node_8.x Debian main", "module_stderr": "Traceback (most recent call last):\n File \"<stdin>\", line 113, in <module>\n File \"<stdin>\", line 105, in _ansiballz_main\n File \"<stdin>\", line 48, in invoke_module\n File \"/tmp/ansible_apt_repository_payload_CLRVbV/__main__.py\", line 550, in <module>\n File \"/tmp/ansible_apt_repository_payload_CLRVbV/__main__.py\", line 542, in main\n File \"/usr/lib/python2.7/dist-packages/apt/cache.py\", line 487, in update\n raise FetchFailedException(e)\napt.cache.FetchFailedException: W:The repository 'https://deb.nodesource.com/node_8.x Debian Release' does not have a Release file., W:Data from such a repository can't be authenticated and is therefore potentially dangerous to use., W:See apt-secure(8) manpage for repository creation and user configuration details., E:Failed to fetch https://deb.nodesource.com/node_8.x/dists/Debian/main/source/Sources 404 Not Found, E:Failed to fetch https://deb.nodesource.com/node_8.x/dists/Debian/main/binary-amd64/Packages 404 Not Found, E:Failed to fetch https://deb.nodesource.com/node_8.x/dists/Debian/main/binary-i386/Packages 404 Not Found, E:Some index files failed to download. They have been ignored, or old ones used instead.\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
Further to this,
Running the installation manually from the NodeJS repo on a fresh VM before anything works fine:
https://github.com/nodesource/distributions#debinstall
(Section for 10.x)
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs
Additionally, trying to run that script, after this ansible role has failed, results in the same error message.
So,
This issue seems to have been caused by the ansible_os_family
being set to Ubuntu
instead of xenial
.
Other playbooks require that variable to be Ubuntu
I manually set these variables in the main playbook.
vars:
- ansible_os_family: "Debian"
- ansible_distribution: "Ubuntu"
- ansible_distribution_version: "16.04"
In order to fix/get around this problem I changed the role slightly to reference a node_ansible_os_family
which has it's value set to xenial
and now it all works fine.
But is there a better way to define these variables, other than manually like this?
- I'm happy to close this issue as essentially it was user error in the variable definition. :)