Set default etcd deployment to docker
Improved docker reload command to wait for etcd to be up before proceeding. Switched reload to run restart because it can't reload if it is not guaranteed to be in running state.
This commit is contained in:
parent
116b14d8f8
commit
40207937f7
6 changed files with 31 additions and 35 deletions
|
@ -3,7 +3,7 @@ etcd_version: v3.0.1
|
|||
etcd_bin_dir: "{{ local_release_dir }}/etcd/etcd-{{ etcd_version }}-linux-amd64/"
|
||||
|
||||
# Possible values: host, docker
|
||||
etcd_deployment_type: "host"
|
||||
etcd_deployment_type: "docker"
|
||||
|
||||
|
||||
etcd_image_repo: "quay.io/coreos/etcd"
|
||||
|
|
|
@ -3,42 +3,35 @@
|
|||
command: /bin/true
|
||||
notify:
|
||||
- reload systemd
|
||||
- start etcd
|
||||
- reload etcd
|
||||
- wait for etcd up
|
||||
|
||||
- name: restart etcd-proxy
|
||||
command: /bin/true
|
||||
notify:
|
||||
- reload systemd
|
||||
- start etcd-proxy
|
||||
- reload etcd-proxy
|
||||
- wait for etcd up
|
||||
|
||||
- name: reload systemd
|
||||
command: systemctl daemon-reload
|
||||
when: ansible_service_mgr == "systemd"
|
||||
|
||||
- name: start etcd
|
||||
service:
|
||||
name: etcd
|
||||
enabled: yes
|
||||
state: started
|
||||
when: is_etcd_master
|
||||
|
||||
- name: start etcd-proxy
|
||||
service:
|
||||
name: etcd-proxy
|
||||
enabled: yes
|
||||
state: started
|
||||
when: is_etcd_proxy
|
||||
- name: wait for etcd up
|
||||
uri: url=http://localhost:2379/health
|
||||
register: result
|
||||
until: result.status == 200
|
||||
retries: 10
|
||||
delay: 5
|
||||
|
||||
- name: reload etcd
|
||||
service:
|
||||
name: etcd
|
||||
state: "{{ 'restarted' if etcd_deployment_type == 'host' else 'reloaded' }}"
|
||||
state: restarted
|
||||
when: is_etcd_master
|
||||
|
||||
- name: reload etcd-proxy
|
||||
service:
|
||||
name: etcd-proxy
|
||||
state: "{{ 'restarted' if etcd_deployment_type == 'host' else 'reloaded' }}"
|
||||
state: restarted
|
||||
when: is_etcd_proxy
|
||||
|
|
|
@ -5,19 +5,6 @@
|
|||
- include: configure.yml
|
||||
- include: refresh_config.yml
|
||||
|
||||
- name: Restart etcd if binary changed
|
||||
command: /bin/true
|
||||
notify: restart etcd
|
||||
when: etcd_deployment_type == "host" and etcd_copy.stdout_lines and is_etcd_master
|
||||
|
||||
- name: Restart etcd-proxy if binary changed
|
||||
command: /bin/true
|
||||
notify: restart etcd-proxy
|
||||
when: etcd_deployment_type == "host" and etcd_copy.stdout_lines and is_etcd_proxy
|
||||
|
||||
# Reload systemd before starting service
|
||||
- meta: flush_handlers
|
||||
|
||||
- name: Ensure etcd is running
|
||||
service:
|
||||
name: etcd
|
||||
|
@ -32,6 +19,19 @@
|
|||
enabled: yes
|
||||
when: is_etcd_proxy
|
||||
|
||||
- name: Restart etcd if binary changed
|
||||
command: /bin/true
|
||||
notify: restart etcd
|
||||
when: etcd_deployment_type == "host" and etcd_copy.stdout_lines and is_etcd_master
|
||||
|
||||
- name: Restart etcd-proxy if binary changed
|
||||
command: /bin/true
|
||||
notify: restart etcd-proxy
|
||||
when: etcd_deployment_type == "host" and etcd_copy.stdout_lines and is_etcd_proxy
|
||||
|
||||
# Reload systemd before starting service
|
||||
- meta: flush_handlers
|
||||
|
||||
# After etcd cluster is assembled, make sure that
|
||||
# initial state of the cluster is in `existing`
|
||||
# state insted of `new`.
|
||||
|
|
|
@ -22,7 +22,7 @@ ExecStartPre=-{{ docker_bin_dir | default("/usr/bin") }}/docker rm -f {{ etcd_me
|
|||
ExecReload={{ docker_bin_dir | default("/usr/bin") }}/docker restart {{ etcd_member_name | default("etcd-proxy") }}
|
||||
ExecStop={{ docker_bin_dir | default("/usr/bin") }}/docker stop {{ etcd_member_name | default("etcd-proxy") }}
|
||||
Restart=always
|
||||
RestartSec=10s
|
||||
RestartSec=15s
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
|
@ -22,7 +22,7 @@ ExecStartPre=-{{ docker_bin_dir | default("/usr/bin") }}/docker rm -f {{ etcd_pr
|
|||
ExecReload={{ docker_bin_dir | default("/usr/bin") }}/docker restart {{ etcd_proxy_member_name | default("etcd-proxy") }}
|
||||
ExecStop={{ docker_bin_dir | default("/usr/bin") }}/docker stop {{ etcd_proxy_member_name | default("etcd-proxy") }}
|
||||
Restart=always
|
||||
RestartSec=10s
|
||||
RestartSec=15s
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
|
@ -38,8 +38,11 @@
|
|||
changed_when: false
|
||||
|
||||
- name: Calico | wait for etcd
|
||||
wait_for:
|
||||
port: 2379
|
||||
uri: url=http://localhost:2379/health
|
||||
register: result
|
||||
until: result.status == 200
|
||||
retries: 10
|
||||
delay: 5
|
||||
when: inventory_hostname in groups['kube-master']
|
||||
|
||||
- name: Calico | Check if calico network pool has already been configured
|
||||
|
|
Loading…
Reference in a new issue