Skip to content

Instantly share code, notes, and snippets.

@patrickbussmann
Forked from heri16/user-data.txt
Last active April 17, 2023 12:42
Show Gist options
  • Select an option

  • Save patrickbussmann/1da966531892b71faff2e5d9cbf333b6 to your computer and use it in GitHub Desktop.

Select an option

Save patrickbussmann/1da966531892b71faff2e5d9cbf333b6 to your computer and use it in GitHub Desktop.

Revisions

  1. patrickbussmann revised this gist May 27, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion user-data.txt
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@ package_upgrade: true
    #
    # if packages are specified, this apt_update will be set to true

    packages: ['apt-transport-https', 'ca-certificates', 'curl', 'software-properties-common']
    packages: ['apt-transport-https', 'ca-certificates', 'curl', 'software-properties-common', 'docker-ce']

    apt:
    # The apt config consists of two major "areas".
  2. patrickbussmann revised this gist May 27, 2019. 1 changed file with 3 additions and 15 deletions.
    18 changes: 3 additions & 15 deletions user-data.txt
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@ package_upgrade: true
    #
    # if packages are specified, this apt_update will be set to true

    packages: ['docker-ce', 'golang-go']
    packages: ['apt-transport-https', 'ca-certificates', 'curl', 'software-properties-common']

    apt:
    # The apt config consists of two major "areas".
    @@ -81,7 +81,7 @@ apt:
    # identification in discussions.

    sources:
    curtin-dev-ppa.list:
    docker-ppa.list:
    # 2.1 source
    #
    # Creates a file in /etc/apt/sources.list.d/ for the sources list entry
    @@ -92,19 +92,7 @@ apt:
    #
    # Importing a gpg key for a given key id. Used keyserver defaults to
    # keyserver.ubuntu.com
    keyid: 0EBFCD88 # GPG key ID published on a key server

    ignored1:
    # 2.3 PPA shortcut
    #
    # Setup correct apt sources.list line and Auto-Import the signing key
    # from LP
    #
    # See https://help.launchpad.net/Packaging/PPA for more information
    # this requires 'add-apt-repository'. This will create a file in
    # /etc/apt/sources.list.d automatically, therefore the key here is
    # ignored as filename in those cases.
    source: "ppa:longsleep/golang-backports" # Quote the string
    #keyid: 0EBFCD88 # GPG key ID published on a key server

    ## poweroff or reboot system after finished
    # default: none
  3. @heri16 heri16 created this gist Apr 5, 2017.
    145 changes: 145 additions & 0 deletions user-data.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,145 @@
    #cloud-config

    # Upgrade the instance on first boot
    # (ie run apt-get upgrade)
    #
    # Default: false
    # Aliases: apt_upgrade
    package_upgrade: true

    # Install additional packages on first boot
    #
    # Default: none
    #
    # if packages are specified, this apt_update will be set to true

    packages: ['docker-ce', 'golang-go']

    apt:
    # The apt config consists of two major "areas".
    #
    # On one hand there is the global configuration for the apt feature.
    #
    # On one hand (down in this file) there is the source dictionary which allows
    # to define various entries to be considered by apt.

    ##############################################################################
    # Section 1: global apt configuration
    #
    # The following examples number the top keys to ease identification in
    # discussions.

    # 1.1 preserve_sources_list
    #
    # Preserves the existing /etc/apt/sources.list
    # Default: false - do overwrite sources_list. If set to true then any
    # "mirrors" configuration will have no effect.
    # Set to true to avoid affecting sources.list. In that case only
    # "extra" source specifications will be written into
    # /etc/apt/sources.list.d/*
    preserve_sources_list: true

    ##############################################################################
    # Section 2: source list entries
    #
    # This is a dictionary (unlike most block/net which are lists)
    #
    # The key of each source entry is the filename and will be prepended by
    # /etc/apt/sources.list.d/ if it doesn't start with a '/'.
    # If it doesn't end with .list it will be appended so that apt picks up it's
    # configuration.
    #
    # Whenever there is no content to be written into such a file, the key is
    # not used as filename - yet it can still be used as index for merging
    # configuration.
    #
    # The values inside the entries consost of the following optional entries:
    # 'source': a sources.list entry (some variable replacements apply)
    # 'keyid': providing a key to import via shortid or fingerprint
    # 'key': providing a raw PGP key
    # 'keyserver': specify an alternate keyserver to pull keys from that
    # were specified by keyid

    # This allows merging between multiple input files than a list like:
    # cloud-config1
    # sources:
    # s1: {'key': 'key1', 'source': 'source1'}
    # cloud-config2
    # sources:
    # s2: {'key': 'key2'}
    # s1: {'keyserver': 'foo'}
    # This would be merged to
    # sources:
    # s1:
    # keyserver: foo
    # key: key1
    # source: source1
    # s2:
    # key: key2
    #
    # The following examples number the subfeatures per sources entry to ease
    # identification in discussions.

    sources:
    curtin-dev-ppa.list:
    # 2.1 source
    #
    # Creates a file in /etc/apt/sources.list.d/ for the sources list entry
    # based on the key: "/etc/apt/sources.list.d/curtin-dev-ppa.list"
    source: "deb [arch=amd64] https://download.docker.com/linux/ubuntu $RELEASE stable"

    # 2.2 keyid
    #
    # Importing a gpg key for a given key id. Used keyserver defaults to
    # keyserver.ubuntu.com
    keyid: 0EBFCD88 # GPG key ID published on a key server

    ignored1:
    # 2.3 PPA shortcut
    #
    # Setup correct apt sources.list line and Auto-Import the signing key
    # from LP
    #
    # See https://help.launchpad.net/Packaging/PPA for more information
    # this requires 'add-apt-repository'. This will create a file in
    # /etc/apt/sources.list.d automatically, therefore the key here is
    # ignored as filename in those cases.
    source: "ppa:longsleep/golang-backports" # Quote the string

    ## poweroff or reboot system after finished
    # default: none
    #
    # power_state can be used to make the system shutdown, reboot or
    # halt after boot is finished. This same thing can be acheived by
    # user-data scripts or by runcmd by simply invoking 'shutdown'.
    #
    # Doing it this way ensures that cloud-init is entirely finished with
    # modules that would be executed, and avoids any error/log messages
    # that may go to the console as a result of system services like
    # syslog being taken down while cloud-init is running.
    #
    # If you delay '+5' (5 minutes) and have a timeout of
    # 120 (2 minutes), then the max time until shutdown will be 7 minutes.
    # cloud-init will invoke 'shutdown +5' after the process finishes, or
    # when 'timeout' seconds have elapsed.
    #
    # delay: form accepted by shutdown. default is 'now'. other format
    # accepted is +m (m in minutes)
    # mode: required. must be one of 'poweroff', 'halt', 'reboot'
    # message: provided as the message argument to 'shutdown'. default is none.
    # timeout: the amount of time to give the cloud-init process to finish
    # before executing shutdown.
    # condition: apply state change only if condition is met.
    # May be boolean True (always met), or False (never met),
    # or a command string or list to be executed.
    # command's exit code indicates:
    # 0: condition met
    # 1: condition not met
    # other exit codes will result in 'not met', but are reserved
    # for future use.
    #
    power_state:
    delay: "now"
    mode: reboot
    message: First reboot
    condition: True