From 5e8a8233da46b321f03d9323a746e72422ba7670 Mon Sep 17 00:00:00 2001
From: Maksim Malchuk <maksim.malchuk@gmail.com>
Date: Thu, 29 Sep 2022 15:31:54 +0300
Subject: [PATCH] Fix an issue when 'acl' package can be forgotten

This is folllowup on I69bf810632d09eddaa3983ae56e833debe9fd03b to
avoid user accidentely forgot the 'acl' package when override the
dev_tools_packages_default in their custom configuration. Also this
adds an ability to customise list of packages installed in addition
to the default list.

Change-Id: I03a826e98a18b158774ba100cfa2987299eb6c25
Signed-off-by: Maksim Malchuk <maksim.malchuk@gmail.com>
---
 ansible/roles/dev-tools/defaults/main.yml    | 14 +++++---
 doc/source/configuration/reference/hosts.rst | 34 ++++++++++++++++++++
 2 files changed, 44 insertions(+), 4 deletions(-)

diff --git a/ansible/roles/dev-tools/defaults/main.yml b/ansible/roles/dev-tools/defaults/main.yml
index eb61072c..b2f84361 100644
--- a/ansible/roles/dev-tools/defaults/main.yml
+++ b/ansible/roles/dev-tools/defaults/main.yml
@@ -1,12 +1,18 @@
 ---
 # List of default packages to install.
 dev_tools_packages_default:
-  # NOTE(mgoddard): The acl package is required for the setfacl command, used by
-  # become_user.
-  - acl
   - bash-completion
   - tcpdump
   - vim
 
+# List of extra packages to install.
+dev_tools_packages_extra: []
+
+# List of required packages to install.
+dev_tools_packages_system:
+  # NOTE(mgoddard): The acl package is required for the setfacl command, used by
+  # become_user.
+  - acl
+
 # List of packages to install.
-dev_tools_packages: "{{ dev_tools_packages_default }}"
+dev_tools_packages: "{{ dev_tools_packages_default + dev_tools_packages_extra + dev_tools_packages_system }}"
diff --git a/doc/source/configuration/reference/hosts.rst b/doc/source/configuration/reference/hosts.rst
index 527a43f6..644c38e1 100644
--- a/doc/source/configuration/reference/hosts.rst
+++ b/doc/source/configuration/reference/hosts.rst
@@ -444,6 +444,40 @@ that is signed by the key.
        components: all
        signed_by: example-key.asc
 
+Development tools
+=================
+*tags:*
+  | ``dev-tools``
+
+Development tools (additional OS packages) can be configured to be installed
+on hosts. By default Ddvelopment tools are installed on all
+``seed-hypervisor``, ``seed``, ``overcloud`` and ``infra-vms`` hosts.
+
+The following variables can be used to set which packages to install:
+
+* ``dev_tools_packages_default``: The list of packages installed by default.
+  (default is: ``bash-completion``, ``tcpdump`` and ``vim``)
+* ``dev_tools_packages_extra``: The list of additional packages installed
+  alongside default packages. (default is an empty list)
+
+In the following example, the list of default packages to be installed on all
+hosts is modified to replace ``vim`` with ``emacs``. The ``bridge-utils``
+package is added to all ``overcloud`` hosts:
+
+.. code-block:: yaml
+   :caption: ``dev-tools.yml``
+
+   dev_tools_packages_default:
+     - bash-completion
+     - emacs
+     - tcpdump
+
+.. code-block:: yaml
+   :caption: ``inventory/group_vars/overcloud/dev-tools``
+
+   dev_tools_packages_extra:
+     - bridge-utils
+
 SELinux
 =======
 *tags:*
-- 
GitLab