Skip to content

Keep failing Jenkins Master config at the [beaker-client : copy CA cert if necessary] task  #257

Description

@Dannyb48

Trying to deploy a jenkins master in a a RHEL 7 VM with the following version of ansible and python

ansible 2.9.13
  config file = /home/dbaez/projects/jenks_cinch/jenkins_cinch_scenario/ansible.cfg
  configured module search path = ['/home/dbaez/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/dbaez/.virtualenvs/jenks_cinch/lib/python3.6/site-packages/ansible
  executable location = /home/dbaez/.virtualenvs/jenks_cinch/bin/ansible
  python version = 3.6.8 (default, Mar 21 2019, 10:08:12) [GCC 8.3.1 20190223 (Red Hat 8.3.1-2)]

The original error

"TASK [beaker-client : copy CA cert if necessary] *******************************",
2020-09-04 01:24:14,906 INFO [carbon.ansible_helpers.exec_local_cmd_pipe:558] "fatal: [10.0.101.40]: FAILED! => {\"msg\": \"No file was found when using first_found. Use errors='ignore' to allow this task to be skipped if no files are found\"}",

Closet thing I found was this ansible ticket ansible/ansible#58942

When I try the workaround mentioned in that ansible ticket, the error morphs to

TASK [beaker-client : copy CA cert if necessary] *******************************",
2020-09-04 14:33:09,838 INFO [carbon.ansible_helpers.exec_local_cmd_pipe:558] "fatal: [10.0.102.79]: FAILED! => {\"msg\": \"The task includes an option with an undefined variable. The error was: 'beaker_cacert_file' is undefined\\n\\nThe error appears to be in '/home/dbaez/projects/jenks_cinch/cinch/cinch/roles/beaker-client/tasks/main.yml': line 19, column 3, but may\\nbe elsewhere in the file depending on the exact syntax problem.\\n\\nThe offending line appears to be:\\n\\n\\n- name: copy CA cert if necessary\\n  ^ here\\n\"}",

Turns out that variable beaker_cacert_file is commented out in the beaker-client vars/defaults.yml. If I set to a blank value like this
beaker_cacert_file: ""

I still get problems but to be honest I don't have a need to use a custom cacert file because the certificate_authority role already sets some up by default for me.

Only way I could get passed this task to finalize the jenkins master config deployment successfully is with the following:

- name: copy CA cert if necessary
  become: true
  copy:
    src: "{{ lookup('first_found', bkrcert, errors='ignore') }}"
    dest: "{{ beaker_ca_cert_path }}"
    owner: root
    group: root
    mode: 0644
  vars:
    bkrcert:
      files:
        - "{{ beaker_cacert_file }}"
      skip: true
  when: beaker_cacert_file is defined

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions