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

ansible: support for Ubuntu 14.04 #735

Closed

Conversation

joaocgreis
Copy link
Member

This adds a few adjustments needed to create a Jenkins worker on Ubuntu 14.04.

The second commit is necessary because there is already a package name specified for Ubuntu, which is not available on 14.04. With the when statement, Ansible prints a warning and then ignores the failure installing the package.

cc @jbergstroem

Ansible warns that when statements should not include jinja2
templating delimiters, and ignores subsequent failures installing the
package. This lets the package installation fail when the package
name is missing.
kfarnung

This comment was marked as off-topic.

jbergstroem

This comment was marked as off-topic.

jbergstroem

This comment was marked as off-topic.

jbergstroem

This comment was marked as off-topic.

mhdawson

This comment was marked as off-topic.

@seishun
Copy link
Contributor

seishun commented Jul 5, 2017

ERROR! Syntax Error while loading YAML.


The error appears to have been in '/mnt/c/Users/Nikolai/build/ansible/roles/baselayout/vars/main.yml': line 110, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


  ubuntu1404: [
  ^ here

It seems there's a missing comma.

@joaocgreis
Copy link
Member Author

@seishun should be fixed, thanks!

@seishun
Copy link
Contributor

seishun commented Jul 7, 2017

TASK [baselayout : install packages] ***********************************************************************************
failed: [test-softlayer-ubuntu1404-x64-1] (item=ntp) => {"cache_update_time": 1499117895, "cache_updated": false, "failed": true, "msg": "'/usr/bin/apt-get -y -o \"Dpkg::Options::=--force-confdef\" -o \"Dpkg::Options::=--force-confold\"     install 'ntp'' failed: E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/n/ntp/ntp_4.2.6.p5+dfsg-3ubuntu2.14.04.10_amd64.deb  404  Not Found [IP: 91.189.91.26 80]\n\nE: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?\n", "package": "ntp", "rc": 100, "stderr": "E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/n/ntp/ntp_4.2.6.p5+dfsg-3ubuntu2.14.04.10_amd64.deb  404  Not Found [IP: 91.189.91.26 80]\n\nE: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?\n", "stderr_lines": ["E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/n/ntp/ntp_4.2.6.p5+dfsg-3ubuntu2.14.04.10_amd64.deb  404  Not Found [IP: 91.189.91.26 80]", "", "E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?"], "stdout": "Reading package lists...\nBuilding dependency tree...\nReading state information...\nThe following extra packages will be installed:\n  libopts25\nSuggested packages:\n  ntp-doc\nThe following NEW packages will be installed:\n  libopts25 ntp\n0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.\nNeed to get 477 kB of archives.\nAfter this operation, 1682 kB of additional disk space will be used.\nGet:1 http://archive.ubuntu.com/ubuntu/ trusty/main libopts25 amd64 1:5.18-2ubuntu2 [55.3 kB]\nErr http://archive.ubuntu.com/ubuntu/ trusty-updates/main ntp amd64 1:4.2.6.p5+dfsg-3ubuntu2.14.04.10\n  404  Not Found [IP: 91.189.88.162 80]\nErr http://security.ubuntu.com/ubuntu/ trusty-security/main ntp amd64 1:4.2.6.p5+dfsg-3ubuntu2.14.04.10\n  404  Not Found [IP: 91.189.91.26 80]\nFetched 55.3 kB in 0s (57.2 kB/s)\n", "stdout_lines": ["Reading package lists...", "Building dependency tree...", "Reading state information...", "The following extra packages will be installed:", "  libopts25", "Suggested packages:", "  ntp-doc", "The following NEW packages will be installed:", "  libopts25 ntp", "0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.", "Need to get 477 kB of archives.", "After this operation, 1682 kB of additional disk space will be used.", "Get:1 http://archive.ubuntu.com/ubuntu/ trusty/main libopts25 amd64 1:5.18-2ubuntu2 [55.3 kB]", "Err http://archive.ubuntu.com/ubuntu/ trusty-updates/main ntp amd64 1:4.2.6.p5+dfsg-3ubuntu2.14.04.10", "  404  Not Found [IP: 91.189.88.162 80]", "Err http://security.ubuntu.com/ubuntu/ trusty-security/main ntp amd64 1:4.2.6.p5+dfsg-3ubuntu2.14.04.10", "  404  Not Found [IP: 91.189.91.26 80]", "Fetched 55.3 kB in 0s (57.2 kB/s)"]}
changed: [test-softlayer-ubuntu1404-x64-1] => (item=ccache)
changed: [test-softlayer-ubuntu1404-x64-1] => (item=g++)
ok: [test-softlayer-ubuntu1404-x64-1] => (item=gcc)
changed: [test-softlayer-ubuntu1404-x64-1] => (item=git)
changed: [test-softlayer-ubuntu1404-x64-1] => (item=automake)
ok: [test-softlayer-ubuntu1404-x64-1] => (item=bash)
changed: [test-softlayer-ubuntu1404-x64-1] => (item=libtool)
ok: [test-softlayer-ubuntu1404-x64-1] => (item=sudo)

It seems an apt-get update is required before installing packages.

@seishun
Copy link
Contributor

seishun commented Jul 15, 2017

If I manually run apt-get update before running the script, I get the following:

RUNNING HANDLER [baselayout : restart sshd] ****************************************************************************
fatal: [test-softlayer-ubuntu1404-x64-1]: FAILED! => {"changed": false, "failed": true, "msg": "Could not find the requested service sshd: host"}

It seems you have to use ssh on Ubuntu 14.04. Later versions have sshd as an alias for ssh.

The role package-upgrade should run before baselayout, to ensure that
the package databases are updated and baselayout can install packages.
@joaocgreis
Copy link
Member Author

Updated. Added 2 commits:

  • Run package-upgrade before baselayout, to ensure apt-get update is run before installing packages. This fixes the error reported above. I only tested the jenkins worker playbook, but others should have the same issue.
  • Increase the timeout for downloading slave.jar: because it takes about 40 seconds and the default timeout is 10.

@seishun I did not run into the issue with ssh/sshd. I used a freshly installed ubuntu-14.04-server-amd64.iso (14.04.0, not one of the updates, to make sure the package installation would fail). At this point it would be better to land this and follow up in a new issue if you want, but please let me know if you would like this to be resolved here.

@seishun
Copy link
Contributor

seishun commented Aug 26, 2017

I still get the "Could not find the requested service sshd: host" error. I'm using the latest "ubuntu/trusty64" Vagrant box.

How are you testing this? Did you install the iso manually in a VM? If so, could you provide the steps you followed to configure ssh etc?

@seishun
Copy link
Contributor

seishun commented Aug 26, 2017

I just installed ubuntu-14.04-server-amd64.iso in a VM and service --status-all doesn't list sshd, only ssh.

@joaocgreis
Copy link
Member Author

The handler only runs when lineinfile finds the line, so I added it to sshd_config and was able to reproduce. Added a commit to address it. @seishun let me know if this works!

For reference, I installed the iso directly in a VM, selected the OpenSSH server when installing, and added my key to root. Then on my base machine edited the inventory adding a new machine that pointed to it and added a dummy host_vars file.

@seishun
Copy link
Contributor

seishun commented Aug 26, 2017

Runs successfully now.

@joaocgreis
Copy link
Member Author

@nodejs/build can you PTAL at the last 3 commits? Both @seishun and myself tested this, so I feel confident landing with just a rubber stamp.

refack

This comment was marked as off-topic.

joaocgreis added a commit that referenced this pull request Aug 29, 2017
PR-URL: #735
Reviewed-By: Kyle Farnung <[email protected]>
Reviewed-By: Johan Bergström <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
joaocgreis added a commit that referenced this pull request Aug 29, 2017
Ansible warns that when statements should not include jinja2
templating delimiters, and ignores subsequent failures installing the
package. This lets the package installation fail when the package
name is missing.

PR-URL: #735
Reviewed-By: Kyle Farnung <[email protected]>
Reviewed-By: Johan Bergström <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
joaocgreis added a commit that referenced this pull request Aug 29, 2017
The role package-upgrade should run before baselayout, to ensure that
the package databases are updated and baselayout can install packages.

PR-URL: #735
Reviewed-By: Refael Ackermann <[email protected]>
joaocgreis added a commit that referenced this pull request Aug 29, 2017
joaocgreis added a commit that referenced this pull request Aug 29, 2017
@joaocgreis
Copy link
Member Author

Landed in 9614094...0707dc2

@joaocgreis joaocgreis closed this Aug 29, 2017
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 this pull request may close these issues.

6 participants