Ansible AWX step fails when using DSL for Jenkins job












0














I'm running a Jenkins 2.140 server on Ubuntu 16.04 as well as an Ansible AWX 1.0.7.2 server using Ansible 2.6.2.



I'm creating a job in Jenkins which runs a template on my Ansible AWX server. I've got several other Jenkins jobs that run templates that all work so I know the general configuration I am using for this is OK.



However when I create the Jenkins job using a seed job which uses the JobDSL, the job fails at the Ansible AWX step with this output:



11:50:42 [EnvInject] - Loading node environment variables.
11:50:42 Building remotely on windows-slave (excel Windows orqaheadless windows) in workspace C:JenkinsSlaveworkspacecreate-ec2-instance-2
11:50:42 ERROR: Build step failed with exception
11:50:42 java.lang.NullPointerException
11:50:42 at org.jenkinsci.plugins.ansible_tower.AnsibleTower.perform(AnsibleTower.java:129)
11:50:42 at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
11:50:42 at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
11:50:42 at hudson.model.Build$BuildExecution.build(Build.java:206)
11:50:42 at hudson.model.Build$BuildExecution.doRun(Build.java:163)
11:50:42 at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
11:50:42 at hudson.model.Run.execute(Run.java:1815)
11:50:42 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
11:50:42 at hudson.model.ResourceController.execute(ResourceController.java:97)
11:50:42 at hudson.model.Executor.run(Executor.java:429)
11:50:42 Build step 'Ansible Tower' marked build as failure
11:50:42 [BFA] Scanning build for known causes...
11:50:42 [BFA] No failure causes found
11:50:42 [BFA] Done. 0s
11:50:42 Started calculate disk usage of build
11:50:42 Finished Calculation of disk usage of build in 0 seconds
11:50:42 Started calculate disk usage of workspace
11:50:42 Finished Calculation of disk usage of workspace in 0 seconds
11:50:42 Finished: FAILURE


That output doesn't really give me anything to work with especially as I'm no Java expert.



I configure the Jenkins job manually and all is well. This is the config.xml for the working job (only the AWX part). Note that all of these extra variables are passed in earlier in the job as parameters:



<builders>
<org.jenkinsci.plugins.ansible__tower.AnsibleTower plugin="ansible-tower@0.9.0">
<towerServer>AWX Server</towerServer>
<jobTemplate>create-ec2-instance</jobTemplate>
<extraVars>
key_name: ${key_name} ec2_termination_protection: ${ec2_termination_protection} vpc_subnet_id: ${vpc_subnet_id} security_groups: ${security_groups} instance_type: ${instance_type} instance_profile_name: ${instance_profile_name} assign_public_ip: ${assign_public_ip} region: ${region} image: ${image} instance_tags: ${instance_tags} ec2_wait_for_create: ${ec2_wait_for_create} ec2_wait_for_create_timeout: ${ec2_wait_for_create_timeout} exact_count: ${exact_count} delete_volume_on_termination: ${delete_volume_on_termination} data_disk_size: ${data_disk_size} private_domain: ${private_domain} route53_private_record_ttl: ${route53_private_record_ttl} dns_record: ${dns_record} elastic_ip: ${elastic_ip}
</extraVars>
<jobTags/>
<skipJobTags/>
<jobType>run</jobType>
<limit/>
<inventory/>
<credential/>
<verbose>true</verbose>
<importTowerLogs>true</importTowerLogs>
<removeColor>false</removeColor>
<templateType>job</templateType>
<importWorkflowChildLogs>false</importWorkflowChildLogs>
</org.jenkinsci.plugins.ansible__tower.AnsibleTower>
</builders>


And the config.xml from the failing, JobDSL-generated job, which looks the same to me:



<builders>
<org.jenkinsci.plugins.ansible__tower.AnsibleTower>
<towerServer>AWX Server</towerServer>
<jobTemplate>create-ec2-instance</jobTemplate>
<jobType>run</jobType>
<templateType>job</templateType>
<extraVars>
key_name: ${key_name} ec2_termination_protection: ${ec2_termination_protection} vpc_subnet_id: ${vpc_subnet_id} security_groups: ${security_groups} instance_type: ${instance_type} instance_profile_name: ${instance_profile_name} assign_public_ip: ${assign_public_ip} region: ${region} image: ${image} instance_tags: ${instance_tags} ec2_wait_for_create: ${ec2_wait_for_create} ec2_wait_for_create_timeout: ${ec2_wait_for_create_timeout} exact_count: ${exact_count} delete_volume_on_termination: ${delete_volume_on_termination} data_disk_size: ${data_disk_size} private_domain: ${private_domain} route53_private_record_ttl: ${route53_private_record_ttl} dns_record: ${dns_record} elastic_ip: ${elastic_ip}
</extraVars>
<verbose>true</verbose>
<importTowerLogs>true</importTowerLogs>
</org.jenkinsci.plugins.ansible__tower.AnsibleTower>
</builders>


