From patchwork Wed Feb 5 19:47:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Gomez X-Patchwork-Id: 13961833 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 08F7CDF5C for ; Wed, 5 Feb 2025 19:47:31 +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=1738784852; cv=none; b=nahnih6kF/2qdIAbGBANbF03ftcH5jEVDPS4aLKEYPTeyTfzWpkj6GzSCQUMl9k89iP1DXCpCUy3KLjnTNrLEDwC4UYXa+hgBNM9mxHeKrHWDg4MAIfaN9DB0+/pnhlqAFcS/IYnTBcSBF4LJKoR9qf2EMmrsQmDmKc42oTgfjY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738784852; c=relaxed/simple; bh=8BBw/3mifVP69R8p7LTdgz8BaL911gFiJt5CYY1qNEQ=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=exgGF6zf/Ek+kCkJg1Z2D9Op5oYrYH782Td4ioin/ifpiE4CjW+VpI5/x3zjg4kFw3F7ENc3Dw+q/0g5rNzQMtTis0bkr2QgOZc+3pecBoebmU6HmEfc+GLfzvLqx63CqEzW6sB0WQRuz0aZSvUKocFtMttRMOH+t3Y3n+lVEKg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GpGTQQ/b; 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="GpGTQQ/b" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2210C4CEE2; Wed, 5 Feb 2025 19:47:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738784851; bh=8BBw/3mifVP69R8p7LTdgz8BaL911gFiJt5CYY1qNEQ=; h=From:Subject:Date:To:Cc:From; b=GpGTQQ/bBXJvh2VrupJDJhdknwxAgmnpNIzukUkAoYxjKW8fcQB+gdVisbWCD33rl xuS2RJUGVjReqb2VRxe8/MLKJh+Jrm0n1HseEBI1bsDjM9rHMmcx9vq/acvL4ivZGY wjqnsvweYsInchoTrBXQ9Oq3J8MeXKAl7RltKdYqpq/pCcTQlKvbCnJdVvukD6GNYQ UXj7HpqdYTlKcWjnZuuIlqDnNW/ggSE5pSfhnjQ+kNbWndZLcWYh9/D2s1W3HKa4Ve cSBQ9eny8ZR/RzWhXESWW+kipDPeyzcCg/5Hu7urvJEX3+x1E4xKGlfAwXBiDSnAG/ JEieCMegIySlQ== From: da.gomez@kernel.org Subject: [PATCH v2 0/2] ansible.cfg: generate with kconfig Date: Wed, 05 Feb 2025 19:47:15 +0000 Message-Id: <20250205-ansible_cfg3-v2-0-02620fc1e3d1@samsung.com> Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAEPAo2cC/22PzWrDMBCEX8XsuQqrlRXZPvU9Sij6WTuC2k4lx 7QEv3vk5JJDLgszsDPf3CBzipyhq26QeI05zlMR9FGBP9tpYBFD0UBIGgmVsFOO7oe/fT8ooWz AhnuiWjkoL5fEffx7xH2dnjrx77WkLk8TnM0s/DyOcekq59lqFdBI9B4NkSasFZIxvim35RYZm 6OCV5oCt7NIJUXpEsENoufakdGhRW+6VcJefY55mdP/Y1ix9u73G1YpUNiWjfYBjyaYz2zHfJ2 GQ8GE07ZtdxESpNYlAQAA X-Change-ID: 20250203-ansible_cfg3-3ad08ef2243b To: Luis Chamberlain , Chuck Lever Cc: kdevops@lists.linux.dev, Daniel Gomez X-Mailer: b4 0.14.2 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 Acked-by: Luis Chamberlain --- 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 (2): ansible.cfg: autogenerate using kconfig ansible.cfg: change defaults to minimal .gitignore | 2 + MAINTAINERS | 4 + Makefile | 17 +++- ansible.cfg | 5 - kconfigs/Kconfig.ansible_cfg | 105 +++++++++++++++++++++ kconfigs/Kconfig.kdevops | 4 + playbooks/ansible_cfg.yml | 4 + playbooks/roles/ansible_cfg/defaults/main.yml | 10 ++ playbooks/roles/ansible_cfg/tasks/main.yml | 17 ++++ .../roles/ansible_cfg/templates/ansible.cfg.j2 | 14 +++ 10 files changed, 173 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,