Coder Social home page Coder Social logo

ansible-role-jenkins-slave's Introduction

jenkins-slave role

License pipeline status pipeline status Galaxy Ansible Ansible

This role sets up a new jenkins slave node and adds it to the jenkins master.

Requirements


  • Version of the ansible for installation: >=2.8
  • Supported OS
    • EL
      • 7
      • 8
    • Amazon Linux 2
    • Ubuntu
      • xenial
      • bionic
    • Debian
      • stretch
    • Windows
      • 2016
      • 2019

Dependencies


Java 8 Build Status

Role Variables


  • required

    • master_username Jenkins master CLI user name. Default value is admin.
    • master_password Jenkins master CLI user password. Default value is admin.
    • master_host FQDN name or IP address of the jenkins master host. Default value is {{ ansible_host }}.
    • master_port Jenkins master http port. Default value is 8080.
  • general defaults

    • slave_agent_name Agent name of the slave node. Default value is agent.
    • slave_executors_num Number of executors of the slave node. Default value is 1.
    • slave_environments Dictionary of env variables to be set on slave. Default value is {}
    • slave_mode_exclusive Set usage of this node. If true, node will only build jobs with matching label expressions. Default value is false.
    • master_url Jenkins master host URL. Default value is http://{{ master_host }}:{{ master_port }}.
  • linux defaults

    • slave_linux_jenkins_cred_id Already exist credentials id on the jenkins master: Default value is ci_slave.
    • slave_linux_jenkins_username User name that is defined in slave_linux_jenkins_cred_id. A new user with this name to be created on the slave node. Default value is user.
    • slave_linux_jenkins_password Password for a new user on the slave node. Must match with the credentials password if its kind is 'Username with password'. Default value is 'password'.
    • slave_linux_jenkins_public_key Public key that to be added to authorized_keys slave user file. Private key is placed in the credentials on the jenkins master if its kind is 'SSH Username with private key'. Default value is "".
    • slave_linux_home Home path for deploying jenkins slave binaries. Default value is /opt/jenkins.
    • slave_linux_user_group Group for a new user on the slave node. Default value is user.
    • slave_linux_host Host where jenkins slave is installed to. Default value is "{{ ansible_host }}".
    • slave_linux_ssh_port SSH port of the slave node. Default value is 22.
    • slave_linux_selinux_ports Selinux ports of the slave node. Default value is "{{ master_port }},49187,{{ slave_linux_ssh_port }}".
    • slave_linux_labels List of labels for the slave node. Default value is ['linux'].
  • windows defaults

    • slave_windows_workdir Home path for deploying jenkins slave binaries. Default value is C:/Jenkins_Slave.
    • slave_windows_service Windows service name. Default value is jenkins-slave.
    • slave_windows_java_opts Additional options to pass to java. Default value is "".
    • slave_windows_labels List of labels for the slave node. Default value is ['windows'].
    • slave_windows_service_user The username to set the service to start as.
    • slave_windows_service_password The password of given username to set the service to start as.

Example Playbook

- name: "Install jenkins-slave on remote hosts using default 'Username with password' credentials"
  hosts: slave

  vars:
    master_host: master.example.com

  roles:
    - role: lean_delivery.jenkins_slave
- name: "Install jenkins-slave on remote hosts using created 'Username with password' credentials"
  hosts: one_slave

  vars:
    master_host: master.example.com
    slave_linux_jenkins_cred_id: new_cred
    slave_linux_jenkins_username: new_user
    slave_linux_jenkins_password: new_password
    slave_agent_name: new_linux_slave

  roles:
    - role: lean_delivery.jenkins_slave
- name: "Install jenkins-slave on remote hosts using created 'SSH Username with private key' credentials"
  hosts: many_slaves

  vars:
    master_host: master.example.com
    slave_linux_jenkins_cred_id: new_cred
    slave_linux_jenkins_username: new_user
    slave_linux_jenkins_public_key:
Nck6x4HPrsdfkjhwhf98239hfoijhpowifnYXRXAW1GYGC3lsq7FpWjCeN8wT5QzRsblTh6HZKqh96K3Jj6kpob8ykjhsdkfjhskdfuhksdjfhksjdfhksfjhhkjhUHKUHDKFksjdfhkjshdfXPlx2xSUINDsH2IACLjIrxSAppxITzR7fHZyLmkjsdhfkuwhe98237982fhksdfhksdfhkuhCmcvH6fdVtozo42lXt4QgKytGtiuGAT+lN+uJ4LVGOq32WiEbYKbc7WE7N

  roles:
    - role: lean_delivery.jenkins_slave

Inventory example

[master]
master.example.com

[one_slave]
slave.example.com

[many_slaves]
slave1.example.com slave_agent_name=slave1
slave2.example.com slave_agent_name=slave2

License


Apache License

Author Information


authors:

ansible-role-jenkins-slave's People

Contributors

cosmonaut-ok avatar kakawait avatar lbggn avatar pavelpikta avatar tgadiev avatar viachaslaukabak avatar vystrela avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ansible-role-jenkins-slave's Issues

On RHEL8/Centos8 python3 selinux libraries should be installed instead of python 2 libraries

SUMMARY

Installing Agents on RHEL8 systems does not work since the default Python version is 3.6 and thus python3 selinux libraries should be installed instead python2 selinux libraries.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

task Install ansible selinux support library and Install ansible selinux configure libraries

ANSIBLE VERSION
ansible 2.9.2

OS / ENVIRONMENT
NAME="Red Hat Enterprise Linux"
VERSION="8.1 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="8.1"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Red Hat Enterprise Linux 8.1 (Ootpa)"
STEPS TO REPRODUCE
- name: Install jenkins slaves
  hosts: jenkins_slaves
  become: True
  tasks:

    - include_role:
        name: lean_delivery.jenkins_slave
EXPECTED RESULTS

Jenkins agent should be successfully installed on RHEL8/CentOS with SELinux activated

ACTUAL RESULTS
 TASK [lean_delivery.jenkins_slave : Install ansible selinux support library] 
*********************************************************************************************************************************************************************************************
FAILED - RETRYING: Install ansible selinux support library (10 retries left).
FAILED - RETRYING: Install ansible selinux support library (10 retries left).
FAILED - RETRYING: Install ansible selinux support library (9 retries left).
FAILED - RETRYING: Install ansible selinux support library (9 retries left).
FAILED - RETRYING: Install ansible selinux support library (8 retries left).
FAILED - RETRYING: Install ansible selinux support library (8 retries left).
FAILED - RETRYING: Install ansible selinux support library (7 retries left).
FAILED - RETRYING: Install ansible selinux support library (7 retries left).
FAILED - RETRYING: Install ansible selinux support library (6 retries left).
FAILED - RETRYING: Install ansible selinux support library (6 retries left).
FAILED - RETRYING: Install ansible selinux support library (5 retries left).
FAILED - RETRYING: Install ansible selinux support library (5 retries left).
FAILED - RETRYING: Install ansible selinux support library (4 retries left).
FAILED - RETRYING: Install ansible selinux support library (4 retries left).
FAILED - RETRYING: Install ansible selinux support library (3 retries left).
FAILED - RETRYING: Install ansible selinux support library (3 retries left).
FAILED - RETRYING: Install ansible selinux support library (2 retries left).
FAILED - RETRYING: Install ansible selinux support library (2 retries left).
FAILED - RETRYING: Install ansible selinux support library (1 retries left).
FAILED - RETRYING: Install ansible selinux support library (1 retries left).
fatal: [prdjenkins2]: FAILED! => {"attempts": 10, "changed": false, "failures": ["No package libselinux-python available."], "msg": "Failed to install some of the specified packages", "rc": 1, "results": []}
fatal: [prdjenkins3]: FAILED! => {"attempts": 10, "changed": false, "failures": ["No package libselinux-python available."], "msg": "Failed to install some of the specified packages", "rc": 1, "results": []}