So there are some expected differences you always get with JobDSL-generated jobs, such as the empty fields are missing, but this is the case with all of our (successful) other jobs that follow this process.



The JobDSL script is here:



    configure { project ->
project / 'builders ' << 'org.jenkinsci.plugins.ansible__tower.AnsibleTower' {
towerServer 'AWX Server'
jobTemplate ('create-ec2-instance')
templateType 'job'
jobType 'run'
extraVars('''key_name: ${key_name}
ec2_termination_protection: ${ec2_termination_protection}
vpc_subnet_id: ${vpc_subnet_id}
security_groups: ${security_groups}
instance_type: ${instance_type}
instance_profile_name: ${instance_profile_name}
assign_public_ip: ${assign_public_ip}
region: ${region} image: ${image}
instance_tags: ${instance_tags}
ec2_wait_for_create: ${ec2_wait_for_create}
ec2_wait_for_create_timeout: ${ec2_wait_for_create_timeout}
exact_count: ${exact_count}
delete_volume_on_termination: ${delete_volume_on_termination}
data_disk_size: ${data_disk_size}
private_domain: ${private_domain}
route53_private_record_ttl: ${route53_private_record_ttl}
dns_record: ${dns_record}
elastic_ip: ${elastic_ip}''')
verbose 'true'
importTowerLogs 'true'
}
}


The job that this generates looks identical in the UI (as well as the XML) to my eye, and yet I keep getting that failure when I run it. Clearly I'm missing something but I can't for the life if me see what.










