forked from gitbeyond/ansible_roles
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add elasticsearch_install etcd_install k8s_master_install
- Loading branch information
Showing
44 changed files
with
601 additions
and
37 deletions.
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
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,10 +1,10 @@ | ||
|
||
- name: mkdir project dir | ||
file: path={{item}} state=directory owner={{project_run_user}} group={{project_run_group}} mode=0755 | ||
with_items: | ||
- "{{project_install_dir}}" | ||
- "{{project_log_dir}}" | ||
- "{{project_data_dir}}" | ||
with_items: "{{project_dir}}" | ||
# - "{{project_install_dir}}" | ||
# - "{{project_log_dir}}" | ||
# - "{{project_data_dir}}" | ||
#when: item is defined | ||
ignore_errors: true | ||
#ignore_errors: true | ||
|
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
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- hosts: 10.111.111.110 | ||
remote_user: root | ||
roles: | ||
- { role: jdk_install, jdk_packet: /root/fangzhou/packet/jdk1.7.0_67.tar.gz } |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# | ||
# es_packet: | ||
# es_ | ||
es_conf_dir: /data/apps/config/elasticsearch | ||
es_log_dir: /data/apps/log/elasticsearch | ||
es_var_dir: /data/apps/var/elasticsearch | ||
es_data_dir: /data/apps/data/elasticsearch | ||
es_base_dir: /data/apps/opt/elasticsearch | ||
es_run_user: elk | ||
es_boot_method: supervisor | ||
es_confs: | ||
- jvm.options | ||
- elasticsearch.yml | ||
|
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
- name: copy es env file | ||
template: src={{ item.src }} dest={{ item.dest }} owner={{ item.owner }} group={{ item.group }} mode={{ item.mode }} backup=yes | ||
with_items: | ||
- { src: 'es.sh', dest: '/etc/profile.d/', owner: root, group: root, mode: "0644" } | ||
- { src: 'elasticsearch.ini', dest: '{{supervisor_conf_dir}}', owner: root, group: root, mode: "0644" } | ||
#- { src: 'htpasswd', dest: '{{ config_dir }}/nginx/' , owner: 'root', group: 'root', mode: '0644'} | ||
|
||
- name: copy es conf file | ||
template: src={{ item }} dest={{ es_base_dir }}/config owner={{ es_run_user }} group={{ es_run_user }} mode=0644 backup=yes | ||
with_items: '{{es_confs}}' | ||
tags: | ||
- modify_es_conf | ||
# notify: | ||
# - restart nginx service |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# edirtor: haifeng | ||
# 2019/04/29 | ||
|
||
- name: create es user | ||
user: name={{ item.name }} state=present | ||
with_items: | ||
- { name: '{{ es_run_user }}'} | ||
|
||
#- name: link /data1 to /data dir | ||
# file: src={{ item.src }} dest={{item.dest}} owner={{ item.owner }} group={{ item.group }} mode={{ item.mode }} state={{ item.state }} | ||
# with_items: | ||
# - { src: /data1, dest: /data, owner: root, group: root, mode: "0777", state: link} | ||
|
||
- name: create es dir | ||
file: path={{ item.path }} owner={{ item.owner }} group={{ item.group }} mode={{ item.mode }} state={{ item.state }} | ||
with_items: | ||
- { path: "{{app_base_dir}}", owner: root, group: root, mode: "0755", state: directory } | ||
- { path: "{{es_conf_dir}}", owner: root, group: root, mode: "0755", state: directory } | ||
- { path: "{{es_log_dir}}", owner: '{{ es_run_user }}', group: '{{ es_run_user }}', mode: "0755", state: directory } | ||
- { path: "{{es_var_dir}}", owner: '{{ es_run_user }}', group: root, mode: "0755", state: directory } | ||
- { path: "{{es_data_dir}}", owner: '{{ es_run_user }}', group: root, mode: "0755", state: directory } |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
- name: get es packet dir name | ||
local_action: shell tar tvf {{es_packet}} |tail -n 1 |awk '{print $NF}' |awk -F'/' '{print $1}' | ||
register: es_dir_name | ||
run_once: true | ||
|
||
- name: cp and unarchive es to remote host | ||
unarchive: src={{ item.src }} dest={{ item.dest }} owner='{{ es_run_user }}' group={{ es_run_user }} creates={{ item.creates }} mode={{item.mode}} | ||
with_items: | ||
- { src: '{{es_packet}}', dest: '{{ app_base_dir}}/', creates: '{{ app_base_dir }}/{{es_dir_name.stdout}}', mode: "0755" } | ||
|
||
- name: create es link dir | ||
file: src={{ item.src }} dest={{item.dest}} state={{ item.state }} | ||
with_items: | ||
- { src: "{{app_base_dir}}/{{es_dir_name.stdout}}", dest: "{{es_base_dir}}", state: link} | ||
|
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
- include: create_es_dir.yml | ||
tags: | ||
- create_es_dir | ||
- include: install_es.yml | ||
tags: | ||
- install_es | ||
- include: copy_es_conf.yml | ||
tags: | ||
- copy_es_conf |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[program:elasticsearch] | ||
command = {{es_base_dir}}/bin/elasticsearch | ||
directory = {{es_base_dir}} | ||
autostart = true | ||
autorestart = true | ||
startsecs = 5 | ||
startretries = 3 | ||
user = {{es_run_user}} | ||
environment=JAVA_HOME="{{ansible_env.JAVA_HOME}}" | ||
redirect_stderr = false | ||
stdout_logfile={{es_log_dir}}/elasticsearch-std.log | ||
stderr_logfile={{es_log_dir}}/elasticsearch-err.log |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export ES_HOME={{es_base_dir}} | ||
export PATH=$ES_HOME/bin:$PATH |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
#pack_dir: /root/soft | ||
#remote_dir: /root/ | ||
#jdk_packet: "{{ pack_dir }}/jdk-8u91-linux-x64.gz" | ||
#jdk_dir_name: jdk1.8.0_91 | ||
#install_dir: /usr/local |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
- hosts: k8s_125_master | ||
remote_user: root | ||
roles: | ||
- { role: etcd_install} | ||
|
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# global | ||
app_base_dir: /data/apps/opt | ||
|
||
# etcd | ||
etcd_work_dir: /root/ningbo_bank/etcd | ||
etcd_local_conf_dir: "{{etcd_work_dir}}/ansible_etcd_confs" | ||
etcd_cert_dir: ansible_etcd_certs | ||
|
||
etcd_run_user: etcd | ||
etcd_packet: "{{etcd_work_dir}}/etcd-v3.2.26-linux-amd64.tar.gz" | ||
# etcd dir | ||
etcd_base_dir: /data/apps/opt/etcd | ||
etcd_data_dir: /data/apps/data/etcd | ||
etcd_conf_dir: /data/apps/config/etcd | ||
etcd_var_dir: /data/apps/var/etcd | ||
etcd_log_dir: /data/apps/log/etcd |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- name: add to system service list | ||
shell: '{{ item }}' | ||
with_items: | ||
- systemctl daemon-reload |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
- name: copy etcd ssl file | ||
copy: src={{ item }} dest={{ etcd_conf_dir }}/ssl owner={{ etcd_run_user }} group={{ etcd_run_user }} mode=0644 backup=yes | ||
#with_items: | ||
# - { src: '{{etcd_work_dir}}/{{}}', dest: '{{ etcd_conf_dir }}/', owner: '{{etcd_run_user}}', group: '{{etcd_run_user}}', mode: "0644"} | ||
with_fileglob: '{{etcd_work_dir}}/{{etcd_cert_dir}}/*.pem' | ||
|
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
- name: create ansible_etcd_certs dir | ||
#local_action: file path="{{etcd_work_dir}}/ansible_etcd_certs" state=directory | ||
local_action: file path="{{etcd_work_dir}}/{{etcd_cert_dir}}" state=directory | ||
run_once: true | ||
|
||
- name: generate etcd-root-ca | ||
local_action: shell /usr/bin/cfssl gencert -initca ca-csr.json | cfssljson --bare {{etcd_cert_dir}}/etcd-root-ca | ||
#shell: /usr/bin/cfssl gencert -initca ca-csr.json | cfssljson --bare {{etcd_cert_dir}}/etcd-root-ca | ||
args: | ||
chdir: "{{etcd_work_dir}}" | ||
creates: "{{etcd_work_dir}}/{{etcd_cert_dir}}/etcd-root-ca.pem" | ||
run_once: true | ||
#delegate_to: localhost | ||
|
||
- name: generate etcd-server-ca | ||
local_action: shell /usr/bin/cfssl gencert -ca={{etcd_cert_dir}}/etcd-root-ca.pem -ca-key={{etcd_cert_dir}}/etcd-root-ca-key.pem -config=ca-config.json -profile=server server.json | cfssljson --bare {{etcd_cert_dir}}/etcd-server-ca | ||
args: | ||
chdir: "{{etcd_work_dir}}" | ||
creates: "{{etcd_work_dir}}/{{etcd_cert_dir}}/etcd-server-ca.pem" | ||
run_once: true | ||
#delegate_to: localhost | ||
|
||
- name: generate etcd-member-ca | ||
local_action: shell /usr/bin/cfssl gencert -ca={{etcd_cert_dir}}/etcd-root-ca.pem -ca-key={{etcd_cert_dir}}/etcd-root-ca-key.pem -config=ca-config.json -profile=peer member.json | cfssljson --bare {{etcd_cert_dir}}/etcd-member-ca | ||
args: | ||
chdir: "{{etcd_work_dir}}" | ||
creates: "{{etcd_work_dir}}/{{etcd_cert_dir}}/etcd-member-ca.pem" | ||
run_once: true | ||
#delegate_to: localhost | ||
|
||
- name: generate etcd-client-ca | ||
local_action: shell /usr/bin/cfssl gencert -ca={{etcd_cert_dir}}/etcd-root-ca.pem -ca-key={{etcd_cert_dir}}/etcd-root-ca-key.pem -config=ca-config.json -profile=client client.json | cfssljson --bare {{etcd_cert_dir}}/etcd-client-ca | ||
args: | ||
chdir: "{{etcd_work_dir}}" | ||
creates: "{{etcd_work_dir}}/{{etcd_cert_dir}}/etcd-client-ca.pem" | ||
run_once: true |
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
- name: create etcd user | ||
user: name={{etcd_run_user}} system=yes | ||
|
||
- name: get etcd packet dir name | ||
local_action: shell tar tvf {{etcd_packet}} |tail -n 1 |awk '{print $NF}' |awk -F'/' '{print $1}' | ||
register: etcd_dir_name | ||
run_once: true | ||
|
||
- name: create etcd dir | ||
file: path={{ item.path }} owner={{ item.owner }} group={{ item.group }} mode={{ item.mode }} state={{ item.state }} | ||
with_items: | ||
- { path: "{{app_base_dir}}", owner: root, group: root, mode: "0755", state: directory } | ||
- { path: "{{etcd_log_dir}}", owner: '{{etcd_run_user}}', group: '{{etcd_run_user}}', mode: "0755", state: directory } | ||
- { path: "{{etcd_data_dir}}", owner: '{{etcd_run_user}}', group: '{{etcd_run_user}}', mode: "0755", state: directory } | ||
- { path: "{{etcd_data_dir}}/{{etcd_name}}.etcd", owner: '{{etcd_run_user}}', group: '{{etcd_run_user}}', mode: "0755", state: directory } | ||
- { path: "{{etcd_data_dir}}/wal", owner: '{{etcd_run_user}}', group: '{{etcd_run_user}}', mode: "0755", state: directory } | ||
- { path: "{{etcd_var_dir}}", owner: '{{etcd_run_user}}', group: '{{etcd_run_user}}', mode: "0755", state: directory } | ||
- { path: "{{etcd_conf_dir}}", owner: '{{etcd_run_user}}', group: '{{etcd_run_user}}', mode: "0755", state: directory } | ||
- { path: "{{etcd_conf_dir}}/ssl", owner: '{{etcd_run_user}}', group: '{{etcd_run_user}}', mode: "0755", state: directory } | ||
|
||
- name: cp and unarchive etcd_binary_tarball to remote host | ||
unarchive: src={{ item.src }} dest={{ item.dest }} owner={{ etcd_run_user }} group={{ etcd_run_user }} creates={{ item.creates }} | ||
with_items: | ||
- { src: '{{etcd_packet}}', dest: '{{ app_base_dir}}/', creates: '{{ app_base_dir }}/{{etcd_dir_name.stdout}}', mode: "0755" } | ||
|
||
- name: create etcd link dir | ||
file: src={{ item.src }} dest={{item.dest}} state={{ item.state }} | ||
with_items: | ||
- { src: "{{app_base_dir}}/{{etcd_dir_name.stdout}}", dest: '{{etcd_base_dir}}', state: link} | ||
when: etcd_dir_name.stdout != "etcd" | ||
|
||
- name: create etcd conf dir link | ||
file: src={{ item.src }} dest={{item.dest}} state={{ item.state }} | ||
with_items: | ||
- { src: "{{etcd_conf_dir}}", dest: '/etc/etcd', state: link} | ||
ignore_errors: true | ||
|
||
- name: copy etcd conf file | ||
template: src={{item.src}} dest={{item.dest}} owner={{item.owner}} group={{item.group}} mode={{item.mode}} backup=yes | ||
with_items: | ||
- {src: etcd.sh, dest: /etc/profile.d/, owner: root, group: root, mode: "0644"} | ||
- {src: etcd.systemd, dest: /usr/lib/systemd/system/etcd.service, owner: root, group: root, mode: "0644"} | ||
- {src: '{{etcd_work_dir}}/ansible_etcd_confs/etcd.conf', dest: '{{etcd_conf_dir}}', owner: '{{etcd_run_user}}', group: '{{etcd_run_user}}', mode: "0644"} |
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
|
||
|
||
|
||
|
||
- name: copy etcd rpm packet | ||
copy: src=/root/kubernetes/k8s/etcd-3.2.7-1.el7.x86_64.rpm dest=/root/ | ||
- name: install etcd | ||
yum: name={{ item.name }} state={{ item.state }} | ||
with_items: | ||
- { name: /root/etcd-3.2.7-1.el7.x86_64.rpm, state: latest} | ||
|
||
|
||
- name: create docker graph dir | ||
file: path={{item.path}} state={{item.state}} owner={{item.owner}} group={{item.group}} mode={{item.mode}} | ||
with_items: | ||
- {path: /etc/etcd/ssl, state: directory, owner: etcd, group: etcd, mode: '0755'} | ||
- {path: /data/apps/data/etcd, state: directory, owner: etcd, group: etcd, mode: '0755'} | ||
|
||
- name: copy etcd certificate | ||
#copy: src={{item.src}} dest={{item.dest}} owner={{item.owner}} group={{item.group}} mode={{item.mode}} backup=yes | ||
copy: src={{item}} dest=/etc/etcd/ssl owner=etcd group=etcd mode=0644 backup=yes | ||
with_items: "{{etcd_certs}}" | ||
#- {src: /root/kubernetes/etcd/etcd-key.pem, dest: /etc/etcd/ssl/, owner: etcd, group: etcd, mode: '0644'} | ||
#- {src: /root/kubernetes/etcd/etcd.pem, dest: /etc/etcd/ssl/, owner: etcd, group: etcd, mode: '0644'} | ||
#- {src: /root/kubernetes/etcd/etcd-root-ca-key.pem, dest: /etc/etcd/ssl/, owner: etcd, group: etcd, mode: '0644'} | ||
#- {src: /root/kubernetes/etcd/etcd-root-ca.pem, dest: /etc/etcd/ssl/, owner: etcd, group: etcd, mode: '0644'} | ||
- name: copy etcd certificate | ||
copy: src={{item.src}} dest={{item.dest}} owner={{item.owner}} group={{item.group}} mode={{item.mode}} backup=yes | ||
with_items: | ||
- {src: etcd.sh, dest: /etc/profile.d/etcd.sh, owner: root, group: root, mode: '0644'} | ||
- name: copy etcd conf file | ||
template: src={{item.src}} dest={{item.dest}} owner={{item.owner}} group={{item.group}} mode={{item.mode}} backup=yes | ||
with_items: | ||
- {src: /root/kubernetes/etcd/conf/etcd.conf, dest: /etc/etcd/, owner: root, group: root, mode: "0644"} | ||
- name: add etcdctl alias to bashrc | ||
lineinfile: line={{item.line}} path={{item.path}} backup=yes | ||
with_items: | ||
#- {line: "alias etcdctl='etcdctl --cacert=/etc/etcd/ssl/etcd-root-ca.pem --cert=/etc/etcd/ssl/etcd.pem --key=/etc/etcd/ssl/etcd-key.pem --endpoints=https://10.111.33.29:2379,https://10.111.33.17:2379,https://10.111.33.20:2379'", path: /root/.bashrc } | ||
- {line: "alias etcdctl='etcdctl --cacert=/etc/etcd/ssl/etcd-root-ca.pem --cert=/etc/etcd/ssl/etcd.pem --key=/etc/etcd/ssl/etcd-key.pem --endpoints={{etcd_endpoint}}'", path: /root/.bashrc } | ||
#- name: modify docker conf file | ||
# lineinfile: line='ExecStart=/usr/bin/dockerd --insecure-registry 10.111.32.82:5000 --graph /data/apps/data/docker' regexp='ExecStart=/usr/bin/dockerd' path=/usr/lib/systemd/system/docker.service | ||
#- name: reload systemd | ||
# shell: systemctl daemon-reload | ||
|
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
- include: generate_certs.yml | ||
tags: | ||
- generate_certs | ||
- include: install_etcd_for_binary.yml | ||
tags: | ||
- install_etcd_for_binary | ||
- include: copy_ssl_certs.yml | ||
tags: | ||
- copy_ssl_certs | ||
- include: start_etcd.yml | ||
tags: | ||
- start_etcd | ||
|
||
- include: set_etcdctl_env.yml | ||
tags: | ||
- set_etcdctl_env |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
- name: add etcdctl alias to bashrc | ||
lineinfile: line={{item.line}} path={{item.path}} backup=yes | ||
with_items: | ||
#- {line: "alias etcdctl='etcdctl --cacert=/etc/etcd/ssl/etcd-root-ca.pem --cert=/etc/etcd/ssl/etcd.pem --key=/etc/etcd/ssl/etcd-key.pem --endpoints=https://10.111.33.29:2379,https://10.111.33.17:2379,https://10.111.33.20:2379'", path: /root/.bashrc } | ||
- {line: "alias etcdctl='etcdctl --cacert={{etcd_conf_dir}}/ssl/etcd-root-ca.pem --cert={{etcd_conf_dir}}/ssl/etcd-client-ca.pem --key={{etcd_conf_dir}}/ssl/etcd-client-ca-key.pem --endpoints={{etcd_client_endpoints}}'", path: /root/.bashrc } |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
- name: start etcd.service | ||
systemd: | ||
name: etcd | ||
state: started | ||
enabled: yes | ||
|
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
export PATH=/data/apps/opt/etcd:$PATH | ||
export ETCDCTL_API=3 | ||
export ETCDCTL_CA_FILE={{etcd_conf_dir}}/ssl/etcd-root-ca.pem | ||
export ETCDCTL_KEY_FILE={{etcd_conf_dir}}/ssl/etcd-client-ca-key.pem | ||
export ETCDCTL_CERT_FILE={{etcd_conf_dir}}/ssl/etcd-client-ca.pem |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[Unit] | ||
Description=Etcd Server | ||
After=network.target | ||
After=network-online.target | ||
Wants=network-online.target | ||
|
||
[Service] | ||
Type=notify | ||
WorkingDirectory={{etcd_data_dir}} | ||
EnvironmentFile=-{{etcd_conf_dir}}/etcd.conf | ||
User=etcd | ||
# set GOMAXPROCS to number of processors | ||
ExecStart=/bin/bash -c "GOMAXPROCS=$(nproc) {{etcd_base_dir}}/etcd --name=\"${ETCD_NAME}\" --data-dir=\"${ETCD_DATA_DIR}\" --listen-client-urls=\"${ETCD_LISTEN_CLIENT_URLS}\"" | ||
Restart=on-failure | ||
LimitNOFILE=65536 | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
Oops, something went wrong.