From a4c0df1ded824bce0e27db789270991fbf943539 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Mon, 31 Jul 2023 08:37:15 +0200 Subject: [PATCH] [PR #6991/00bfc3e1 backport][stable-7] Add example for ECS Fargate/EFS Jenkins authentication (#7016) Add example for ECS Fargate/EFS Jenkins authentication (#6991) * Add example for ECS Fargate/EFS Jenkins authentication Since ECS Fargate is serverless, one cannot access its jenkins_home other than from a machine (EC2 for example) that actually mounts and owns its EFS storage. That way we provide user/group of a defatul local user which has the same uid/gid 1000 as the default jenkins user inside the container and also can authenticate at Jenkins URL. I feel this is not as straightforward from the docs and someone might benefit from such an example being present * Added an empty line * Float value now in single quotes * Use UID/GID instead user/group name (cherry picked from commit 00bfc3e13133ff5dd83481c6638d94e81d1d6c2a) Co-authored-by: TeekWan <74403302+teekwan@users.noreply.github.com> --- plugins/modules/jenkins_plugin.py | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/plugins/modules/jenkins_plugin.py b/plugins/modules/jenkins_plugin.py index 157d70c527..13a804a508 100644 --- a/plugins/modules/jenkins_plugin.py +++ b/plugins/modules/jenkins_plugin.py @@ -27,7 +27,7 @@ options: group: type: str description: - - Name of the Jenkins group on the OS. + - GID or name of the Jenkins group on the OS. default: jenkins jenkins_home: type: path @@ -47,7 +47,7 @@ options: owner: type: str description: - - Name of the Jenkins user on the OS. + - UID or name of the Jenkins user on the OS. default: jenkins state: type: str @@ -195,6 +195,29 @@ EXAMPLES = ''' url_password: p4ssw0rd url: http://localhost:8888 +# +# Example of how to authenticate with serverless deployment +# +- name: Update plugins on ECS Fargate Jenkins instance + community.general.jenkins_plugin: + # plugin name and version + name: ws-cleanup + version: '0.45' + # Jenkins home path mounted on ec2-helper VM (example) + jenkins_home: "/mnt/{{ jenkins_instance }}" + # matching the UID/GID to one in official Jenkins image + owner: 1000 + group: 1000 + # Jenkins instance URL and admin credentials + url: "https://{{ jenkins_instance }}.com/" + url_username: admin + url_password: p4ssw0rd + # make module work from EC2 which has local access + # to EFS mount as well as Jenkins URL + delegate_to: ec2-helper + vars: + jenkins_instance: foobar + # # Example of a Play which handles Jenkins restarts during the state changes #