Skip to main content

Posts

Showing posts with the label yml

Chef: Test Kitchen

Install docker with the following command: yum install docker systemctl start docker Then we need to install the kitchen-docker ruby gem. chef gem install kitchen-docker Create a cookbook: chef generate cookbook my_cookbook Edit the .kitchen.yml file in the generated cookbook. Change the driver name from vagrant to docker and delete the line - name: centos-7 Save and close. Then execute kitchen converge . This command will create a docker container for us and put all the settings in place. The output will be something as follows: Synchronizing Cookbooks: - my_cookbook (0.1.0) Installing Cookbook Gems: Compiling Cookbooks... Converging 0 resourcesRunning handlers: Running handlers complete Chef Client finished, 0/0 resources updated in 18 seconds Finished converging <default-ubuntu-1604> (7m3.52s). Then run kitchen list The output will be something as follows: Instance Driver Provisioner Verifier Transport Last Action Last Error default-ubuntu-1604 Docker ChefZero Ins...

Salt stack formulas:

Add all the configurations in pillar.sls into the target file: 1 2 3 4 5 6 7 8 9 10 11 {%- if salt['pillar.get']('elasticsearch:config') %} /etc/elasticsearch/elasticsearch.yml:    file.managed:      - source: salt://elasticsearch/files/elasticsearch.yml      - user: root      - template: jinja      - require:        - sls: elasticsearch.pkg      - context:          config: {{ salt['pillar.get']('elasticsearch:config', '{}') }} {%- endif %} 2. Create multiple directories if it does not exists 1 2 3 4 5 6 7 8 9 10 11 12 {% for dir in (data_dir, log_dir) %} {% if dir %} {{ dir }}:    file.directory:      - user: elasticsearch      - group: elasticsearch  ...