Remove standalone etcd specific play, cleanup host mode

Now etcd role can optionally disable etcd cluster setup for faster
deployment when it is combined with etcd role.
This commit is contained in:
Matthew Mosesohn 2017-03-04 00:30:37 +04:00
parent 8f3d9e93ce
commit 02a8e78902
5 changed files with 18 additions and 24 deletions

View file

@ -39,17 +39,17 @@
- { role: kargo-defaults, when: "cert_management == 'vault'" } - { role: kargo-defaults, when: "cert_management == 'vault'" }
- { role: vault, tags: vault, vault_bootstrap: true, when: "cert_management == 'vault'" } - { role: vault, tags: vault, vault_bootstrap: true, when: "cert_management == 'vault'" }
- hosts: etcd:!k8s-cluster - hosts: etcd
any_errors_fatal: true any_errors_fatal: true
roles: roles:
- { role: kargo-defaults} - { role: kargo-defaults}
- { role: etcd, tags: etcd } - { role: etcd, tags: etcd, etcd_cluster_setup: true }
- hosts: k8s-cluster - hosts: k8s-cluster
any_errors_fatal: true any_errors_fatal: true
roles: roles:
- { role: kargo-defaults} - { role: kargo-defaults}
- { role: etcd, tags: etcd } - { role: etcd, tags: etcd, etcd_cluster_setup: false }
- hosts: etcd:k8s-cluster:vault - hosts: etcd:k8s-cluster:vault
any_errors_fatal: true any_errors_fatal: true

View file

@ -1,4 +1,7 @@
--- ---
# Set to false to only do certificate management
etcd_cluster_setup: true
etcd_bin_dir: "{{ local_release_dir }}/etcd/etcd-{{ etcd_version }}-linux-amd64/" etcd_bin_dir: "{{ local_release_dir }}/etcd/etcd-{{ etcd_version }}-linux-amd64/"
etcd_data_dir: "/var/lib/etcd" etcd_data_dir: "/var/lib/etcd"

View file

@ -1,9 +0,0 @@
---
- name: Install | Copy etcd binary from downloaddir
command: rsync -piu "{{ etcd_bin_dir }}/etcd" "{{ bin_dir }}/etcd"
register: etcd_copy
changed_when: false
- name: Install | Copy etcdctl binary from downloaddir
command: rsync -piu "{{ etcd_bin_dir }}/etcdctl" "{{ bin_dir }}/etcdctl"
changed_when: false

View file

@ -1,5 +1,6 @@
--- ---
- include: pre_upgrade.yml - include: pre_upgrade.yml
when: etcd_cluster_setup
tags: etcd-pre-upgrade tags: etcd-pre-upgrade
- include: check_certs.yml - include: check_certs.yml
@ -27,19 +28,18 @@
tags: upgrade tags: upgrade
- include: set_cluster_health.yml - include: set_cluster_health.yml
when: is_etcd_master when: is_etcd_master and etcd_cluster_setup
- include: configure.yml - include: configure.yml
when: is_etcd_master when: is_etcd_master and etcd_cluster_setup
- include: refresh_config.yml - include: refresh_config.yml
when: is_etcd_master when: is_etcd_master and etcd_cluster_setup
- name: Restart etcd if binary or certs changed - name: Restart etcd if certs changed
command: /bin/true command: /bin/true
notify: restart etcd notify: restart etcd
when: etcd_deployment_type == "host" and etcd_copy.stdout_lines and is_etcd_master when: is_etcd_master and etcd_secret_changed|default(false)
or etcd_secret_changed|default(false)
# reload-systemd # reload-systemd
- meta: flush_handlers - meta: flush_handlers
@ -49,13 +49,13 @@
name: etcd name: etcd
state: started state: started
enabled: yes enabled: yes
when: is_etcd_master when: is_etcd_master and etcd_cluster_setup
# After etcd cluster is assembled, make sure that # After etcd cluster is assembled, make sure that
# initial state of the cluster is in `existing` # initial state of the cluster is in `existing`
# state insted of `new`. # state insted of `new`.
- include: set_cluster_health.yml - include: set_cluster_health.yml
when: is_etcd_master when: is_etcd_master and etcd_cluster_setup
- include: refresh_config.yml - include: refresh_config.yml
when: is_etcd_master when: is_etcd_master and etcd_cluster_setup

View file

@ -39,17 +39,17 @@
- { role: kargo-defaults, when: "cert_management == 'vault'" } - { role: kargo-defaults, when: "cert_management == 'vault'" }
- { role: vault, tags: vault, vault_bootstrap: true, when: "cert_management == 'vault'" } - { role: vault, tags: vault, vault_bootstrap: true, when: "cert_management == 'vault'" }
- hosts: etcd:!k8s-cluster - hosts: etcd
any_errors_fatal: true any_errors_fatal: true
roles: roles:
- { role: kargo-defaults} - { role: kargo-defaults}
- { role: etcd, tags: etcd } - { role: etcd, tags: etcd, etcd_cluster_setup: true }
- hosts: k8s-cluster - hosts: k8s-cluster
any_errors_fatal: true any_errors_fatal: true
roles: roles:
- { role: kargo-defaults} - { role: kargo-defaults}
- { role: etcd, tags: etcd } - { role: etcd, tags: etcd, etcd_cluster_setup: false }
- hosts: etcd:k8s-cluster:vault - hosts: etcd:k8s-cluster:vault
any_errors_fatal: true any_errors_fatal: true