Message ID | 20250206-ansible_cfg3-v3-0-4588c8c07e22@samsung.com (mailing list archive) |
---|---|
Headers | show
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C2B6A22688E for <kdevops@lists.linux.dev>; Thu, 6 Feb 2025 10:44:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738838682; cv=none; b=E8OVuRHNVMWx7DsKr4bxWIhqxmeo5FiK+aSva3mUTq44H4tdez8ipP+A18/vEpFquvjGBqvsINjrh6L/Ze9bh5sPsWqchay7zOTzyu4HWObC/U6NbA3lvLP+IMx7a4p1ZNS7kxZNQ+uwDOovoEfDFS5ETLMP0hRZSAZBin+Jt9Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738838682; c=relaxed/simple; bh=1ENOt7o15XcPE0DZRfentRPPuBeG52h+d5V5IMil1Vc=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=cCkZQydmA+ZA01tt8rpA7WkJBVtGZkiT118O1panWJSIaWt1pCg6lYVZaIRZEB/YPoJriPQFqCz0OwgwwuIA+7Sn/0bGZcc2g9dv1e395JapBYtxNkqer1uTZdwomuscKqDggA1BQpquUbwEtKYS6nf8W173brG9H9KKFpYekCc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BvDgJMdP; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BvDgJMdP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FD04C4CEDD; Thu, 6 Feb 2025 10:44:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738838682; bh=1ENOt7o15XcPE0DZRfentRPPuBeG52h+d5V5IMil1Vc=; h=From:Subject:Date:To:Cc:From; b=BvDgJMdP5oUxHEHHZeCEq0U/tJsr75FSiK/e5sx+CDz2lCvIBfGQCSpBuu6oZXulo rQUrdTrV0rpn2o6p9DpigR1h2uo1ldvocwMbxoFKeyxJt2CECs9CmjoANP9QMMBWrq I7WxUnFfluA5W+m4UBR6+xiwNKMZ43Qt+wwCKCjf+QEBJ3XQPMTc4iRfcKzZ3gdrpT d0KRnLtVWHbvZs05nk4mxKeoYUQHEWi/ArQRr1CZb9M/Hfm5dZZo5Npu5kN+OYNkc1 JeLxKj/dRgK7NcGhMOcKScApSURxqevh6GWaUE5z650api6gGZ1xaVnIiWJpYSbUAN Hx1pqHhlJKLZg== From: da.gomez@kernel.org Subject: [PATCH v3 0/4] ansible.cfg: generate with kconfig Date: Thu, 06 Feb 2025 10:44:17 +0000 Message-Id: <20250206-ansible_cfg3-v3-0-4588c8c07e22@samsung.com> Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: <kdevops.lists.linux.dev> List-Subscribe: <mailto:kdevops+subscribe@lists.linux.dev> List-Unsubscribe: <mailto:kdevops+unsubscribe@lists.linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAIGSpGcC/22P3WqEMBCFX0Vy3ZTJxBj1qu9RSkkmoxuouk1ca Vl892bdm23pzcAZ+M7PVWROkbPoq6tIvMUcl7kI/VQJOrl5ZBlD0QIBDSBo6eYc/Qe/0zBqqV2 AlgfEWntRkHPiIX4ddq9vd53481Jc1/tTeJdZ0jJNce0rT+yMDmAVEIFFNAi1BrSW2nI77oChb bR4bNNXRxellSxZMvhRDlx7tCZ0QLbflLhFn2Jel/R9DCuvW/b/GzYlQbqOraEAjQ32JbspX+b xudQ8rDZ8xM0fHAsO2CAMpFgH9Rvf9/0HEzkg42QBAAA= X-Change-ID: 20250203-ansible_cfg3-3ad08ef2243b To: Luis Chamberlain <mcgrof@kernel.org>, Chuck Lever <chuck.lever@oracle.com> Cc: kdevops@lists.linux.dev, Daniel Gomez <da.gomez@samsung.com> X-Mailer: b4 0.14.2 |
Series | ansible.cfg: generate with kconfig | expand |
This series will generate the current in-tree ansible.cfg (Ansible Configuration Settings) based on kconfig user options (kconfig menu location: Kdevops configuration -> Ansible Configuration ->). Add ansible.cfg Makefile target to manually generate the file, but also append the target to the list of default make targets to make sure the configuration file is generated. The first commit just keeps the ansible.cfg as is. The second changes the current settings to: * Use dense [1] callback plugin instead of debug. This ensure a more readable stdout convenient for normal operation. For CI, I recommend setting AV=2 (Ansible Verbosity: -vv) or enable the debug plugin. For error/debug user situations, or kdevops/Ansible development, re-run your failed playbook with AV=1 or more. Index of callback plugins can be found here: https://docs.ansible.com/ansible/latest/collections/index_callback.html Note: More updated settings below the examples. Example running dense callback plugin with default Ansible verbosity (AV=0 or nothing): make V=1 bringup ... ansible-playbook --connection=local \ --inventory localhost, \ playbooks/gen_nodes.yml \ -e 'ansible_python_interpreter=/usr/bin/python3' \ --extra-vars=@./extra_vars.yaml PLAY 1: LOCALHOST task 1. [started TASK: Gathering Facts on localhost] task 2. [started TASK: gen_nodes : Import optional extra_args file on localhost] task 3. [started TASK: gen_nodes : Get our user on localhost] task 3: localhost task 4. [started TASK: gen_nodes : Get our primary group on localhost] task 4: localhost ... Example running dense callback plugin with Ansible verbosity level 1 (AV=1): make V=1 AV=1 bringup ... ansible-playbook -v --connection=local \ --inventory localhost, \ playbooks/gen_nodes.yml \ -e 'ansible_python_interpreter=/usr/bin/python3' \ --extra-vars=@./extra_vars.yaml Using /media/tarkir/dagomez/src/linux-kdevops/kdevops/ansible.cfg as config file PLAY 1: LOCALHOST task 1. [started TASK: Gathering Facts on localhost] task 2. [started TASK: gen_nodes : Import optional extra_args file on localhost] task 3. [started TASK: gen_nodes : Get our user on localhost] task 3: gen_nodes : Get our user changed: localhost: {"changed": true, "cmd": ["whoami"], "rc": 0, "stdout": "dagomez"} task 4. [started TASK: gen_nodes : Get our primary group on localhost] task 4: gen_nodes : Get our primary group changed: localhost: {"changed": true, "cmd": ["id", "-g", "-n"], "rc": 0, "stdout": "dagomez"} ... Example running dense callback plugin with default verbosity (AV=0), error situation (error is "forced"/"simulated"): make V=1 bringup make linux-clone PLAY 1: LOCALHOST task 1. [started TASK: Gathering Facts on localhost] task 2. [started TASK: ansible_cfg : Import optional extra_args file on localhost] task 3. [started TASK: ansible_cfg : Generate kdevops ansible.cfg on localhost] ansible-playbook --connection=local \ --inventory localhost, \ playbooks/gen_nodes.yml \ -e 'ansible_python_interpreter=/usr/bin/python3' \ --extra-vars=@./extra_vars.yaml PLAY 1: LOCALHOST task 1. [started TASK: Gathering Facts on localhost] task 2. [started TASK: gen_nodes : Import optional extra_args file on localhost] task 3. [started TASK: gen_nodes : Get our user on localhost] task 3: localhost task 4. [started TASK: gen_nodes : Get our primary group on localhost] task 4: localhost task 5. [started TASK: gen_nodes : Create guestfs directory on localhost] task 5: localhost make[1]: *** [Makefile:235: guestfs/kdevops_nodes.yaml] Error 2 make: *** [scripts/guestfs.Makefile:55: 9p_linux_clone] Error 2 Example running dense callback plugin with verbosity level 1 (AV=1), error situation (error is "forced"/"simulated"): make V=1 AV=1 bringup make linux-clone Using /media/tarkir/dagomez/src/linux-kdevops/kdevops/ansible.cfg as config file PLAY 1: LOCALHOST task 1. [started TASK: Gathering Facts on localhost] task 2. [started TASK: ansible_cfg : Import optional extra_args file on localhost] task 3. [started TASK: ansible_cfg : Generate kdevops ansible.cfg on localhost] SUMMARY localhost : ok=3 changed=0 unreachable=0 failed=0 rescued=0 ignored=0 ansible-playbook -v --connection=local \ --inventory localhost, \ playbooks/gen_nodes.yml \ -e 'ansible_python_interpreter=/usr/bin/python3' \ --extra-vars=@./extra_vars.yaml Using /media/tarkir/dagomez/src/linux-kdevops/kdevops/ansible.cfg as config file PLAY 1: LOCALHOST task 1. [started TASK: Gathering Facts on localhost] task 2. [started TASK: gen_nodes : Import optional extra_args file on localhost] task 3. [started TASK: gen_nodes : Get our user on localhost] task 3: gen_nodes : Get our user changed: localhost: {"changed": true, "cmd": ["whoami"], "rc": 0, "stdout": "dagomez"} task 4. [started TASK: gen_nodes : Get our primary group on localhost] task 4: gen_nodes : Get our primary group changed: localhost: {"changed": true, "cmd": ["id", "-g", "-n"], "rc": 0, "stdout": "dagomez"} task 5. [started TASK: gen_nodes : Create guestfs directory on localhost] task 5: gen_nodes : Create guestfs directory failed: localhost: {"msg": "The task includes an option with an undefined variable.. 'guestfs_path_err' is undefined\n\nThe error appears to be in '/media/tarkir/dagomez/src/linux-kdevops/kdevops/playbooks/roles/gen_nod es/tasks/main.yml': line 21, 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: Create guestfs directory\n ^ here\n"} SUMMARY localhost : ok=4 changed=2 unreachable=0 failed=1 rescued=0 ignored=0 make[1]: *** [Makefile:235: guestfs/kdevops_nodes.yaml] Error 2 make: *** [scripts/guestfs.Makefile:55: 9p_linux_clone] Error 2 * Enable show_per_host_start [3] parameter. This is a common parameter between dense and debug callback plugins. Allows to know which task is being executed rather than the current behaviour which only displays terminated tasks. * show_task_path_on_failure [4] parameter. Another commomn parameter between dense and debug callback plugins. Allows to see the path and file of the failure task when debug is -vv or greater. [1] https://docs.ansible.com/ansible/latest/collections/community/general/dense_callback.html [2] https://docs.ansible.com/ansible/latest/collections/ansible/posix/debug_callback.html#ansible-collections-ansible-posix-debug-callback [3] https://docs.ansible.com/ansible/latest/collections/community/general/dense_callback.html#parameter-show_per_host_start [4] https://docs.ansible.com/ansible/latest/collections/community/general/dense_callback.html#parameter-show_per_host_start Signed-off-by: Daniel Gomez <da.gomez@samsung.com> --- Changes in v3: - Update patch trailers. - Add support for Ansible callback plugin via cli (ANSIBLE_CFG_CALLBACK_PLUGIN="<plugin_name>") as per Luis request. - Update GitHub Actions to use the new ANSIBLE_CFG_CALLBACK_PLUGIN to keep the same debug plugin instead of the new default (dense). - Rename KDEVOPS_ANSIBLE_CFG_ to ANSIBLE_CFG_. Following Chuck's request, it makes sense to further simplify the variables by removing the redundant KDEVOPS_ prefix. - Fix Ansible LSP/Lint warnings (true/false instead of True/False; Add FQCN to the ansible_cfg playbook/role and template tasks; set explicit template permissions). - Cleanup ANSIBLE_CFG_CALLBACK_PLUGIN_<PLUGIN_NAME> from yaml output. - Link to v2: https://lore.kernel.org/r/20250205-ansible_cfg3-v2-0-02620fc1e3d1@samsung.com Changes in v2: - Rename KDEVOPS_ANSIBLE_CONFIG_ -> KDEVOPS_ANSIBLE_CFG_ as per Chuck's suggestion. - Add kdevops_ansible_cfg_deprecation_warnings default value. - Link to v1: https://lore.kernel.org/r/20250203-ansible_cfg3-v1-0-a9e75cd067d7@samsung.com - Update base-commit to lastest upstream main. - Update dependencies to "Fix debug mode" patches posted in the mailing list. Add ansible_cfg to the ANSIBLE WRAPPER kdevops module. --- Daniel Gomez (4): ansible.cfg: autogenerate using kconfig ansible.cfg: change defaults to minimal ansible_cfg: add callback plugin cli support github/workflows/fstests.yml: use debug callback plugin .github/workflows/fstests.yml | 1 + .gitignore | 2 + MAINTAINERS | 4 + Makefile | 17 ++- ansible.cfg | 5 - kconfigs/Kconfig.ansible_cfg | 123 +++++++++++++++++++++ kconfigs/Kconfig.kdevops | 4 + playbooks/ansible_cfg.yml | 5 + playbooks/roles/ansible_cfg/defaults/main.yml | 10 ++ playbooks/roles/ansible_cfg/tasks/main.yml | 18 +++ .../roles/ansible_cfg/templates/ansible.cfg.j2 | 14 +++ 11 files changed, 194 insertions(+), 9 deletions(-) --- base-commit: bcea53d0710cc0722520430277c80279e90e0863 change-id: 20250203-ansible_cfg3-3ad08ef2243b prerequisite-change-id: 20250131-fix-dbg-fe4b275d90c7:v1 prerequisite-patch-id: dcbe4e784cf81c8863050d2829598e131b51a7ff prerequisite-patch-id: 149905762e9801eb6da1872f6751cf430b9f0dda prerequisite-patch-id: 8ea8b7694168bdae29156ab0c4696f0bac47815d Best regards,