diff options
author | Fredrik Thulin <fredrik@thulin.net> | 2015-04-26 09:10:42 +0200 |
---|---|---|
committer | Fredrik Thulin <fredrik@thulin.net> | 2015-04-26 09:10:42 +0200 |
commit | 1d27bd18a1c03ae9fa9d3afb7fdc5bf401a23e94 (patch) | |
tree | 700453a90c269410c0101853eb940c9996e4d452 /global/overlay/etc/puppet/modules/sunet/manifests/etcd_node.pp | |
parent | d6a0cfe99e4b5b91307386e6746bf3587f3b32bb (diff) | |
parent | deeb38e36bf12b51535cae4a6e61ab145a0720d6 (diff) |
Merge branch 'master' of git.nordu.net:sunet-opssunet-ops-2015-04-26-v01
Diffstat (limited to 'global/overlay/etc/puppet/modules/sunet/manifests/etcd_node.pp')
-rw-r--r-- | global/overlay/etc/puppet/modules/sunet/manifests/etcd_node.pp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/global/overlay/etc/puppet/modules/sunet/manifests/etcd_node.pp b/global/overlay/etc/puppet/modules/sunet/manifests/etcd_node.pp new file mode 100644 index 0000000..a80d355 --- /dev/null +++ b/global/overlay/etc/puppet/modules/sunet/manifests/etcd_node.pp @@ -0,0 +1,44 @@ +define sunet::etcd_node( + $disco_url = undef, + $etcd_version = 'v2.0.8', + $proxy = true +) +{ + include stdlib + + file { ["/data/${name}","/data/${name}/${::hostname}"]: ensure => 'directory' } + $common_args = ["--discovery ${disco_url}", + "--name ${::hostname}", + "--data-dir /data", + "--key-file /etc/ssl/private/${::fqdn}_infra.key", + "--ca-file /etc/ssl/certs/infra.crt", + "--cert-file /etc/ssl/certs/${::fqdn}_infra.crt"] + if $proxy { + $args = concat($common_args,["--proxy on","--listen-client-urls http://0.0.0.0:4001,http://0.0.0.0:2379"]) + } else { + $args = concat($common_args,["--initial-advertise-peer-urls http://${::ipaddress_eth1}:2380", + "--advertise-client-urls http://${::ipaddress_eth1}:2379", + "--listen-peer-urls http://0.0.0.0:2380", + "--listen-client-urls http://0.0.0.0:4001,http://0.0.0.0:2379", + "--peer-key-file /etc/ssl/private/${::fqdn}_infra.key", + "--peer-ca-file /etc/ssl/certs/infra.crt", + "--peer-cert-file /etc/ssl/certs/${::fqdn}_infra.crt"]) + } + sunet::docker_run { "etcd_${name}": + image => 'quay.io/coreos/etcd', + imagetag => $etcd_version, + volumes => ["/data/${name}:/data","/etc/ssl:/etc/ssl"], + command => join($args," "), + ports => ["${::ipaddress_eth1}:2380:2380","${::ipaddress_eth1}:2379:2379","${::ipaddress_docker0}:4001:2379"] + } + if !$proxy { + ufw::allow { "allow-etcd-peer": + ip => "${::ipaddress_eth1}", + port => 2380 + } + ufw::allow { "allow-etcd-client": + ip => "${::ipaddress_eth1}", + port => 2379 + } + } +} |