xoxys.droneci_autoscaler/templates/services/userdata.yml.j2
Robert Kaussow 2b329081ff
All checks were successful
continuous-integration/drone/push Build is passing
fix typos
2021-02-25 11:51:42 +01:00

91 lines
3.2 KiB
Django/Jinja

#jinja2: lstrip_blocks: True
#cloud-config
apt_reboot_if_required: false
package_update: true
package_upgrade: {{ droneci_autoscaler_agent_package_upgrade | bool | lower }}
{% if inst.agent_architecture | default(droneci_autoscaler_agent_architecture) == "arm" %}
bootcmd:
- [ dpkg, --add-architecture, armhf ]
{%- endif %}
apt:
sources:
docker.list:
source: deb [arch={% if inst.agent_architecture | default(droneci_autoscaler_agent_architecture) == "arm" %}armhf{% elif inst.agent_architecture | default(droneci_autoscaler_agent_architecture) == "arm64" %}arm64{% else %}amd64{% endif %}] https://download.docker.com/linux/{{ inst.agent_distro | default(droneci_autoscaler_agent_distro) }} $RELEASE stable
keyid: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
packages:
{% for package in inst.agent_packages | default(droneci_autoscaler_agent_packages) %}
- {{ package }}
{% endfor %}
- bridge-utils
- 'docker-ce{{ ':armhf' if inst.agent_architecture | default(droneci_autoscaler_agent_architecture) == "arm" else '' }}'
write_files:
- path: /etc/systemd/system/docker.service.d/override.conf
content: |
[Service]
ExecStart=
ExecStart={% if inst.agent_architecture | default(droneci_autoscaler_agent_architecture) == "arm" %}/usr/bin/setarch linux32 -B {% endif %}/usr/bin/dockerd
- path: /etc/systemd/system/containerd.service.d/override.conf
content: |
[Service]
ExecStart=
ExecStart={% if inst.agent_architecture | default(droneci_autoscaler_agent_architecture) == "arm" %}/usr/bin/setarch linux32 -B {% endif %}/usr/bin/containerd
- path: /etc/default/docker
content: |
DOCKER_OPTS=""
- path: /etc/docker/daemon.json
content: |
{
"hosts": ["0.0.0.0:2376", "unix:///var/run/docker.sock"],
"tls": true,
"tlsverify": true,
"tlscacert": "/etc/docker/ca.pem",
"tlscert": "/etc/docker/server-cert.pem",
"tlskey": "/etc/docker/server-key.pem"
}
{% if inst.docker_auth_config | default(droneci_autoscaler_docker_auth_config) is defined %}
- path: /root/.docker/config.json
content: |
{{ inst.docker_auth_config | default(droneci_autoscaler_docker_auth_config) | to_nice_json(indent=2) | indent(width=6) }}
{% endif %}
- path: /etc/drone.conf
content: |
{% if inst.docker_auth_config | default(droneci_autoscaler_docker_auth_config) is defined %}
PLUGIN_CONFIG={{ inst.docker_auth_config | default(droneci_autoscaler_docker_auth_config) | to_nice_json(indent=2) | regex_replace("\s+", " ") }}
{% endif %}
- path: /etc/docker/ca.pem
encoding: b64
content: {% raw %}{{ .CACert | base64 }}{% endraw %}
- path: /etc/docker/server-cert.pem
encoding: b64
content: {% raw %}{{ .TLSCert | base64 }}{% endraw %}
- path: /etc/docker/server-key.pem
encoding: b64
content: {% raw %}{{ .TLSKey | base64 }}{% endraw %}
{% if droneci_autoscaler_agent_resolved_dns | length > 0 %}
- path: /etc/systemd/resolved.conf
content: |
[Resolve]
DNS={{ droneci_autoscaler_agent_resolved_dns | join(" ") }}
{% endif %}
{% if droneci_autoscaler_agent_runcmd | length > 0 %}
runcmd:
{% for cmd in droneci_autoscaler_agent_runcmd %}
- {{ cmd }}
{% endfor %}
{% endif %}