scottslowe-learning-tools/swarm-etcd2-photon/cfg-etcd.yml
Scott S. Lowe f77e9928b5 Update environment
Update etcd-backed Docker Swarm environment with Ubuntu and Photon. Switch from shell provisioning to Ansible. Update Vagrantfile to use new techniques pioneered in other environments. Switch away from meta-data/user-data for Photon customization, use Ansible instead.

Signed-off-by: Scott S. Lowe <scott.lowe@scottlowe.org>
2016-10-21 12:45:13 -06:00

56 lines
1.2 KiB
YAML

---
- hosts: "all"
become: "yes"
remote_user: "vagrant"
vars:
etcd_ver: "v2.3.7"
etcd_os: "linux-amd64"
etcd_dir: "etcd-{{ etcd_ver }}-{{ etcd_os }}"
tasks:
- name: "Create etcd-related directories"
file:
path: "{{ item }}"
mode: 0755
state: "directory"
with_items:
- "/var/etcd"
- "/var/etcd/dl"
- name: "Get etcd from GitHub and unarchive"
unarchive:
src: "https://github.com/coreos/etcd/releases/download/{{ etcd_ver }}/{{ etcd_dir }}.tar.gz"
dest: "/var/etcd/dl"
copy: "no"
- name: "Move files into place"
copy:
src: "/var/etcd/dl/{{ etcd_dir }}/{{ item }}"
dest: "/usr/local/bin/"
remote_src: true
mode: 0755
with_items:
- "etcd"
- "etcdctl"
- name: "Copy etcd Upstart configuration file"
copy:
src: "etcd.conf"
dest: "/etc/init/etcd.conf"
owner: "root"
group: "root"
mode: 0644
- name: "Copy etcd override file"
copy:
src: "{{ ansible_hostname }}.defaults"
dest: "/etc/default/etcd"
owner: "root"
group: "root"
mode: 0644
- name: "Ensure etcd service is running"
service:
name: "etcd"
state: "started"