File size: 2,162 Bytes
d16079c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: Chef Client Execution on Linux
description: This is a sample component that demonstrates how to download and execute a Chef recipe against a Linux server. This sample will install Chef using the Chef Software Install script. For more information about the installation script, review the documentation at https://docs.chef.io/packages/#chef-software-install-script.
schemaVersion: 1.0
constants:
  - ChefInstallationScriptSource:
      type: string
      value: https://omnitruck.chef.io/install.sh
  - RecipeSource:
      type: string
      value: 's3://<enter_s3_bucket_name_here>/<enter_s3_object_key_here>'
phases:
  - name: build
    steps:
      - name: InstallationScript
        action: ExecuteBash
        inputs:
          commands:
            - echo "$HOME/chef_install.sh"
      - name: DownloadInstallationScript
        action: WebDownload
        inputs:
          - source: '{{ ChefInstallationScriptSource }}'
            destination: '{{ build.InstallationScript.outputs.stdout }}'
      - name: SetInstallationScriptExecutable
        action: SetFilePermissions
        inputs:
          - path: '{{ build.InstallationScript.outputs.stdout }}'
            permissions: 0700
      - name: InstallChefClient
        action: ExecuteBash
        inputs:
          commands:
            - sudo '{{ build.InstallationScript.outputs.stdout }}' -c stable
      - name: RecipeDestination
        action: ExecuteBash
        inputs:
          commands:
            - echo "$HOME/recipe.rb"
      - name: DownloadRecipe
        action: S3Download
        inputs:
          - source: '{{ RecipeSource }}'
            destination: '{{ build.RecipeDestination.outputs.stdout }}'
      - name: ApplyRecipe
        action: ExecuteBinary
        inputs:
          path: chef-client
          arguments:
            - '--local-mode'
            - '{{ build.RecipeDestination.outputs.stdout }}'
            - '--chef-license'
            - 'accept-no-persist'
      - name: Cleanup
        action: DeleteFile
        inputs:
          - path: '{{ build.RecipeDestination.outputs.stdout }}'
          - path: '{{ build.InstallationScript.outputs.stdout }}'