Configuration to populate Node environment variable

SUMMARY

In jenkins node can be configured with pre-defined env variable that will be injected during execution.

slave_linux_envs:
  MY_ENV_VAR: foo
  MY_ENV_VAR2: bar
slave_windows_envs:
  MY_ENV_VAR: foo
  MY_ENV_VAR2: bar

API modification could be found here https://stackoverflow.com/a/34197896/636472

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

templates/add_*_slave.groovy.j2

ANSIBLE VERSION
ansible 2.7.0
  config file = None
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.15 (default, Aug 16 2018, 14:17:09) [GCC 6.4.0]

Using backward slash in windows slave path causing errors

SUMMARY

While setting custom workspace path for windows slave, if windows style slashes (\) are used, script is throwing errors

ISSUE TYPE
  • Bug Report
COMPONENT NAME

Issu with slave_windows_workdir

ANSIBLE VERSION
ansible 2.9.11
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/avlab/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.12 (default, Apr 15 2020, 17:07:12) [GCC 5.4.0 20160609]
CONFIGURATION
DEFAULT_ASK_PASS(env: ANSIBLE_ASK_PASS) = True
DEFAULT_BECOME_ASK_PASS(env: ANSIBLE_BECOME_ASK_PASS) = True
DEFAULT_ROLES_PATH(/etc/ansible/ansible.cfg) = [u'/etc/ansible/roles', u'/home/avlab/.ansible/roles']
HOST_KEY_CHECKING(env: ANSIBLE_HOST_KEY_CHECKING) = False
OS / ENVIRONMENT

Ubuntu 16

STEPS TO REPRODUCE

Use windows style path for workdir variable in playbook

---
- name: install jenkins-slaves on remote hosts
  hosts: slave
  vars:
    master_host: <hostName>
    master_username: <uname>
    master_password: <pwd>
    slave_windows_workdir: "C:\Jenkins_Slave"
    slave_mode_exclusive: true

  roles:
    - role: lean_delivery.jenkins_slave
EXPECTED RESULTS

Should be able to work with windows paths

