8

I am adding a contrib module to a project and I would like the module enabling to happen automatically on deployment. My deployment script pulls the code and runs a config update via drush config-import. What would the YML be to enable the module in the codebase on config update?

1
  • I keep a text file listing modules I want enabled modules and "drush en" that file on deployment.
    – Jonathan
    Commented Sep 18, 2016 at 10:20

1 Answer 1

14

To enable a module, you just need a line in core.extension.yml. However, you also need all the configuration the module provides. You could copy that over yourself from the config install and optional folder.

But the usual workflow is that at you enable the module manually at some point, using drush or the UI, then optionall customize the configuration and then export the config and deploy that.

3
  • Thanks @Berdir - what is the number next to each module entry in core.extension.yml ? e.g.: redirect: 0 - Looking a most of them I had assumed that the number was a boolean to denote if the module is installed or uninstalled, but actually I don't think it is, for 2 reasons. First of all, when I look at the installed state of the module module in the site admin at: admin/modules, e.g. for redirect I can see that it is enabled, and in core.extension.yml it's corresponding entry is redirect: 0 So it can't be a boolean for installed state. Commented Jul 25, 2017 at 15:48
  • 2
    Secondly, the entry in core.extension.yml for paragraphs module I have on my site is: paragraphs: 11 i.e. not the value of 'one' but 'eleven'. So 2 things to conclude: 1) The module just has to be present in core.extension.yml to be enabled 2) the value next to it its not the boolean state as to whether the module is installed (enabled) or not. At a guess, I would think that the value is possibly the weighting (a concept used for modules in Drupal 7). Would I be correct? Commented Jul 25, 2017 at 15:51
  • 3
    Yes, it is the weight. Note that comments on answers is not a good way to ask follow-up questions a year later. You should ask new questions and refer old related questions
    – Berdir
    Commented Jul 25, 2017 at 19:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.