From 69ae8c45e09e00014f171a78eedaef3ccf71beee Mon Sep 17 00:00:00 2001 From: Anil Belur Date: Tue, 9 Nov 2021 10:25:03 +1000 Subject: [PATCH] Feat!: Add builder macro to set ansible.cfg file Add packer builder macros to create a 'ansible.cfg' file. This is required by packer build jobs to set ansible host configuration. The job or image specific configuration can be created using JCasC custom files in the ci-man repository. Issue-ID: RELENG-4032 Change-Id: Ia9fc4d26341228ba8009de6d2ec3c46e31bfc45b Signed-off-by: Anil Belur --- docs/jjb/lf-ci-jobs.rst | 8 ++++++++ docs/jjb/lf-macros.rst | 5 +++++ jjb/lf-macros.yaml | 9 +++++++++ ...add-ansible-config-file-provider-7bcd466a47ba02b8.yaml | 15 +++++++++++++++ 4 files changed, 37 insertions(+) create mode 100644 releasenotes/notes/add-ansible-config-file-provider-7bcd466a47ba02b8.yaml diff --git a/docs/jjb/lf-ci-jobs.rst b/docs/jjb/lf-ci-jobs.rst index 439b2e73..315bfc36 100644 --- a/docs/jjb/lf-ci-jobs.rst +++ b/docs/jjb/lf-ci-jobs.rst @@ -746,6 +746,10 @@ Packer Merge Packer Merge job runs `packer build` to build system images in the cloud. +This job requires a Config File Provider file named ``ansible-cfg`` created +on Jenkins. The file can include ansible host configuration required for the +environment. + :Template Names: - {project-name}-packer-merge-{platforms}-{templates} - gerrit-packer-merge @@ -815,6 +819,10 @@ Packer Verify job runs ``packer validate`` to verify packer configuration. The verify job checks superficial syntax of the template and other files. It does not attempt to build an image, and cannot detect all possible build issues. +This job requires a Config File Provider file named ``ansible-cfg`` created +on Jenkins. The file can include ansible host configuration required for the +environment. + :Template Names: - {project-name}-packer-verify - gerrit-packer-verify diff --git a/docs/jjb/lf-macros.rst b/docs/jjb/lf-macros.rst index 1ea2cfaf..66a25a8e 100644 --- a/docs/jjb/lf-macros.rst +++ b/docs/jjb/lf-macros.rst @@ -12,6 +12,11 @@ This macro will post a comment to the gerrit patchset if the build creates a file named gerrit_comment.txt To use this macro add it to the list of builders. +lf-ansible-config-file-provider +------------------------------- + +Provisions files required by the ansible, namely +"~/.ansible/ansible.cfg" in the Jenkins home directory. lf-fetch-dependent-patches -------------------------- diff --git a/jjb/lf-macros.yaml b/jjb/lf-macros.yaml index ab46c35b..57edc3ab 100644 --- a/jjb/lf-macros.yaml +++ b/jjb/lf-macros.yaml @@ -11,6 +11,14 @@ builders: - shell: !include-raw: ../shell/comment-to-gerrit.sh +- builder: + name: lf-ansible-config-file-provider + builders: + - config-file-provider: + files: + - file-id: "ansible-cfg" + target: "$HOME/.ansible/ansible.cfg" + - builder: name: lf-fetch-dependent-patches builders: @@ -112,6 +120,7 @@ - builder: name: lf-infra-packer-build builders: + - lf-ansible-config-file-provider - conditional-step: condition-kind: boolean-expression condition-expression: "{openstack}" diff --git a/releasenotes/notes/add-ansible-config-file-provider-7bcd466a47ba02b8.yaml b/releasenotes/notes/add-ansible-config-file-provider-7bcd466a47ba02b8.yaml new file mode 100644 index 00000000..08d528f2 --- /dev/null +++ b/releasenotes/notes/add-ansible-config-file-provider-7bcd466a47ba02b8.yaml @@ -0,0 +1,15 @@ +--- +upgrade: + - | + This change requires creation of a custom managed file (ansible.cfg) + on the Jenkins environment with the default line + "remote_src = ~/.ansible/tmp". +features: + - | + Add packer builder macros to create a 'ansible.cfg' file. + This is required by packer build jobs to set ansible host + configuration. The job or image specific configuration can be created + using JCasC custom files in the ci-man repository. + + Example configuration: + https://github.com/ansible/ansible/blob/stable-2.11/examples/ansible.cfg -- 2.16.6