ACTUAL RESULTS
TASK [lean_delivery.jenkins_slave : Install slave jenkins agent] ********************************************************************************************************************************************************
task path: /home/avlab/.ansible/roles/lean_delivery.jenkins_slave/tasks/Win32NT/agent.yml:2
File lookup using /home/avlab/.ansible/roles/lean_delivery.jenkins_slave/templates/add_windows_slave.groovy.j2 as file
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: avlab
<localhost> EXEC /bin/sh -c 'echo ~avlab && sleep 0'
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/avlab/.ansible/tmp `"&& mkdir /home/avlab/.ansible/tmp/ansible-tmp-1613679479.49-1662-269814171562223 && echo ansible-tmp-1613679479.49-1662-269814171562223="` echo /home/avlab/.ansible/tmp/ansible-tmp-1613679479.49-1662-269814171562223 `" ) && sleep 0'
Using module file /home/avlab/.ansible/roles/lean_delivery.jenkins_slave/library/jenkins_script.py
<localhost> PUT /home/avlab/.ansible/tmp/ansible-local-1626bSTEeT/tmpXd0jF2 TO /home/avlab/.ansible/tmp/ansible-tmp-1613679479.49-1662-269814171562223/AnsiballZ_jenkins_script.py
<localhost> EXEC /bin/sh -c 'chmod u+x /home/avlab/.ansible/tmp/ansible-tmp-1613679479.49-1662-269814171562223/ /home/avlab/.ansible/tmp/ansible-tmp-1613679479.49-1662-269814171562223/AnsiballZ_jenkins_script.py && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/bin/python /home/avlab/.ansible/tmp/ansible-tmp-1613679479.49-1662-269814171562223/AnsiballZ_jenkins_script.py && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /home/avlab/.ansible/tmp/ansible-tmp-1613679479.49-1662-269814171562223/ > /dev/null 2>&1 && sleep 0'
fatal: [Dev0016627.esri.com]: FAILED! => {
    "changed": false, 
    "invocation": {
        "module_args": {
            "args": null, 
            "force_basic_auth": true, 
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", 
            "script": "import jenkins.model.*\nimport hudson.model.*\nimport hudson.slaves.*\nimport hudson.slaves.EnvironmentVariablesNodeProperty.Entry\n\nList<Entry> env = new ArrayList<Entry>();\nEnvironmentVariablesNodeProperty envPro = new EnvironmentVariablesNodeProperty(env);\n\nComputerLauncher launcher = new JNLPLauncher()\nSlave slave = new DumbSlave(\"node-Dev0016627\",\n                            \"C:\\Jenkins_Slave\",\n                            launcher)\nslave.numExecutors = 1\nslave.labelString = \"windows\"\nslave.mode = Node.Mode.EXCLUSIVE\nslave.retentionStrategy = new RetentionStrategy.Always()\nslave.getNodeProperties().add(envPro)\nJenkins.instance.addNode(slave)\nprint slave.getComputer().getJnlpMac()\n", 
            "timeout": 40, 
            "url": "http://release_tests:8080", 
            "url_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", 
            "url_username": "skarumuri", 
            "user": "skarumuri", 
            "validate_certs": false
        }
    }, 
    "msg": "script failed with stacktrace:\n org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:\nScript1.groovy: 11: unexpected char: '\\' @ line 11, column 32.\n                               \"C:\\Jenkins_Slave\",\n                                  ^\n\n1 error\n\n\tat org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)\n\tat org.codehaus.groovy.control.ErrorCollector.addFatalError(ErrorCollector.java:150)\n\tat org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:120)\n\tat org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:132)\n\tat org.codehaus.groovy.control.SourceUnit.addError(SourceUnit.java:350)\n\tat org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:139)\n\tat org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:110)\n\tat org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:234)\n\tat org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:168)\n\tat org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:943)\n\tat org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:605)\n\tat org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)\n\tat org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)\n\tat groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)\n\tat groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)\n\tat groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)\n\tat groovy.lang.GroovyShell.parse(GroovyShell.java:700)\n\tat groovy.lang.GroovyShell.evaluate(GroovyShell.java:584)\n\tat groovy.lang.GroovyShell.evaluate(GroovyShell.java:623)\n\tat groovy.lang.GroovyShell.evaluate(GroovyShell.java:594)\n\tat hudson.util.RemotingDiagnostics$Script.call(RemotingDiagnostics.java:142)\n\tat hudson.util.RemotingDiagnostics$Script.call(RemotingDiagnostics.java:114)\n\tat hudson.remoting.LocalChannel.call(LocalChannel.java:45)\n\tat hudson.util.RemotingDiagnostics.executeGroovy(RemotingDiagnostics.java:111)\n\tat jenkins.model.Jenkins._doScript(Jenkins.java:4513)\n\tat jenkins.model.Jenkins.doScriptText(Jenkins.java:4491)\n\tat java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)\n\tat org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:396)\n\tat org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:408)\n\tat org.kohsuke.stapler.Function.bindAndInvoke(Function.java:212)\n\tat org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:145)\n\tat org.kohsuke.stapler.MetaClass$11.doDispatch(MetaClass.java:535)\n\tat org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)\n\tat org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:747)\n\tat org.kohsuke.stapler.Stapler.invoke(Stapler.java:878)\n\tat org.kohsuke.stapler.Stapler.invoke(Stapler.java:676)\n\tat org.kohsuke.stapler.Stapler.service(Stapler.java:238)\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:790)\n\tat org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:755)\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1617)\n\tat hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154)\n\tat jenkins.security.ResourceDomainFilter.doFilter(ResourceDomainFilter.java:76)\n\tat hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)\n\tat com.smartcodeltd.jenkinsci.plugin.assetbundler.filters.LessCSS.doFilter(LessCSS.java:47)\n\tat hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)\n\tat jenkins.telemetry.impl.UserLanguages$AcceptLanguageFilter.doFilter(UserLanguages.java:128)\n\tat hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)\n\tat hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:157)\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)\n\tat hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:153)\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)\n\tat hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)\n\tat hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)\n\tat hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)\n\tat jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119)\n\tat hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)\n\tat org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)\n\tat hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)\n\tat org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)\n\tat hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)\n\tat org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)\n\tat hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)\n\tat jenkins.security.BasicHeaderProcessor.success(BasicHeaderProcessor.java:139)\n\tat jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:82)\n\tat hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)\n\tat org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)\n\tat hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)\n\tat hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)\n\tat hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:90)\n\tat hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)\n\tat org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)\n\tat hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82)\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)\n\tat org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)\n\tat jenkins.security.SuspiciousRequestFilter.doFilter(SuspiciousRequestFilter.java:36)\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)\n\tat org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:545)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)\n\tat org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:566)\n\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)\n\tat org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1610)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)\n\tat org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1300)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)\n\tat org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:485)\n\tat org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1580)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)\n\tat org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1215)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)\n\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)\n\tat org.eclipse.jetty.server.Server.handle(Server.java:500)\n\tat org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383)\n\tat org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:547)\n\tat org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375)\n\tat org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:273)\n\tat org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)\n\tat org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)\n\tat org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)\n\tat org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336)\n\tat org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313)\n\tat org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171)\n\tat org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129)\n\tat org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:375)\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806)\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938)\n\tat java.lang.Thread.run(Thread.java:748)\n", 
    "output": ""
}

"Install slave jenkins agent" task doesn't report errors

SUMMARY

When I include this role in a playbook, all tasks succeed, but the agent isn't properly installed nor registered with the master. The reason appears to be that the final task "install slave jenkins agent" is actually failing under the hood, but it is not detected by ansible.

The first error I got is the same cause as this issue:
#25

However, the point here is that the role should fail and show the error output without having to dig.

When run with -vvvv, I get the following output:

  output: |-
                                                                                                                                       [106/25715]    org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:                                                                               Script1.groovy: 4: unable to resolve class hudson.plugins.sshslaves.verifiers.NonVerifyingKeyVerificationStrategy                                              @ line 4, column 1.                                                                                                                                             import hudson.plugins.sshslaves.verifiers.NonVerifyingKeyVerificationStrategy                                                                                 ^                                                                                                                                                                                                                                                                                                                        Script1.groovy: 3: unable to resolve class hudson.plugins.sshslaves.SSHLauncher                                                                                @ line 3, column 1.
       import hudson.plugins.sshslaves.SSHLauncher                                                                                                                   ^

    Script1.groovy: 5: unable to resolve class hudson.plugins.sshslaves.verifiers.SshHostKeyVerificationStrategy
     @ line 5, column 1.
       import hudson.plugins.sshslaves.verifiers.SshHostKeyVerificationStrategy
       ^
                                                                                                                                                    [90/25715]    3 errors

            at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
            at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:958)
            at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:605)
            at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:554)
            at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
            at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
            at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
            at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
            at groovy.lang.GroovyShell.evaluate(GroovyShell.java:584)
            at groovy.lang.GroovyShell.evaluate(GroovyShell.java:623)
            at groovy.lang.GroovyShell.evaluate(GroovyShell.java:594)
            at hudson.util.RemotingDiagnostics$Script.call(RemotingDiagnostics.java:142)
            at hudson.util.RemotingDiagnostics$Script.call(RemotingDiagnostics.java:114)
            at hudson.remoting.LocalChannel.call(LocalChannel.java:45)
            at hudson.util.RemotingDiagnostics.executeGroovy(RemotingDiagnostics.java:111)
            at jenkins.model.Jenkins._doScript(Jenkins.java:4484)
            at jenkins.model.Jenkins.doScriptText(Jenkins.java:4462)
            at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:710)
            at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:396)
            at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:408)
            at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:212)
            at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:145)
            at org.kohsuke.stapler.MetaClass$11.doDispatch(MetaClass.java:535)
            at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
            at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:747)
            at org.kohsuke.stapler.Stapler.invoke(Stapler.java:878)
            at org.kohsuke.stapler.Stapler.invoke(Stapler.java:676)
            at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
            at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:755)
            at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1617)
            at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154)
            at jenkins.security.ResourceDomainFilter.doFilter(ResourceDomainFilter.java:76)
            at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
            at hudson.plugins.audit_trail.AuditTrailFilter.doFilter(AuditTrailFilter.java:113)
            at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
            at com.atlassian.bitbucket.jenkins.internal.applink.oauth.serviceprovider.auth.OAuth1aRequestFilter.doFilter(OAuth1aRequestFilter.java:109)
            at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
            at org.jenkinsci.plugins.ssegateway.Endpoint$SSEListenChannelFilter.doFilter(Endpoint.java:248)
            at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
            at io.jenkins.blueocean.ResourceCacheControl.doFilter(ResourceCacheControl.java:134)
            at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
            at io.jenkins.blueocean.auth.jwt.impl.JwtAuthenticationFilter.doFilter(JwtAuthenticationFilter.java:61)
            at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
            at com.smartcodeltd.jenkinsci.plugin.assetbundler.filters.LessCSS.doFilter(LessCSS.java:47)
            at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
            at jenkins.telemetry.impl.UserLanguages$AcceptLanguageFilter.doFilter(UserLanguages.java:128)
            at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
            at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:157)
            at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)
            at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:153)
            at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)
            at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
            at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
            at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
            at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:118)
            at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
            at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
            at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
            at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
            at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
            at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
            at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
            at jenkins.security.BasicHeaderProcessor.success(BasicHeaderProcessor.java:139)
            at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:82)
            at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
            at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
            at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
            at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
            at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:90)
            at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
            at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)
            at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
            at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)
            at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82)
            at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)
            at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
            at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)
            at jenkins.security.SuspiciousRequestFilter.doFilter(SuspiciousRequestFilter.java:36)
            at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)
            at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:545)
            at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
            at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:566)
            at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
            at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
            at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1610)
            at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
            at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1300)
            at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
            at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:485)
            at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1580)
            at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
            at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1215)
            at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
            at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
            at org.eclipse.jetty.server.Server.handle(Server.java:500)
            at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383)
            at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:547)
            at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375)
            at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:273)
            at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
            at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
            at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
            at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336)
            at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313)
            at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171)
            at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129)
            at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:375)
            at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806)
            at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938)
            at java.base/java.lang.Thread.run(Thread.java:834)
ISSUE TYPE
  • Bug Report
COMPONENT NAME

"Install slave jenkins agent" task

ANSIBLE VERSION
ansible 2.9.10
  config file = None
  configured module search path = ['/home/tblack/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/tblack/.local/lib/python3.8/site-packages/ansible
  executable location = /home/tblack/.local/bin/ansible
  python version = 3.8.3 (default, Jun 30 2020, 11:18:52) [GCC 6.3.0 20170516]
CONFIGURATION

no output from that command

OS / ENVIRONMENT

Debian Buster on controller, and controlled

STEPS TO REPRODUCE
EXPECTED RESULTS

Errors detected in this task should result in a failed ansible task.

ACTUAL RESULTS

masked error


jenkins_slave_secret contains new lines

SUMMARY

jenkins_slave_secret fact contains new lines which is breaking

ISSUE TYPE
  • Bug Report
COMPONENT NAME

roles/ansible-role-jenkins-slave-master/tasks/Win32NT/agent.yml

ANSIBLE VERSION
ansible 2.8.3
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/jsykes/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.15+ (default, Nov 27 2018, 23:36:35) [GCC 7.3.0]
CONFIGURATION
OS / ENVIRONMENT
STEPS TO REPRODUCE
EXPECTED RESULTS
TASK [ansible-role-jenkins-slave-master : debug] *************************************************************************************************************************************************************************
ok: [win2012r2Node2] => {
    "msg": "6daf3f6d238635489918646eb23e28d1c1f2e065603d58d7f5165176eb3972b8"
}
ACTUAL RESULTS
TASK [ansible-role-jenkins-slave-master : debug] *************************************************************************************************************************************************************************
ok: [win2012r2Node2] => {
    "msg": "\n    \n    6daf3f6d238635489918646eb23e28d1c1f2e065603d58d7f5165176eb3972b8"
}

Installing slave agent insufficiently documented

TASK [lean_delivery.jenkins_slave : Install slave jenkins agent] ***********************************************************************
fatal: [test]: FAILED! => {"changed": false, "msg": "HTTP error 401 HTTP Error 401: Invalid password/token for user: ********", "output": ""}

Configuration is:

    - name: Install jenkins slave
      become: yes
      import_role:
        name: lean_delivery.jenkins_slave
      vars:
        master_host: xxx.com
        master_port: 80
        master_url: https://xxx.com
        slave_linux_home: /home/build
        slave_linux_jenkins_cred_id: xxx-id
        slave_linux_jenkins_username: build
        slave_linux_user_group: build
        slave_linux_jenkins_public_key: "xxx"

The jenkins master uses google oauth for authentication. I'm not sure what kind of configuration this ansible role expects. The jar files are perfectly accessible via wget.

Why is there a slave_windows_java_opts but no slave_linux_java_opts ?

SUMMARY

Why is there a slave_windows_java_opts but no slave_linux_java_opts? Since your role seems to have no way to define agent java options, I am using another method and am looking for your feedback.

I am using your role to provision 2 ssh linux agents associated with a master that is also provisioned with the same ansible project/site.yml. The master configuration is managed by a custom playbook that installs the configuration-as-code plugin. In the CasC yaml, I define the agents as follows:

  - permanent:
      name: "jenkins-testing-agent-1"
      nodeDescription: "Fungible Agent for jenkins-testing"
      labelString: ""
      # Allow to run arbitrary jobs not matching label patterns
      mode: "NORMAL"
      remoteFS: "/home/jenkins/.jenkins"
      launcher:
        # see here for details on these settings: https://github.com/jenkinsci/ssh-slaves-plugin/blob/master/doc/CONFIGURE.md
        ssh:
          credentialsId: "jenkins_user_on_linux_agent"
          host: "jenkins-testing-agent-1"
          jvmOptions: "-Dhudson.slaves.WorkspaceList=- -Dorg.apache.commons.jelly.tags.fmt.timeZone=America/Vancouver -Xmx64g -Xms64g -XX:+AlwaysPreTouch -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/home/jenkins/.jenkins/support -XX:+UseG1GC -XX:+UseStringDeduplication -XX:+ParallelRefProcEnabled -XX:+DisableExplicitGC -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -verbose:gc -Xlog:gc:/home/jenkins/.jenkins/support/gc-%t.log -XX:+PrintGC -XX:+PrintGCDetails -XX:ErrorFile=/hs_err_%p.log -XX:+LogVMOutput -XX:LogFile=/home/jenkins/.jenkins/support/jvm.log"
          # These settings are just for the initial ssh connection
          launchTimeoutSeconds: 30
          maxNumRetries: 20
          port: 22
          retryWaitTime: 10
          sshHostKeyVerificationStrategy: "nonVerifyingKeyVerificationStrategy"

however, when these agents are launched, the agents' log still shows empty jvmOptions in the ssh launcher call. Agent Log excerpt:

SSHLauncher{host='jenkins-testing-agent-1', port=22, credentialsId='jenkins_user_on_linux_agent', **jvmOptions=''**, javaPath='', prefixStartSlaveCmd='', suffixStartSlaveCmd='', launchTimeoutSeconds=30, maxNumRetries=20, retryWaitTime=10, sshHostKeyVerificationStrategy=hudson.plugins.sshslaves.verifiers.NonVerifyingKeyVerificationStrategy, tcpNoDelay=true, trackCredentials=true} 
[09/22/20 15:56:12] [SSH] Opening SSH connection to jenkins-testing-agent-1:22. 
[09/22/20 15:56:16] [SSH] WARNING: SSH Host Keys are not being verified. Man-in-the-middle attacks may be possible against this connection. 
[09/22/20 15:56:16] [SSH] Authentication successful. 
[09/22/20 15:56:16] [SSH] The remote user's environment is: BASH=/usr/bin/bash
.
.
.
[SSH] java -version returned 11.0.8. 
[09/22/20 15:56:16] [SSH] Starting sftp client. 
[09/22/20 15:56:16] [SSH] Copying latest remoting.jar... Source agent hash is 0146753DA5ED62106734D59722B1FA2C. Installed agent hash is 0146753DA5ED62106734D59722B1FA2C Verified agent jar. No update is necessary. Expanded the channel window size to 4MB 
[09/22/20 15:56:16] [SSH] Starting agent process: cd "/home/jenkins/.jenkins" && java -jar remoting.jar -workDir /home/jenkins/.jenkins -jar-cache /home/jenkins/.jenkins/remoting/jarCache Sep 22, 2020 3:56:17 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir INFO: Using /home/jenkins/.jenkins/remoting as a remoting work directory Sep 22, 2020 3:56:17 PM org.jenkinsci.remoting.engine.WorkDirManager setupLogging INFO: Both error and output logs will be printed to /home/jenkins/.jenkins/remoting <===[JENKINS REMOTING CAPACITY]===>channel started Remoting version: 4.2 This is a Unix agent WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by jenkins.slaves.StandardOutputSwapper$ChannelSwapper to constructor java.io.FileDescriptor(int) WARNING: Please consider reporting this to the maintainers of jenkins.slaves.StandardOutputSwapper$ChannelSwapper WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release Evacuated stdout Agent successfully connected and online

Let me know if you have any ideas why my agents aren't using the specified jvm options. I'm perplexed. My agent logs are zero length as well.

ISSUE TYPE
  • Documentation Report
ANSIBLE VERSION
ansible 2.9.10
  config file = None
  configured module search path = ['/home/tblack/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/tblack/.local/lib/python3.8/site-packages/ansible
  executable location = /home/tblack/.local/bin/ansible
  python version = 3.8.3 (default, Jun 30 2020, 11:18:52) [GCC 6.3.0 20170516]
OS / ENVIRONMENT

Controller = Debian Stretch
Controlled = Debian Buster

Add ability to configure Agent Usage (EXCLUSIVE/NORMAL) as variable

SUMMARY

When configuring a node, a playbook should be able to configure the node's "usage" as either "Use this node as much as possible" (NORMAL) or "Only build jobs with label expressions matching this node" (EXCLUSIVE).

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

Install slave jenkins agent

ANSIBLE VERSION
ansible 2.5.1
  config file = /home/bens/workspace/infra-playbooks/ansible.cfg
  configured module search path = [u'/home/bens/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.15+ (default, Jul  9 2019, 16:51:35) [GCC 7.4.0]
CONFIGURATION
ANSIBLE_NOCOWS(env: ANSIBLE_NOCOWS) = True
ANSIBLE_PIPELINING(env: ANSIBLE_PIPELINING) = True
OS / ENVIRONMENT

N/A

STEPS TO REPRODUCE
- name: "Install jenkins-slave on remote hosts using default 'Username with password' credentials, and configuring the node for builds matching labels only"
  hosts: slave

  vars:
    master_host: master.example.com
    slave_mode_exclusive: true

  roles:
    - role: lean_delivery.jenkins_slave

- name: "Install jenkins-slave on remote hosts using default 'Username with password' credentials, and configuring the node for all builds"
  hosts: slave

  vars:
    master_host: master.example.com
    slave_mode_exclusive: false

  roles:
    - role: lean_delivery.jenkins_slave
EXPECTED RESULTS
  • In the first case, the node is configured, and will only build jobs with label expressions matching this node (by default, 'linux')
    image

  • In the second case, the node is configured as being used as much as possible
    image

ACTUAL RESULTS

Regardless of variable value, all nodes are configured as being used as much as possible.

TASK [lean_delivery.jenkins_slave : Install slave jenkins agent] **************
ok: [slave]

Delegate registration task to control node

SUMMARY

Instead of running Install slave jenkins agent in each slave server (ansible managed host) , run it in the control node (localhost).
Indeed this task makes an API call to Jenkins Master on its port . This means Running this task in the slave server requires to open port 8080 from each slave to the jenkins master which is bad in term of security.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

task Install slave jenkins agent must be delegated to localhost

ANSIBLE VERSION
ansible 2.8.0

unable to resolve class hudson.plugins.sshslaves.verifiers.NonVerifyingKeyVerificationStrategy

This is my playbook

- name: master jenkins provision
  hosts: master1.jenkins
  roles:
  - geerlingguy.jenkins
  vars:
    jenkins_plugins:
     - sshslaves
- name: slave jenkins provision
  hosts: slave1.jenkins
  tags:
  - slave
  roles:
  - lean_delivery.jenkins_slave
  vars:
    master_host: jenkins.miti.local
    slave_environments:
      APP_ENV: dev

This is the error message :

TASK [lean_delivery.jenkins_slave : Install slave jenkins agent] ***********************
Tuesday 15 October 2019  22:38:44 +0000 (0:00:00.485)       0:00:06.029 ******* 
fatal: [slave1.jenkins]: FAILED! => {"changed": false, "msg": "script failed with stacktrace:
 org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script1.groovy: 4: unable to resolve class hudson.plugins.sshslaves.verifiers.NonVerifyingKeyVerificationStrategy
 @ line 4, column 1.
   import hudson.plugins.sshslaves.verifiers.NonVerifyingKeyVerificationStrategy
   ^

Script1.groovy: 3: unable to resolve class hudson.plugins.sshslaves.SSHLauncher
 @ line 3, column 1.
   import hudson.plugins.sshslaves.SSHLauncher
   ^

Script1.groovy: 5: unable to resolve class hudson.plugins.sshslaves.verifiers.SshHostKeyVerificationStrategy
 @ line 5, column 1.
   import hudson.plugins.sshslaves.verifiers.SshHostKeyVerificationStrategy
   ^

3 errors

\tat org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
\tat org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:958)
\tat org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:605)
\tat org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:554)
\tat groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
\tat groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
\tat groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
\tat groovy.lang.GroovyShell.parse(GroovyShell.java:700)
\tat groovy.lang.GroovyShell.evaluate(GroovyShell.java:584)
\tat groovy.lang.GroovyShell.evaluate(GroovyShell.java:623)
\tat groovy.lang.GroovyShell.evaluate(GroovyShell.java:594)
\tat hudson.util.RemotingDiagnostics$Script.call(RemotingDiagnostics.java:142)
\tat hudson.util.RemotingDiagnostics$Script.call(RemotingDiagnostics.java:114)
\tat hudson.remoting.LocalChannel.call(LocalChannel.java:45)
\tat hudson.util.RemotingDiagnostics.executeGroovy(RemotingDiagnostics.java:111)
\tat jenkins.model.Jenkins._doScript(Jenkins.java:4500)
\tat jenkins.model.Jenkins.doScriptText(Jenkins.java:4478)
\tat java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
\tat org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:396)
\tat org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:408)
\tat org.kohsuke.stapler.Function.bindAndInvoke(Function.java:212)
\tat org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:145)
\tat org.kohsuke.stapler.MetaClass$11.doDispatch(MetaClass.java:535)
\tat org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
\tat org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:747)
\tat org.kohsuke.stapler.Stapler.invoke(Stapler.java:878)
\tat org.kohsuke.stapler.Stapler.invoke(Stapler.java:676)
\tat org.kohsuke.stapler.Stapler.service(Stapler.java:238)
\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
\tat org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:873)
\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1623)
\tat hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154)
\tat jenkins.security.ResourceDomainFilter.doFilter(ResourceDomainFilter.java:76)
\tat hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
\tat jenkins.telemetry.impl.UserLanguages$AcceptLanguageFilter.doFilter(UserLanguages.java:128)
\tat hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
\tat hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:157)
\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
\tat hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:64)
\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
\tat hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
\tat hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
\tat hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
\tat jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117)
\tat hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
\tat org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
\tat hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
\tat org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
\tat hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
\tat org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
\tat hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
\tat jenkins.security.BasicHeaderProcessor.success(BasicHeaderProcessor.java:140)
\tat jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:82)
\tat hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
\tat org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
\tat hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
\tat hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
\tat hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:90)
\tat hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
\tat org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
\tat hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82)
\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
\tat org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
\tat org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540)
\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
\tat org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
\tat org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
\tat org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1700)
\tat org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
\tat org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345)
\tat org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
\tat org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480)
\tat org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1667)
\tat org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
\tat org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247)
\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
\tat org.eclipse.jetty.server.Server.handle(Server.java:505)
\tat org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:370)
\tat org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:267)
\tat org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
\tat org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
\tat org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
\tat org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
\tat org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
\tat org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
\tat org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
\tat org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
\tat org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:698)
\tat org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:804)
\tat java.lang.Thread.run(Thread.java:748)
", "output": ""}

I installed sshslaves plugin in jenkins master, but still it does not work when reaches this task [lean_delivery.jenkins_slave : Install slave jenkins agent]

Windows Server 2019 Install slave jenkins agent failing

SUMMARY

Task: lean_delivery.jenkins_slave : Install slave jenkins agent
Is failing on a Windows Server 2019 Server. Any Ideas? I already tried creating a completely new temp-directory

ISSUE TYPE
  • Bug Report / Question
COMPONENT NAME
ANSIBLE VERSION
ansible 2.9.0
  config file = None
  configured module search path = ['/home/xxx/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.6/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.6.9 (default, Nov  7 2019, 10:44:02) [GCC 8.3.0]
CONFIGURATION
OS / ENVIRONMENT

Running Ansible on

Description:    Ubuntu 18.04.4 LTS

Running against Windows Server 2019 with SSH-2.0-OpenSSH_for_Windows_7.7

STEPS TO REPRODUCE
---
- hosts: all
  pre_tasks:
    - name: download xxx ca certificate
      win_get_url:
        url: https://artifactory.xxx.de/pt-ata-generic/GaiaDockerImage/xxx.crt
        dest: 'C:\Users\{{ansible_ssh_user}}\AppData\Local\Temp\xxx.crt'
    - name: install cert
      win_certificate_store:
        path: 'C:\Users\{{ansible_ssh_user}}\AppData\Local\Temp\xxx.crt'
        state: present
        store_name: AuthRoot # The X.509 certificate store for third-party certificate authorities (CAs)

  roles:
    - name: lean_delivery.jenkins_slave
      vars:
        master_username: admin
        master_password: somesecret
        master_host: jenkins.seclab-apphost-xxx-dev.xxx.de
        master_port: 443
        slave_agent_name: windws_build_server
        slave_executors_num: 2
        slave_mode_exclusive: true
        slave_windows_labels: 
          - dnsclientwindows
        master_url: https://jenkins.seclab-apphost-xxx-dev.xxx.de/

Group Vars:

---
ansible_connection: ssh
ansible_shell_type: powershell
ansible_ssh_user: Administrator
ansible_password: somesecret
EXPECTED RESULTS

A jenkins agent to be installed.

ACTUAL RESULTS
TASK [lean_delivery.jenkins_slave : Install slave jenkins agent] *************************************************
fatal: [dnscloud-integration-win2019.ptata.xxx.de]: FAILED! => {"msg": "failed to resolve remote temporary directory from ansible-tmp-1584621901.9740524-168549963248385: `PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -EncodedCommand UwBlAHQALQBTAHQAcgBpAGMAdABNAG8AZABlACAALQBWAGUAcgBzAGkAbwBuACAATABhAHQAZQBzAHQACgAkAHQAbQBwAF8AcABhAHQAaAAgAD0AIABbAFMAeQBzAHQAZQBtAC4ARQBuAHYAaQByAG8AbgBtAGUAbgB0AF0AOgA6AEUAeABwAGEAbgBkAEUAbgB2AGkAcgBvAG4AbQBlAG4AdABWAGEAcgBpAGEAYgBsAGUAcwAoACcAQwA6AFwAVQBzAGUAcgBzAFwAQQBkAG0AaQBuAGkAcwB0AHIAYQB0AG8AcgBcAHQAZQBtAHAAJwApAAoAJAB0AG0AcAAgAD0AIABOAGUAdwAtAEkAdABlAG0AIAAtAFQAeQBwAGUAIABEAGkAcgBlAGMAdABvAHIAeQAgAC0AUABhAHQAaAAgACQAdABtAHAAXwBwAGEAdABoACAALQBOAGEAbQBlACAAJwBhAG4AcwBpAGIAbABlAC0AdABtAHAALQAxADUAOAA0ADYAMgAxADkAMAAxAC4AOQA3ADQAMAA1ADIANAAtADEANgA4ADUANAA5ADkANgAzADIANAA4ADMAOAA1ACcACgBXAHIAaQB0AGUALQBPAHUAdABwAHUAdAAgAC0ASQBuAHAAdQB0AE8AYgBqAGUAYwB0ACAAJAB0AG0AcAAuAEYAdQBsAGwATgBhAG0AZQAKAEkAZgAgACgALQBuAG8AdAAgACQAPwApACAAewAgAEkAZgAgACgARwBlAHQALQBWAGEAcgBpAGEAYgBsAGUAIABMAEEAUwBUAEUAWABJAFQAQwBPAEQARQAgAC0ARQByAHIAbwByAEEAYwB0AGkAbwBuACAAUwBpAGwAZQBuAHQAbAB5AEMAbwBuAHQAaQBuAHUAZQApACAAewAgAGUAeABpAHQAIAAkAEwAQQBTAFQARQBYAEkAVABDAE8ARABFACAAfQAgAEUAbABzAGUAIAB7ACAAZQB4AGkAdAAgADEAIAB9ACAAfQA=` returned empty string"}

Configuration to set service windows user

SUMMARY

Jenkins slave runner is executed on current local user. Could be great to override that value with specific user (seems to be supported by ansible https://docs.ansible.com/ansible/2.3/win_service_module.html)

slave_windows_service_user: foo
slave_windows_service_password: bar
ISSUE TYPE
  • Feature Idea
COMPONENT NAME

tasks/Win32NT/service.yml

ANSIBLE VERSION
ansible 2.7.0
  config file = None
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.15 (default, Aug 16 2018, 14:17:09) [GCC 6.4.0]

Windows Server 2019 did not get added as a Node in the Jenkins server

SUMMARY

Windows clients does not get added to the Jenkins server.

ISSUE TYPE
  • Bug Report
COMPONENT NAME
ANSIBLE VERSION
ansible 2.10.9
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/data/ansible-playbooks/plugins/modules']
  ansible python module location = /home/testuser1/.local/lib/python3.9/site-packages/ansible
  executable location = /home/testuser1/.local/bin/ansible
  python version = 3.9.4 (default, May 10 2021, 08:16:40) [GCC 9.3.0]
CONFIGURATION

BECOME_PLUGIN_PATH(/etc/ansible/ansible.cfg) = ['/data/ansible-playbooks/plugins/become']
COLLECTIONS_PATHS(/etc/ansible/ansible.cfg) = ['/data/ansible-playbooks/collections']
DEFAULT_ACTION_PLUGIN_PATH(/etc/ansible/ansible.cfg) = ['/data/ansible-playbooks/plugins/action']
DEFAULT_CACHE_PLUGIN_PATH(/etc/ansible/ansible.cfg) = ['/data/ansible-playbooks/plugins/cache']
DEFAULT_CALLBACK_PLUGIN_PATH(/etc/ansible/ansible.cfg) = ['/data/ansible-playbooks/plugins/callback']
DEFAULT_CONNECTION_PLUGIN_PATH(/etc/ansible/ansible.cfg) = ['/data/ansible-playbooks/plugins/connection']
DEFAULT_FILTER_PLUGIN_PATH(/etc/ansible/ansible.cfg) = ['/data/ansible-playbooks/plugins/filter']
DEFAULT_HOST_LIST(/etc/ansible/ansible.cfg) = ['/data/ansible-playbooks/hosts']
DEFAULT_INVENTORY_PLUGIN_PATH(/etc/ansible/ansible.cfg) = ['/data/ansible-playbooks/plugins/inventory']
DEFAULT_LOG_PATH(/etc/ansible/ansible.cfg) = /data/ansible-playbooks/log/ansible.log
DEFAULT_LOOKUP_PLUGIN_PATH(/etc/ansible/ansible.cfg) = ['/data/ansible-playbooks/plugins/lookup']
DEFAULT_MODULE_PATH(/etc/ansible/ansible.cfg) = ['/data/ansible-playbooks/plugins/modules']
DEFAULT_MODULE_UTILS_PATH(/etc/ansible/ansible.cfg) = ['/data/ansible-playbooks/plugins/module_utils']
DEFAULT_ROLES_PATH(/etc/ansible/ansible.cfg) = ['/data/ansible-playbooks/roles']
DEFAULT_STRATEGY_PLUGIN_PATH(/etc/ansible/ansible.cfg) = ['/data/ansible-playbooks/plugins/strategy']
DEFAULT_TERMINAL_PLUGIN_PATH(/etc/ansible/ansible.cfg) = ['/data/ansible-playbooks/plugins/terminal']
DEFAULT_TEST_PLUGIN_PATH(/etc/ansible/ansible.cfg) = ['/data/ansible-playbooks/plugins/test']
DEFAULT_VARS_PLUGIN_PATH(/etc/ansible/ansible.cfg) = ['/data/ansible-playbooks/plugins/vars']
DEFAULT_VAULT_PASSWORD_FILE(/etc/ansible/ansible.cfg) = /data/ansible-playbooks/vault/cookie_jar.sh
HOST_KEY_CHECKING(/etc/ansible/ansible.cfg) = False
INTERPRETER_PYTHON(/etc/ansible/ansible.cfg) = auto

OS / ENVIRONMENT

FROM: Ubuntu 20.04.2 LTS
TO: Windows Server 2019 version 1809

STEPS TO REPRODUCE
  1. add user to local administrators group
  2. grant user with 'Logon as Service' right
  3. run the command below.
    ansible-playbook -i test_inventory setup_jenkins_slave.yml -l testwin2019
---
 - name: setup_jenkins_slave
   hosts: all
   roles:
      - lean_delivery.jenkins_slave
EXPECTED RESULTS

The Windows 2019 server will be added as a node in the Jenkins server.

ACTUAL RESULTS

I did not encounter any errors when the playbook ran. I just expected that the Windows 2019 machine will be added as a node in the Jenkins server as the Linux machines did.

ansible-playbook -i test_inventory setup_jenkins_slave.yml -l testwin2019 

PLAY [setup_jenkins_slave] ****************************************************************************************

TASK [Gathering Facts] ********************************************************************************************
ok: [testwin2019]

TASK [lean_delivery.jenkins_slave : Load variables based on OS family] ********************************************
ok: [testwin2019] => (item=/data/ansible-playbooks/roles/lean_delivery.jenkins_slave/vars/Windows.yml)

TASK [lean_delivery.jenkins_slave : Install requirements] *********************************************************
skipping: [testwin2019]

TASK [lean_delivery.jenkins_slave : Choose platform based task] ***************************************************
included: /data/ansible-playbooks/roles/lean_delivery.jenkins_slave/tasks/Win32NT/Win32NT.yml for testwin2019 => (item=/data/ansible-playbooks/roles/lean_delivery.jenkins_slave/tasks/Win32NT/Win32NT.yml)

TASK [lean_delivery.jenkins_slave : Create slave home directory] **************************************************
changed: [testwin2019]

TASK [lean_delivery.jenkins_slave : Download slave.jar from master] ***********************************************
changed: [testwin2019]

TASK [lean_delivery.jenkins_slave : Install slave jenkins agent] **************************************************
ok: [testwin2019]

TASK [lean_delivery.jenkins_slave : Set jenkins slave secret] *****************************************************
ok: [testwin2019]

TASK [lean_delivery.jenkins_slave : Copy service file] ************************************************************
changed: [testwin2019]

TASK [lean_delivery.jenkins_slave : Install nssm] *****************************************************************
changed: [testwin2019]

TASK [lean_delivery.jenkins_slave : Create a service via nssm] ****************************************************
changed: [testwin2019]

TASK [lean_delivery.jenkins_slave : Start the service] ************************************************************
changed: [testwin2019]

PLAY RECAP ********************************************************************************************************
testwin2019                 : ok=11   changed=6    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0 

RHEL 8 install fails due to selinux config

SUMMARY

Using this role to setup an agent on RHEL 8 fails to setup the selinux support files.

ISSUE TYPE
  • Bug Report
COMPONENT NAME
ANSIBLE VERSION
ansible 2.9.5
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/usr/local/lib/python3.6/site-packages/pyateos/modules', '/usr/local/lib/python3.6/site-packages/git_acp/modules', '/usr/local/lib/python3.6/site-packages/napalm_ansible/modules']
  ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.6.8 (default, Aug 24 2020, 17:57:11) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]
CONFIGURATION

DEFAULT_ACTION_PLUGIN_PATH(/etc/ansible/ansible.cfg) = ['/usr/local/lib/python3.6/site-packages/napalm_ansible/plugins/action']
DEFAULT_FILTER_PLUGIN_PATH(/etc/ansible/ansible.cfg) = ['/usr/local/lib/python3.6/site-packages/ansible/plugins/filter']
DEFAULT_MODULE_PATH(/etc/ansible/ansible.cfg) = ['/usr/local/lib/python3.6/site-packages/pyateos/modules', '/usr/local/lib/python3.6/site->
DEFAULT_STDOUT_CALLBACK(/etc/ansible/ansible.cfg) = debug
DUPLICATE_YAML_DICT_KEY(/etc/ansible/ansible.cfg) = False
HOST_KEY_CHECKING(/etc/ansible/ansible.cfg) = False
PERSISTENT_COMMAND_TIMEOUT(/etc/ansible/ansible.cfg) = 60
PERSISTENT_CONNECT_TIMEOUT(/etc/ansible/ansible.cfg) = 60
RETRY_FILES_ENABLED(/etc/ansible/ansible.cfg) = False

OS / ENVIRONMENT

Running on RHEL 8.3.1-5
Configuring RHEL 8.3.1-5

STEPS TO REPRODUCE

Run the playbook with target_vm set to the vm to configure and appropriate credentials.

- name: Start Jenkins
  hosts: "{{ target_vm }}"
  become: true
  roles:
    - role: lean_delivery.java
      transport: repositories
      java_major_version: 8
    - role: lean_delivery.jenkins_slave
  vars:
    master_host: "{{ jenkins_master }}"
    master_username: "{{ jenkins_master_user }}"
    master_password: "{{ jenkins_master_password }}"
    slave_linux_jenkins_cred_id: agent_id
    slave_linux_jenkins_username: "{{ agent_user }}"
    slave_linux_jenkins_password: "{{ agent_password }}"
    slave_agent_name: linux_agent
    slave_linux_user_group: "{{ agent_user }}"
EXPECTED RESULTS

The task would choose the RHEL 8 version of the selinux python module and install it.

ACTUAL RESULTS

The task chooses the RHEL 7 version of the selinux python module.

FAILED! => {"attempts": 10, "changed": false, "failures": ["libselinux-python All matches were filtered out by modular filtering for argument: libselinux-python"], "msg": "Failed to install some of the specified packages", "rc": 1, "results": []}

Docker tests not working

SUMMARY

Jenkins slave not working on docker.

ISSUE TYPE
  • Bug Report
COMPONENT NAME
ANSIBLE VERSION
2.8.5
CONFIGURATION
OS / ENVIRONMENT

Linux, Docker

STEPS TO REPRODUCE
run molecule test -s default
EXPECTED RESULTS
ACTUAL RESULTS
    TASK [Assert that jenkins slave is working] ************************************
    Wednesday 09 October 2019  13:03:37 +0000 (0:00:00.234)       0:00:18.453 *****
    fatal: [test-docker-ubuntu1804-jenkins-slave]: FAILED! => changed=false 
      assertion: '''true'' in slave_info.output'
      evaluated_to: false
      msg: Assertion failed

After Linux VM reboot the jenkins slave is not running

SUMMARY

After the installation of Jenkins slave, when we reboot the machine the slave service is not running on Linux VM.

Is there a command to atleast start the Jenkins slave service on linux machine?

ISSUE TYPE
  • Bug Report
COMPONENT NAME

ansible-role-jenkins-slave

ANSIBLE VERSION

ansible 2.8.5
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/home/svc_engbuild/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.12 (default, Oct 8 2019, 14:14:10) [GCC 5.4.0 20160609]


CONFIGURATION
OS / ENVIRONMENT

Ubuntu 18

STEPS TO REPRODUCE
  tasks:
  - name: Install jre
    package:
      name: default-jre
      state: present
      update_cache: yes
    become: yes

  - include_role:
      name: "roles_galaxy/lean_delivery.jenkins_slave"

After rebooting the machine the jenkins service is not running.

EXPECTED RESULTS

Jenkins service should be running after reboot

ACTUAL RESULTS

Windows 10 install fails on Install slave jenkins agent TASK - unreachable

SUMMARY

Running the role on a windows 10 machine fails on the install slave jenkins agent task, with unreachable error.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

Windows
install slave jenkins agent task

ANSIBLE VERSION
ansible 2.9.7
  config file = None
  configured module search path = ['/home/valorahpadm/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.6.8 (default, Apr  2 2020, 13:34:55) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
CONFIGURATION

ansible_port=5986
ansible_winrm_transport=ntlm
validate_certs=false
ansible_winrm_server_cert_validation=ignore
ansible_connection=winrm

OS / ENVIRONMENT

CentOS Linux release 7.6.1810 (Core)

STEPS TO REPRODUCE
---
- hosts: playground
  roles:
    - lean_delivery.jenkins_slave
  vars:
    master_host: myjenkinsmasterhostname
    master_port: 8080
    master_username: myjenkinsuser
    master_password: "{{ myjenkinsuser_password }}"
    slave_windows_workdir: c:\Jenkins
    slave_windows_service: jenkins-slave
    slave_windows_java_opts: ""
    slave_executors_num: 5
    slave_windows_labels: 
      - "windows" 
EXPECTED RESULTS
ACTUAL RESULTS
TASK [jenkins_node_install : Install slave jenkins agent] **********************
task path: /opt/jenkins/workspace/ndows_gitlab_jenkinsnode-feature@2/ansible/roles/jenkins_node_install/tasks/Win32NT/agent.yml:2
File lookup using /opt/jenkins/workspace/ndows_gitlab_jenkinsnode-feature@2/ansible/roles/jenkins_node_install/templates/add_windows_slave.groovy.j2 as file
Using module file /usr/local/lib/python3.6/site-packages/ansible/modules/web_infrastructure/jenkins_script.py
Pipelining is enabled.
<localhost> ESTABLISH WINRM CONNECTION FOR USER: **** on PORT 5986 TO localhost
fatal: [ies-tester-w10]: UNREACHABLE! => {
    "changed": false,
    "msg": "ntlm: HTTPSConnectionPool(host='localhost', port=5986): Max retries exceeded with url: /wsman (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fde69bcdbe0>: Failed to establish a new connection: [Errno 111] Connection refused',))",
    "unreachable": true
}

PLAY RECAP *********************************************************************
ies-tester-w10             : ok=5    changed=0    unreachable=1    failed=0    skipped=1    rescued=0    ignored=0   

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.