This repository has been archived by the owner on Jul 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 182
WIP - Rework Container Linux (CoreOS) #389
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,109 @@ | ||
#cloud-config | ||
<%# | ||
kind: provision | ||
name: CoreOS provision | ||
oses: | ||
- CoreOS | ||
kind: snippet | ||
name: coreos_cloudconfig | ||
%> | ||
<% | ||
os_major = @host.operatingsystem.major.to_i | ||
%> | ||
coreos: | ||
units: | ||
- name: coreos-bootstrap.service | ||
runtime: no | ||
command: start | ||
content: | | ||
[Unit] | ||
Description=Install coreos to disk | ||
[Service] | ||
Type=oneshot | ||
ExecStart=/usr/bin/coreos-install \ | ||
-C <%= @host.operatingsystem.release_name %> \ | ||
-d <%= @host.params['install-disk'] || '/dev/sda' %> \ | ||
-c /home/core/cloud-config.yml <% if os_major >= 557 -%>-b <%= @mediapath %><% end %> | ||
ExecStartPost=/usr/bin/wget -q -O /dev/null --no-check-certificate <%= foreman_url('built') %> | ||
ExecStartPost=/usr/sbin/reboot | ||
[X-Fleet] | ||
X-Conflicts=coreos-bootstrap.service | ||
<% if @host.params['ssh_authorized_keys'] -%> | ||
ssh_authorized_keys: | ||
<% @host.params['ssh_authorized_keys'].split(',').map(&:strip).each do |ssh_key| -%> | ||
- "<%= ssh_key %>" | ||
units = 0 | ||
unless @host.param_false?('enable_etcd') | ||
units += 1 | ||
end | ||
if @host.param_true?('expose_docker_socket') | ||
units += 1 | ||
end | ||
if @host.subnet.respond_to?(:dhcp_boot_mode?) | ||
dhcp = @host.subnet.dhcp_boot_mode? && !@static | ||
else | ||
dhcp = !@static | ||
end | ||
unless dhcp | ||
units += 1 | ||
end | ||
-%> | ||
<% if units > 0 -%> | ||
coreos: | ||
<% if @host.params['reboot-strategy'] -%> | ||
update: | ||
reboot-strategy: <%= @host.params['reboot-strategy'] %> | ||
<% end -%> | ||
<% unless @host.param_false?('enable_etcd') -%> | ||
etcd2: | ||
<% if @host.params['etcd_discovery_url'] -%> | ||
discovery: <%= @host.params['etcd_discovery_url'] %> | ||
<% end -%> | ||
advertise-client-urls: http://<%= @host.ip %>:2379 | ||
initial-advertise-peer-urls: http://<%= @host.ip %>:2380 | ||
listen-client-urls: http://0.0.0.0:2379 | ||
listen-peer-urls: http://0.0.0.0:2380 | ||
<% end -%> | ||
units: | ||
<% unless @host.param_false?('enable_etcd') -%> | ||
- name: etcd2.service | ||
command: start | ||
- name: fleet.service | ||
command: start | ||
<% end -%> | ||
<% if @host.param_true?('expose_docker_socket') -%> | ||
- name: docker-tcp.socket | ||
command: start | ||
enable: yes | ||
content: | | ||
[Unit] | ||
Description=Docker Socket for the API | ||
|
||
[Socket] | ||
ListenStream=2375 | ||
BindIPv6Only=both | ||
Service=docker.service | ||
|
||
[Install] | ||
WantedBy=sockets.target | ||
- name: enable-docker-tcp.service | ||
command: start | ||
content: | | ||
[Unit] | ||
Description=Enable the Docker Socket for the API | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=/usr/bin/systemctl enable docker-tcp.socket | ||
<% end -%> | ||
<% unless dhcp -%> | ||
- name: systemd-networkd.service | ||
command: stop | ||
- name: static.network | ||
command: start | ||
content: | | ||
[Match] | ||
MACAddress=<%= @host.mac %> | ||
[Network] | ||
<% if @host.subnet.present? -%> | ||
Gateway=<%= @host.subnet.gateway %> | ||
<% end -%> | ||
Address=<%= @host.ip %>/<%= @host.subnet.cidr %> | ||
<% if @host.subnet.dns_primary.present? -%> | ||
DNS=<%= @host.subnet.dns_primary %> | ||
<% end -%> | ||
<% if @host.subnet.dns_secondary.present? -%> | ||
DNS=<%= @host.subnet.dns_secondary %> | ||
<% end -%> | ||
- name: down-interfaces.service | ||
command: start | ||
content: | | ||
[Service] | ||
Type=oneshot | ||
ExecStart=/usr/bin/bash -c 'for i in $(/usr/bin/ls /sys/class/net/); do [ $i == "lo" ] || (/usr/bin/ip link set $i down; /usr/bin/ip addr flush dev $i); done' | ||
- name: systemd-networkd.service | ||
command: restart | ||
<% end -%> | ||
<% end -%> | ||
<% if @host.params['ssh_authorized_keys'] -%> | ||
ssh_authorized_keys: | ||
<% @host.params['ssh_authorized_keys'].split(',').map(&:strip).each do |ssh_key| -%> | ||
- "<%= ssh_key %>" | ||
<% end -%> | ||
<% else -%> | ||
users: | ||
- name: core | ||
passwd: <%= root_pass %> | ||
<% end -%> | ||
write_files: | ||
- content: | | ||
<%= snippet 'coreos_cloudconfig' %> | ||
path: /home/core/cloud-config.yml | ||
permissions: '0600' | ||
owner: core:core | ||
users: | ||
- name: core | ||
passwd: <%= root_pass %> | ||
<% end -%> |
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please replace all
@host.params
withhost_param()
as in #484