chef-infrachef-solo

Chef how to add,enable and install in one code block


i have this procedure on installing specific version of php in centos

yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum install yum-utils
yum-config-manager --enable remi-php72
yum install php

how to include all this procedure in one code block in Chef? Thank you


Solution

  • this can be achieved in various ways:

    1. store the command(s) in a shell script and execute it with the execute, bash or script resources
    2. converting your commands to "pure" chef resources, such as package yum_package, yum_repository resources