diff --git a/roles/etcd/tasks/configure.yml b/roles/etcd/tasks/configure.yml index 7b5c90718..7af17f69e 100644 --- a/roles/etcd/tasks/configure.yml +++ b/roles/etcd/tasks/configure.yml @@ -12,15 +12,6 @@ ETCDCTL_CERT_FILE: "{{ etcd_cert_dir }}/node-{{ inventory_hostname }}.pem" ETCDCTL_KEY_FILE: "{{ etcd_cert_dir }}/node-{{ inventory_hostname }}-key.pem" -- name: Install etcd launch script - template: - src: etcd.j2 - dest: "{{ bin_dir }}/etcd" - owner: 'root' - mode: 0755 - backup: yes - notify: restart etcd - - name: Configure | Copy etcd.service systemd file template: src: "etcd-{{ etcd_deployment_type }}.service.j2" diff --git a/roles/etcd/tasks/install_docker.yml b/roles/etcd/tasks/install_docker.yml index 43f4e44d8..291bb5f25 100644 --- a/roles/etcd/tasks/install_docker.yml +++ b/roles/etcd/tasks/install_docker.yml @@ -4,9 +4,17 @@ {{ docker_bin_dir }}/docker create --name etcdctl-binarycopy {{ etcd_image_repo }}:{{ etcd_image_tag }} && {{ docker_bin_dir }}/docker cp etcdctl-binarycopy:/usr/local/bin/etcdctl {{ bin_dir }}/etcdctl && {{ docker_bin_dir }}/docker rm -f etcdctl-binarycopy" - when: etcd_deployment_type == "docker" register: etcd_task_result until: etcd_task_result.rc == 0 retries: 4 delay: "{{ retry_stagger | random + 3 }}" changed_when: false + +- name: Install etcd launch script + template: + src: etcd.j2 + dest: "{{ bin_dir }}/etcd" + owner: 'root' + mode: 0755 + backup: yes + notify: restart etcd diff --git a/roles/etcd/tasks/install_host.yml b/roles/etcd/tasks/install_host.yml new file mode 100644 index 000000000..9e83905bc --- /dev/null +++ b/roles/etcd/tasks/install_host.yml @@ -0,0 +1,12 @@ +--- +- name: Install | Copy etcdctl and etcd binary from docker container + command: sh -c "{{ docker_bin_dir }}/docker rm -f etcdctl-binarycopy; + {{ docker_bin_dir }}/docker create --name etcdctl-binarycopy {{ etcd_image_repo }}:{{ etcd_image_tag }} && + {{ docker_bin_dir }}/docker cp etcdctl-binarycopy:/usr/local/bin/etcdctl {{ bin_dir }}/etcdctl && + {{ docker_bin_dir }}/docker cp etcdctl-binarycopy:/usr/local/bin/etcd {{ bin_dir }}/etcd && + {{ docker_bin_dir }}/docker rm -f etcdctl-binarycopy" + register: etcd_task_result + until: etcd_task_result.rc == 0 + retries: 4 + delay: "{{ retry_stagger | random + 3 }}" + changed_when: false diff --git a/roles/etcd/templates/etcd-host.service.j2 b/roles/etcd/templates/etcd-host.service.j2 index 8a91fab92..6bba8054e 100644 --- a/roles/etcd/templates/etcd-host.service.j2 +++ b/roles/etcd/templates/etcd-host.service.j2 @@ -4,7 +4,7 @@ After=network.target [Service] Type=notify -User=etcd +User=root EnvironmentFile=/etc/etcd.env ExecStart={{ bin_dir }}/etcd NotifyAccess=all diff --git a/tests/files/centos7-flannel-addons.yml b/tests/files/centos7-flannel-addons.yml index 001573494..272c5e7ae 100644 --- a/tests/files/centos7-flannel-addons.yml +++ b/tests/files/centos7-flannel-addons.yml @@ -10,6 +10,7 @@ helm_enabled: true istio_enabled: true efk_enabled: true local_volume_provisioner_enabled: true +etcd_deployment_type: host deploy_netchecker: true kubedns_min_replicas: 1 cloud_provider: gce