xoxys.droneci_autoscaler/templates/services/userdata.yml.j2

77 lines
2.8 KiB
Plaintext
Raw Normal View History

2020-09-30 19:56:00 +00:00
#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 ]
2020-12-06 12:35:42 +00:00
{%- endif %}
2020-09-30 19:56:00 +00:00
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/ubuntu $RELEASE stable
keyid: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
packages:
{% for package in inst.agent_packages | default(droneci_autoscaler_agent_packages) %}
- {{ package }}
{% endfor %}
2020-09-30 19:56:00 +00:00
- 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"
}
2020-12-06 12:35:42 +00:00
{% if inst.docker_auth_config | default(droneci_autoscaler_docker_auth_config) is defined %}
- path: /root/.docker/config.json
content: |
2020-12-06 14:13:52 +00:00
{{ inst.docker_auth_config | default(droneci_autoscaler_docker_auth_config) | to_nice_json(indent=2) | indent(width=6) }}
2020-12-06 13:35:37 +00:00
{% endif %}
2020-12-06 12:35:42 +00:00
- path: /etc/drone.conf
content: |
{% if inst.docker_auth_config | default(droneci_autoscaler_docker_auth_config) is defined %}
2020-12-06 14:13:52 +00:00
PLUGIN_CONFIG={{ inst.docker_auth_config | default(droneci_autoscaler_docker_auth_config) | to_nice_json(indent=2) | regex_replace("\s+", " ") }}
2020-12-06 13:35:37 +00:00
{% endif %}
2020-09-30 19:56:00 +00:00
- 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 %}