Skip to content

Instantly share code, notes, and snippets.

@TanyaCouture
Last active February 18, 2016 16:25
Show Gist options
  • Save TanyaCouture/7e2cbc90293081c2adf7 to your computer and use it in GitHub Desktop.
Save TanyaCouture/7e2cbc90293081c2adf7 to your computer and use it in GitHub Desktop.
etcd-package-plans
`mantl-etcd`
defaults/main.yml
// variables
files/etcd-service-start.sh
files/etc-service.json
handlers/main.yml
// sudo systemctl restart etcd
// sudo systmectl restart skydns
meta/main.yml
// dependent on handlers role
tasks/main.yml
// sudo install version of etcd specified in variables
10// generate systemd environment file
// copy /etcd.conf.j2 /etc/etcd.conf
// chmod 0644
// reload systemd
// restart etcd
solutions:
sudo cp -p templates/etcd.conf /etc/etcd.conf
sudo chmod 0644 /etc/etcd.conf
sudo systemctl daemon-reload
sudo systemctl restart etcd
24// install etcd launch script
// sudo
// copy etcd-service-start.sh to /usr/local/bin
// chmod 0755
//restart etcd
solutions:
sudo cp etcd-service-start.sh /usr/local/bin/
sudo chmod 0755 /usr/local/bin/etcd-service-start.sh
sudo systemctl restart etcd
35// create directory /etc/systemd/system/etcd.service.d
solutions:
sudo mkdir -p /etc/systemd/system/etcd.service.d
43// create local etcd service override
// // gives the config these contents
// [Service]
ExecStart=
ExecStart=/usr/local/bin/etcd-service-start.sh
to
/etc/systemd/system/etcd.service.d/local.conf
56// install consul check script
// when consul_dc_group is defined
// copy consul-check-etcd-member to /usr/local/bin
// chmod 0755
solutions:
//when consul_dc_group is defined
sudo cp consul-check-etcd-member /usr/local/bin/
chmod 0755 /usr/local/bin/consul-check-etcd-member
66// when consul_dc_group is defined
// sudo copy etcd-service.json to /etc/consul
// reload consul
solutions:
// when consul_dc_group is defined
sudo cp etcd-service.json /etc/consul/
sudo systemctl reload consul
77// enable and start etcd service
solutions:
sudo systemctl enable etcd 2>/dev/null
sudo systemctl start etcd
86 // when dns_setup is defined include skydns.yml
89 // meta: flush_handlers
/tasks/skydns.yml
// sudo
// cp skydns.service.j2 /usr/lib/systemd/system/skydns.service
// chmod 0644
// reload systemd
// restart skydns
solutions:
sudo cp skydns.service /usr/lib/systemd/system/skydns.service
sudo chmod 0644 /usr/lib/systemd/system/skydns.service
sudo systemctl daemon-reload
sudo systemctl restart skydns
// sudo
// cp skydns.env.j2 /etc/default/skydns.env
// mode 0644?
solutions:
sudo cp skydns.env /etc/default/
sudo chmod 0644 /etc/default/skydns.env
/templates/
// configurations
@sehqlr
Copy link

sehqlr commented Feb 17, 2016

This is progress! There are a few comments I'd like to make here, and I can be corrected if need be.

  1. There are a couple of calls to systemctl daemon-reload and systemctl restart. We could squash these into one set of calls at the end. But that can be for a second draft
  2. All of the source files that have .j2 exts are templates that can't just be copied over. These will have to be translated to consul template files, and they will be installed in /etc/consul-template/templates
  3. I don't know if sudo is required for scripts within a package, since I think that all package commands are executed with escalated permissions anyway
  4. If there is any metadata that we need to store on disk (say, the ansible variables), we can add them to /etc/mantl as files. We should keep that in mind as we build out the packages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment