---
description: Nach dem Erstellen der VM den ersten State ausrollen und Keys aufräumen
---

# Start Aktionen

{% code title="/etc/salt/master.d/reactor.conf" %}
```
reactor: 
  # Machine created
  - 'salt/cloud/*/created':
    - '/srv/reactor/startup_highstate.sls'
  # Machine destroyed
  - 'salt/cloud/*/destroying': 
    - '/srv/reactor/salt_cloud_destroy_keys.sls'
```
{% endcode %}

{% hint style="info" %}
Achten Sie auf die Zeile 4. Sofort nach dem Provisionieren wird ein State ausgerollt.
{% endhint %}

{% code title="/srv/salt/init/vminit.sls" %}
```yaml
UTC:
  timezone.system

{% if grains['os_family'] == 'debian' %}
/etc/apt/apt.conf.d/01disable-recommends:
  file.managed:
    - contents: |
        APT::Install-Recommends "false";        
        APT::Install-Suggests "false";
{% endif %} 

/etc/hostname:
  file.managed:
    - contents: {{ grains['id'] }}

shutdown -r --no-wall +1:
  cmd.run: []
  
/root/salt-cloud.txt:
  file.managed:
    - content: VM init finished
```
{% endcode %}