share|improve this question



























    0














    I'm running a Jenkins 2.140 server on Ubuntu 16.04 as well as an Ansible AWX 1.0.7.2 server using Ansible 2.6.2.



    I'm creating a job in Jenkins which runs a template on my Ansible AWX server. I've got several other Jenkins jobs that run templates that all work so I know the general configuration I am using for this is OK.



    However when I create the Jenkins job using a seed job which uses the JobDSL, the job fails at the Ansible AWX step with this output:



    11:50:42 [EnvInject] - Loading node environment variables.
    11:50:42 Building remotely on windows-slave (excel Windows orqaheadless windows) in workspace C:JenkinsSlaveworkspacecreate-ec2-instance-2
    11:50:42 ERROR: Build step failed with exception
    11:50:42 java.lang.NullPointerException
    11:50:42 at org.jenkinsci.plugins.ansible_tower.AnsibleTower.perform(AnsibleTower.java:129)
    11:50:42 at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    11:50:42 at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
    11:50:42 at hudson.model.Build$BuildExecution.build(Build.java:206)
    11:50:42 at hudson.model.Build$BuildExecution.doRun(Build.java:163)
    11:50:42 at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
    11:50:42 at hudson.model.Run.execute(Run.java:1815)
    11:50:42 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    11:50:42 at hudson.model.ResourceController.execute(ResourceController.java:97)
    11:50:42 at hudson.model.Executor.run(Executor.java:429)
    11:50:42 Build step 'Ansible Tower' marked build as failure
    11:50:42 [BFA] Scanning build for known causes...
    11:50:42 [BFA] No failure causes found
    11:50:42 [BFA] Done. 0s
    11:50:42 Started calculate disk usage of build
    11:50:42 Finished Calculation of disk usage of build in 0 seconds
    11:50:42 Started calculate disk usage of workspace
    11:50:42 Finished Calculation of disk usage of workspace in 0 seconds
    11:50:42 Finished: FAILURE


    That output doesn't really give me anything to work with especially as I'm no Java expert.



    I configure the Jenkins job manually and all is well. This is the config.xml for the working job (only the AWX part). Note that all of these extra variables are passed in earlier in the job as parameters:



    <builders>
    <org.jenkinsci.plugins.ansible__tower.AnsibleTower plugin="ansible-tower@0.9.0">
    <towerServer>AWX Server</towerServer>
    <jobTemplate>create-ec2-instance</jobTemplate>
    <extraVars>
    key_name: ${key_name} ec2_termination_protection: ${ec2_termination_protection} vpc_subnet_id: ${vpc_subnet_id} security_groups: ${security_groups} instance_type: ${instance_type} instance_profile_name: ${instance_profile_name} assign_public_ip: ${assign_public_ip} region: ${region} image: ${image} instance_tags: ${instance_tags} ec2_wait_for_create: ${ec2_wait_for_create} ec2_wait_for_create_timeout: ${ec2_wait_for_create_timeout} exact_count: ${exact_count} delete_volume_on_termination: ${delete_volume_on_termination} data_disk_size: ${data_disk_size} private_domain: ${private_domain} route53_private_record_ttl: ${route53_private_record_ttl} dns_record: ${dns_record} elastic_ip: ${elastic_ip}
    </extraVars>
    <jobTags/>
    <skipJobTags/>
    <jobType>run</jobType>
    <limit/>
    <inventory/>
    <credential/>
    <verbose>true</verbose>
    <importTowerLogs>true</importTowerLogs>
    <removeColor>false</removeColor>
    <templateType>job</templateType>
    <importWorkflowChildLogs>false</importWorkflowChildLogs>
    </org.jenkinsci.plugins.ansible__tower.AnsibleTower>
    </builders>


    And the config.xml from the failing, JobDSL-generated job, which looks the same to me:



    <builders>
    <org.jenkinsci.plugins.ansible__tower.AnsibleTower>
    <towerServer>AWX Server</towerServer>
    <jobTemplate>create-ec2-instance</jobTemplate>
    <jobType>run</jobType>
    <templateType>job</templateType>
    <extraVars>
    key_name: ${key_name} ec2_termination_protection: ${ec2_termination_protection} vpc_subnet_id: ${vpc_subnet_id} security_groups: ${security_groups} instance_type: ${instance_type} instance_profile_name: ${instance_profile_name} assign_public_ip: ${assign_public_ip} region: ${region} image: ${image} instance_tags: ${instance_tags} ec2_wait_for_create: ${ec2_wait_for_create} ec2_wait_for_create_timeout: ${ec2_wait_for_create_timeout} exact_count: ${exact_count} delete_volume_on_termination: ${delete_volume_on_termination} data_disk_size: ${data_disk_size} private_domain: ${private_domain} route53_private_record_ttl: ${route53_private_record_ttl} dns_record: ${dns_record} elastic_ip: ${elastic_ip}
    </extraVars>
    <verbose>true</verbose>
    <importTowerLogs>true</importTowerLogs>
    </org.jenkinsci.plugins.ansible__tower.AnsibleTower>
    </builders>


    So there are some expected differences you always get with JobDSL-generated jobs, such as the empty fields are missing, but this is the case with all of our (successful) other jobs that follow this process.



    The JobDSL script is here:



        configure { project ->
    project / 'builders ' << 'org.jenkinsci.plugins.ansible__tower.AnsibleTower' {
    towerServer 'AWX Server'
    jobTemplate ('create-ec2-instance')
    templateType 'job'
    jobType 'run'
    extraVars('''key_name: ${key_name}
    ec2_termination_protection: ${ec2_termination_protection}
    vpc_subnet_id: ${vpc_subnet_id}
    security_groups: ${security_groups}
    instance_type: ${instance_type}
    instance_profile_name: ${instance_profile_name}
    assign_public_ip: ${assign_public_ip}
    region: ${region} image: ${image}
    instance_tags: ${instance_tags}
    ec2_wait_for_create: ${ec2_wait_for_create}
    ec2_wait_for_create_timeout: ${ec2_wait_for_create_timeout}
    exact_count: ${exact_count}
    delete_volume_on_termination: ${delete_volume_on_termination}
    data_disk_size: ${data_disk_size}
    private_domain: ${private_domain}
    route53_private_record_ttl: ${route53_private_record_ttl}
    dns_record: ${dns_record}
    elastic_ip: ${elastic_ip}''')
    verbose 'true'
    importTowerLogs 'true'
    }
    }


    The job that this generates looks identical in the UI (as well as the XML) to my eye, and yet I keep getting that failure when I run it. Clearly I'm missing something but I can't for the life if me see what.










    share|improve this question

























      0












      0








      0







      I'm running a Jenkins 2.140 server on Ubuntu 16.04 as well as an Ansible AWX 1.0.7.2 server using Ansible 2.6.2.



      I'm creating a job in Jenkins which runs a template on my Ansible AWX server. I've got several other Jenkins jobs that run templates that all work so I know the general configuration I am using for this is OK.



      However when I create the Jenkins job using a seed job which uses the JobDSL, the job fails at the Ansible AWX step with this output:



      11:50:42 [EnvInject] - Loading node environment variables.
      11:50:42 Building remotely on windows-slave (excel Windows orqaheadless windows) in workspace C:JenkinsSlaveworkspacecreate-ec2-instance-2
      11:50:42 ERROR: Build step failed with exception
      11:50:42 java.lang.NullPointerException
      11:50:42 at org.jenkinsci.plugins.ansible_tower.AnsibleTower.perform(AnsibleTower.java:129)
      11:50:42 at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      11:50:42 at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
      11:50:42 at hudson.model.Build$BuildExecution.build(Build.java:206)
      11:50:42 at hudson.model.Build$BuildExecution.doRun(Build.java:163)
      11:50:42 at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
      11:50:42 at hudson.model.Run.execute(Run.java:1815)
      11:50:42 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      11:50:42 at hudson.model.ResourceController.execute(ResourceController.java:97)
      11:50:42 at hudson.model.Executor.run(Executor.java:429)
      11:50:42 Build step 'Ansible Tower' marked build as failure
      11:50:42 [BFA] Scanning build for known causes...
      11:50:42 [BFA] No failure causes found
      11:50:42 [BFA] Done. 0s
      11:50:42 Started calculate disk usage of build
      11:50:42 Finished Calculation of disk usage of build in 0 seconds
      11:50:42 Started calculate disk usage of workspace
      11:50:42 Finished Calculation of disk usage of workspace in 0 seconds
      11:50:42 Finished: FAILURE


      That output doesn't really give me anything to work with especially as I'm no Java expert.



      I configure the Jenkins job manually and all is well. This is the config.xml for the working job (only the AWX part). Note that all of these extra variables are passed in earlier in the job as parameters:



      <builders>
      <org.jenkinsci.plugins.ansible__tower.AnsibleTower plugin="ansible-tower@0.9.0">
      <towerServer>AWX Server</towerServer>
      <jobTemplate>create-ec2-instance</jobTemplate>
      <extraVars>
      key_name: ${key_name} ec2_termination_protection: ${ec2_termination_protection} vpc_subnet_id: ${vpc_subnet_id} security_groups: ${security_groups} instance_type: ${instance_type} instance_profile_name: ${instance_profile_name} assign_public_ip: ${assign_public_ip} region: ${region} image: ${image} instance_tags: ${instance_tags} ec2_wait_for_create: ${ec2_wait_for_create} ec2_wait_for_create_timeout: ${ec2_wait_for_create_timeout} exact_count: ${exact_count} delete_volume_on_termination: ${delete_volume_on_termination} data_disk_size: ${data_disk_size} private_domain: ${private_domain} route53_private_record_ttl: ${route53_private_record_ttl} dns_record: ${dns_record} elastic_ip: ${elastic_ip}
      </extraVars>
      <jobTags/>
      <skipJobTags/>
      <jobType>run</jobType>
      <limit/>
      <inventory/>
      <credential/>
      <verbose>true</verbose>
      <importTowerLogs>true</importTowerLogs>
      <removeColor>false</removeColor>
      <templateType>job</templateType>
      <importWorkflowChildLogs>false</importWorkflowChildLogs>
      </org.jenkinsci.plugins.ansible__tower.AnsibleTower>
      </builders>


      And the config.xml from the failing, JobDSL-generated job, which looks the same to me:



      <builders>
      <org.jenkinsci.plugins.ansible__tower.AnsibleTower>
      <towerServer>AWX Server</towerServer>
      <jobTemplate>create-ec2-instance</jobTemplate>
      <jobType>run</jobType>
      <templateType>job</templateType>
      <extraVars>
      key_name: ${key_name} ec2_termination_protection: ${ec2_termination_protection} vpc_subnet_id: ${vpc_subnet_id} security_groups: ${security_groups} instance_type: ${instance_type} instance_profile_name: ${instance_profile_name} assign_public_ip: ${assign_public_ip} region: ${region} image: ${image} instance_tags: ${instance_tags} ec2_wait_for_create: ${ec2_wait_for_create} ec2_wait_for_create_timeout: ${ec2_wait_for_create_timeout} exact_count: ${exact_count} delete_volume_on_termination: ${delete_volume_on_termination} data_disk_size: ${data_disk_size} private_domain: ${private_domain} route53_private_record_ttl: ${route53_private_record_ttl} dns_record: ${dns_record} elastic_ip: ${elastic_ip}
      </extraVars>
      <verbose>true</verbose>
      <importTowerLogs>true</importTowerLogs>
      </org.jenkinsci.plugins.ansible__tower.AnsibleTower>
      </builders>


      So there are some expected differences you always get with JobDSL-generated jobs, such as the empty fields are missing, but this is the case with all of our (successful) other jobs that follow this process.



      The JobDSL script is here:



          configure { project ->
      project / 'builders ' << 'org.jenkinsci.plugins.ansible__tower.AnsibleTower' {
      towerServer 'AWX Server'
      jobTemplate ('create-ec2-instance')
      templateType 'job'
      jobType 'run'
      extraVars('''key_name: ${key_name}
      ec2_termination_protection: ${ec2_termination_protection}
      vpc_subnet_id: ${vpc_subnet_id}
      security_groups: ${security_groups}
      instance_type: ${instance_type}
      instance_profile_name: ${instance_profile_name}
      assign_public_ip: ${assign_public_ip}
      region: ${region} image: ${image}
      instance_tags: ${instance_tags}
      ec2_wait_for_create: ${ec2_wait_for_create}
      ec2_wait_for_create_timeout: ${ec2_wait_for_create_timeout}
      exact_count: ${exact_count}
      delete_volume_on_termination: ${delete_volume_on_termination}
      data_disk_size: ${data_disk_size}
      private_domain: ${private_domain}
      route53_private_record_ttl: ${route53_private_record_ttl}
      dns_record: ${dns_record}
      elastic_ip: ${elastic_ip}''')
      verbose 'true'
      importTowerLogs 'true'
      }
      }


      The job that this generates looks identical in the UI (as well as the XML) to my eye, and yet I keep getting that failure when I run it. Clearly I'm missing something but I can't for the life if me see what.










      share|improve this question













      I'm running a Jenkins 2.140 server on Ubuntu 16.04 as well as an Ansible AWX 1.0.7.2 server using Ansible 2.6.2.



      I'm creating a job in Jenkins which runs a template on my Ansible AWX server. I've got several other Jenkins jobs that run templates that all work so I know the general configuration I am using for this is OK.



      However when I create the Jenkins job using a seed job which uses the JobDSL, the job fails at the Ansible AWX step with this output:



      11:50:42 [EnvInject] - Loading node environment variables.
      11:50:42 Building remotely on windows-slave (excel Windows orqaheadless windows) in workspace C:JenkinsSlaveworkspacecreate-ec2-instance-2
      11:50:42 ERROR: Build step failed with exception
      11:50:42 java.lang.NullPointerException
      11:50:42 at org.jenkinsci.plugins.ansible_tower.AnsibleTower.perform(AnsibleTower.java:129)
      11:50:42 at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      11:50:42 at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
      11:50:42 at hudson.model.Build$BuildExecution.build(Build.java:206)
      11:50:42 at hudson.model.Build$BuildExecution.doRun(Build.java:163)
      11:50:42 at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
      11:50:42 at hudson.model.Run.execute(Run.java:1815)
      11:50:42 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      11:50:42 at hudson.model.ResourceController.execute(ResourceController.java:97)
      11:50:42 at hudson.model.Executor.run(Executor.java:429)
      11:50:42 Build step 'Ansible Tower' marked build as failure
      11:50:42 [BFA] Scanning build for known causes...
      11:50:42 [BFA] No failure causes found
      11:50:42 [BFA] Done. 0s
      11:50:42 Started calculate disk usage of build
      11:50:42 Finished Calculation of disk usage of build in 0 seconds
      11:50:42 Started calculate disk usage of workspace
      11:50:42 Finished Calculation of disk usage of workspace in 0 seconds
      11:50:42 Finished: FAILURE


      That output doesn't really give me anything to work with especially as I'm no Java expert.



      I configure the Jenkins job manually and all is well. This is the config.xml for the working job (only the AWX part). Note that all of these extra variables are passed in earlier in the job as parameters:



      <builders>
      <org.jenkinsci.plugins.ansible__tower.AnsibleTower plugin="ansible-tower@0.9.0">
      <towerServer>AWX Server</towerServer>
      <jobTemplate>create-ec2-instance</jobTemplate>
      <extraVars>
      key_name: ${key_name} ec2_termination_protection: ${ec2_termination_protection} vpc_subnet_id: ${vpc_subnet_id} security_groups: ${security_groups} instance_type: ${instance_type} instance_profile_name: ${instance_profile_name} assign_public_ip: ${assign_public_ip} region: ${region} image: ${image} instance_tags: ${instance_tags} ec2_wait_for_create: ${ec2_wait_for_create} ec2_wait_for_create_timeout: ${ec2_wait_for_create_timeout} exact_count: ${exact_count} delete_volume_on_termination: ${delete_volume_on_termination} data_disk_size: ${data_disk_size} private_domain: ${private_domain} route53_private_record_ttl: ${route53_private_record_ttl} dns_record: ${dns_record} elastic_ip: ${elastic_ip}
      </extraVars>
      <jobTags/>
      <skipJobTags/>
      <jobType>run</jobType>
      <limit/>
      <inventory/>
      <credential/>
      <verbose>true</verbose>
      <importTowerLogs>true</importTowerLogs>
      <removeColor>false</removeColor>
      <templateType>job</templateType>
      <importWorkflowChildLogs>false</importWorkflowChildLogs>
      </org.jenkinsci.plugins.ansible__tower.AnsibleTower>
      </builders>


      And the config.xml from the failing, JobDSL-generated job, which looks the same to me:



      <builders>
      <org.jenkinsci.plugins.ansible__tower.AnsibleTower>
      <towerServer>AWX Server</towerServer>
      <jobTemplate>create-ec2-instance</jobTemplate>
      <jobType>run</jobType>
      <templateType>job</templateType>
      <extraVars>
      key_name: ${key_name} ec2_termination_protection: ${ec2_termination_protection} vpc_subnet_id: ${vpc_subnet_id} security_groups: ${security_groups} instance_type: ${instance_type} instance_profile_name: ${instance_profile_name} assign_public_ip: ${assign_public_ip} region: ${region} image: ${image} instance_tags: ${instance_tags} ec2_wait_for_create: ${ec2_wait_for_create} ec2_wait_for_create_timeout: ${ec2_wait_for_create_timeout} exact_count: ${exact_count} delete_volume_on_termination: ${delete_volume_on_termination} data_disk_size: ${data_disk_size} private_domain: ${private_domain} route53_private_record_ttl: ${route53_private_record_ttl} dns_record: ${dns_record} elastic_ip: ${elastic_ip}
      </extraVars>
      <verbose>true</verbose>
      <importTowerLogs>true</importTowerLogs>
      </org.jenkinsci.plugins.ansible__tower.AnsibleTower>
      </builders>


      So there are some expected differences you always get with JobDSL-generated jobs, such as the empty fields are missing, but this is the case with all of our (successful) other jobs that follow this process.



      The JobDSL script is here:



          configure { project ->
      project / 'builders ' << 'org.jenkinsci.plugins.ansible__tower.AnsibleTower' {
      towerServer 'AWX Server'
      jobTemplate ('create-ec2-instance')
      templateType 'job'
      jobType 'run'
      extraVars('''key_name: ${key_name}
      ec2_termination_protection: ${ec2_termination_protection}
      vpc_subnet_id: ${vpc_subnet_id}
      security_groups: ${security_groups}
      instance_type: ${instance_type}
      instance_profile_name: ${instance_profile_name}
      assign_public_ip: ${assign_public_ip}
      region: ${region} image: ${image}
      instance_tags: ${instance_tags}
      ec2_wait_for_create: ${ec2_wait_for_create}
      ec2_wait_for_create_timeout: ${ec2_wait_for_create_timeout}
      exact_count: ${exact_count}
      delete_volume_on_termination: ${delete_volume_on_termination}
      data_disk_size: ${data_disk_size}
      private_domain: ${private_domain}
      route53_private_record_ttl: ${route53_private_record_ttl}
      dns_record: ${dns_record}
      elastic_ip: ${elastic_ip}''')
      verbose 'true'
      importTowerLogs 'true'
      }
      }


      The job that this generates looks identical in the UI (as well as the XML) to my eye, and yet I keep getting that failure when I run it. Clearly I'm missing something but I can't for the life if me see what.







      jenkins-job-dsl ansible-tower ansible-awx






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 23 '18 at 12:28









      shaneohshaneoh

      1431215




      1431215
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Despite the fact that other AWX jobs build without this, I added the missing (empty) fields, and the job started succeeding.



          So, change my JobDSL script to this:



              configure { project ->
          project / 'builders ' << 'org.jenkinsci.plugins.ansible__tower.AnsibleTower' {
          towerServer 'AWX Server'
          jobTemplate ('create-ec2-instance')
          extraVars('''key_name: ${key_name}
          ec2_termination_protection: ${ec2_termination_protection}
          vpc_subnet_id: ${vpc_subnet_id}
          security_groups: ${security_groups}
          instance_type: ${instance_type}
          instance_profile_name: ${instance_profile_name}
          assign_public_ip: ${assign_public_ip}
          region: ${region}
          image: ${image}
          instance_tags: ${instance_tags}
          ec2_wait_for_create: ${ec2_wait_for_create}
          ec2_wait_for_create_timeout: ${ec2_wait_for_create_timeout}
          exact_count: ${exact_count}
          delete_volume_on_termination: ${delete_volume_on_termination}
          data_disk_size: ${data_disk_size}
          private_domain: ${private_domain}
          route53_private_record_ttl: ${route53_private_record_ttl}
          dns_record: ${dns_record}
          elastic_ip: ${elastic_ip}''')
          jobTags ''
          skipJobTags ''
          jobType 'run'
          limit ''
          inventory ''
          credential ''
          verbose 'true'
          importTowerLogs 'true'
          removeColor ''
          templateType 'job'
          importWorkflowChildLogs ''


          And now working as expected.






          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53446746%2fansible-awx-step-fails-when-using-dsl-for-jenkins-job%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Despite the fact that other AWX jobs build without this, I added the missing (empty) fields, and the job started succeeding.



            So, change my JobDSL script to this:



                configure { project ->
            project / 'builders ' << 'org.jenkinsci.plugins.ansible__tower.AnsibleTower' {
            towerServer 'AWX Server'
            jobTemplate ('create-ec2-instance')
            extraVars('''key_name: ${key_name}
            ec2_termination_protection: ${ec2_termination_protection}
            vpc_subnet_id: ${vpc_subnet_id}
            security_groups: ${security_groups}
            instance_type: ${instance_type}
            instance_profile_name: ${instance_profile_name}
            assign_public_ip: ${assign_public_ip}
            region: ${region}
            image: ${image}
            instance_tags: ${instance_tags}
            ec2_wait_for_create: ${ec2_wait_for_create}
            ec2_wait_for_create_timeout: ${ec2_wait_for_create_timeout}
            exact_count: ${exact_count}
            delete_volume_on_termination: ${delete_volume_on_termination}
            data_disk_size: ${data_disk_size}
            private_domain: ${private_domain}
            route53_private_record_ttl: ${route53_private_record_ttl}
            dns_record: ${dns_record}
            elastic_ip: ${elastic_ip}''')
            jobTags ''
            skipJobTags ''
            jobType 'run'
            limit ''
            inventory ''
            credential ''
            verbose 'true'
            importTowerLogs 'true'
            removeColor ''
            templateType 'job'
            importWorkflowChildLogs ''


            And now working as expected.






            share|improve this answer


























              0














              Despite the fact that other AWX jobs build without this, I added the missing (empty) fields, and the job started succeeding.



              So, change my JobDSL script to this:



                  configure { project ->
              project / 'builders ' << 'org.jenkinsci.plugins.ansible__tower.AnsibleTower' {
              towerServer 'AWX Server'
              jobTemplate ('create-ec2-instance')
              extraVars('''key_name: ${key_name}
              ec2_termination_protection: ${ec2_termination_protection}
              vpc_subnet_id: ${vpc_subnet_id}
              security_groups: ${security_groups}
              instance_type: ${instance_type}
              instance_profile_name: ${instance_profile_name}
              assign_public_ip: ${assign_public_ip}
              region: ${region}
              image: ${image}
              instance_tags: ${instance_tags}
              ec2_wait_for_create: ${ec2_wait_for_create}
              ec2_wait_for_create_timeout: ${ec2_wait_for_create_timeout}
              exact_count: ${exact_count}
              delete_volume_on_termination: ${delete_volume_on_termination}
              data_disk_size: ${data_disk_size}
              private_domain: ${private_domain}
              route53_private_record_ttl: ${route53_private_record_ttl}
              dns_record: ${dns_record}
              elastic_ip: ${elastic_ip}''')
              jobTags ''
              skipJobTags ''
              jobType 'run'
              limit ''
              inventory ''
              credential ''
              verbose 'true'
              importTowerLogs 'true'
              removeColor ''
              templateType 'job'
              importWorkflowChildLogs ''


              And now working as expected.






              share|improve this answer
























                0












                0








                0






                Despite the fact that other AWX jobs build without this, I added the missing (empty) fields, and the job started succeeding.



                So, change my JobDSL script to this:



                    configure { project ->
                project / 'builders ' << 'org.jenkinsci.plugins.ansible__tower.AnsibleTower' {
                towerServer 'AWX Server'
                jobTemplate ('create-ec2-instance')
                extraVars('''key_name: ${key_name}
                ec2_termination_protection: ${ec2_termination_protection}
                vpc_subnet_id: ${vpc_subnet_id}
                security_groups: ${security_groups}
                instance_type: ${instance_type}
                instance_profile_name: ${instance_profile_name}
                assign_public_ip: ${assign_public_ip}
                region: ${region}
                image: ${image}
                instance_tags: ${instance_tags}
                ec2_wait_for_create: ${ec2_wait_for_create}
                ec2_wait_for_create_timeout: ${ec2_wait_for_create_timeout}
                exact_count: ${exact_count}
                delete_volume_on_termination: ${delete_volume_on_termination}
                data_disk_size: ${data_disk_size}
                private_domain: ${private_domain}
                route53_private_record_ttl: ${route53_private_record_ttl}
                dns_record: ${dns_record}
                elastic_ip: ${elastic_ip}''')
                jobTags ''
                skipJobTags ''
                jobType 'run'
                limit ''
                inventory ''
                credential ''
                verbose 'true'
                importTowerLogs 'true'
                removeColor ''
                templateType 'job'
                importWorkflowChildLogs ''


                And now working as expected.






                share|improve this answer












                Despite the fact that other AWX jobs build without this, I added the missing (empty) fields, and the job started succeeding.



                So, change my JobDSL script to this:



                    configure { project ->
                project / 'builders ' << 'org.jenkinsci.plugins.ansible__tower.AnsibleTower' {
                towerServer 'AWX Server'
                jobTemplate ('create-ec2-instance')
                extraVars('''key_name: ${key_name}
                ec2_termination_protection: ${ec2_termination_protection}
                vpc_subnet_id: ${vpc_subnet_id}
                security_groups: ${security_groups}
                instance_type: ${instance_type}
                instance_profile_name: ${instance_profile_name}
                assign_public_ip: ${assign_public_ip}
                region: ${region}
                image: ${image}
                instance_tags: ${instance_tags}
                ec2_wait_for_create: ${ec2_wait_for_create}
                ec2_wait_for_create_timeout: ${ec2_wait_for_create_timeout}
                exact_count: ${exact_count}
                delete_volume_on_termination: ${delete_volume_on_termination}
                data_disk_size: ${data_disk_size}
                private_domain: ${private_domain}
                route53_private_record_ttl: ${route53_private_record_ttl}
                dns_record: ${dns_record}
                elastic_ip: ${elastic_ip}''')
                jobTags ''
                skipJobTags ''
                jobType 'run'
                limit ''
                inventory ''
                credential ''
                verbose 'true'
                importTowerLogs 'true'
                removeColor ''
                templateType 'job'
                importWorkflowChildLogs ''


                And now working as expected.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 26 '18 at 12:31









                shaneohshaneoh

                1431215




                1431215






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53446746%2fansible-awx-step-fails-when-using-dsl-for-jenkins-job%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    What visual should I use to simply compare current year value vs last year in Power BI desktop

                    How to ignore python UserWarning in pytest?

                    Alexandru Averescu