mirror of
https://github.com/phfroidmont/self-hosting.git
synced 2025-12-25 05:36:59 +01:00
Custom etcd role
This commit is contained in:
parent
958fb6be2f
commit
75a4c037da
11 changed files with 1038 additions and 5 deletions
104
roles/etcd/tasks/main.yml
Normal file
104
roles/etcd/tasks/main.yml
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
---
|
||||
- name: Create etcd config directory
|
||||
file:
|
||||
path: "{{etcd_conf_dir}}"
|
||||
state: directory
|
||||
tags:
|
||||
- etcd
|
||||
|
||||
- name: Create etcd download directory
|
||||
file:
|
||||
path: "{{etcd_download_dir}}"
|
||||
state: directory
|
||||
tags:
|
||||
- etcd
|
||||
|
||||
- name: Create etcd bin directory
|
||||
file:
|
||||
path: "{{etcd_bin_dir}}"
|
||||
state: directory
|
||||
tags:
|
||||
- etcd
|
||||
|
||||
- name: Create etcd data directory
|
||||
file:
|
||||
path: "{{etcd_data_dir}}"
|
||||
state: directory
|
||||
tags:
|
||||
- etcd
|
||||
|
||||
- name: Copy certificates
|
||||
copy:
|
||||
src: "{{k8s_ca_conf_directory}}/{{item}}"
|
||||
dest: "{{etcd_conf_dir}}/{{item}}"
|
||||
mode: 0640
|
||||
owner: root
|
||||
group: root
|
||||
with_items:
|
||||
- "{{etcd_certificates}}"
|
||||
tags:
|
||||
- etcd
|
||||
|
||||
- name: Downloading official etcd release
|
||||
get_url:
|
||||
url: https://github.com/coreos/etcd/releases/download/v{{etcd_version}}/etcd-v{{etcd_version}}-linux-amd64.tar.gz
|
||||
dest: "{{etcd_download_dir}}/etcd-v{{etcd_version}}-linux-amd64.tar.gz"
|
||||
mode: 0755
|
||||
tags:
|
||||
- etcd
|
||||
|
||||
- name: Unzip downloaded file
|
||||
unarchive:
|
||||
src: "{{etcd_download_dir}}/etcd-v{{etcd_version}}-linux-amd64.tar.gz"
|
||||
dest: "{{etcd_download_dir}}/"
|
||||
remote_src: yes
|
||||
owner: "root"
|
||||
group: "root"
|
||||
creates: "{{etcd_download_dir}}/etcd-v{{etcd_version}}-linux-amd64/etcd"
|
||||
tags:
|
||||
- etcd
|
||||
|
||||
- name: Copy etcd binaries to destination directory
|
||||
copy:
|
||||
src: "{{etcd_download_dir}}/etcd-v{{etcd_version}}-linux-amd64/{{item}}"
|
||||
dest: "{{etcd_bin_dir}}/{{item}}"
|
||||
mode: 0755
|
||||
owner: root
|
||||
group: root
|
||||
remote_src: yes
|
||||
with_items:
|
||||
- etcd
|
||||
- etcdctl
|
||||
tags:
|
||||
- etcd
|
||||
|
||||
- name: Combine etcd_settings and etcd_settings_user (if defined)
|
||||
set_fact:
|
||||
etcd_settings: "{{etcd_settings | combine(etcd_settings_user|default({})) }}"
|
||||
tags:
|
||||
- etcd
|
||||
- etcd-systemd
|
||||
|
||||
- name: Create systemd unit file
|
||||
template:
|
||||
src: etc/systemd/system/etcd.service.j2
|
||||
dest: /etc/systemd/system/etcd.service
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
notify:
|
||||
- reload systemd
|
||||
tags:
|
||||
- etcd
|
||||
- etcd-systemd
|
||||
|
||||
- meta: flush_handlers
|
||||
|
||||
- name: Enable and start etcd
|
||||
service:
|
||||
name: etcd
|
||||
enabled: yes
|
||||
state: started
|
||||
tags:
|
||||
- etcd
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue