|
@@ -10,51 +10,45 @@
|
|
|
package: name=etcd{{ '-' + etcd_version if etcd_version is defined else '' }} state=present
|
|
|
when: not etcd_is_containerized | bool
|
|
|
|
|
|
-- name: Pull etcd container
|
|
|
- command: docker pull {{ openshift.etcd.etcd_image }}
|
|
|
- register: pull_result
|
|
|
- changed_when: "'Downloaded newer image' in pull_result.stdout"
|
|
|
+- block:
|
|
|
+ - name: Pull etcd container
|
|
|
+ command: docker pull {{ openshift.etcd.etcd_image }}
|
|
|
+ register: pull_result
|
|
|
+ changed_when: "'Downloaded newer image' in pull_result.stdout"
|
|
|
+
|
|
|
+ - name: Install etcd container service file
|
|
|
+ template:
|
|
|
+ dest: "/etc/systemd/system/etcd_container.service"
|
|
|
+ src: etcd.docker.service
|
|
|
when:
|
|
|
- etcd_is_containerized | bool
|
|
|
- not openshift.common.is_etcd_system_container | bool
|
|
|
|
|
|
-- name: Install etcd container service file
|
|
|
- template:
|
|
|
- dest: "/etc/systemd/system/etcd_container.service"
|
|
|
- src: etcd.docker.service
|
|
|
- when:
|
|
|
- - etcd_is_containerized | bool
|
|
|
- - not openshift.common.is_etcd_system_container | bool
|
|
|
-
|
|
|
-
|
|
|
# Start secondary etcd instance for third party integrations
|
|
|
# TODO: Determine an alternative to using thirdparty variable
|
|
|
-
|
|
|
-- name: Create configuration directory
|
|
|
- file:
|
|
|
- path: "{{ etcd_conf_dir }}"
|
|
|
- state: directory
|
|
|
- mode: 0700
|
|
|
- when: etcd_is_thirdparty | bool
|
|
|
+- block:
|
|
|
+ - name: Create configuration directory
|
|
|
+ file:
|
|
|
+ path: "{{ etcd_conf_dir }}"
|
|
|
+ state: directory
|
|
|
+ mode: 0700
|
|
|
|
|
|
# TODO: retest with symlink to confirm it does or does not function
|
|
|
-- name: Copy service file for etcd instance
|
|
|
- copy:
|
|
|
- src: /usr/lib/systemd/system/etcd.service
|
|
|
- dest: "/etc/systemd/system/{{ etcd_service }}.service"
|
|
|
- remote_src: True
|
|
|
- when: etcd_is_thirdparty | bool
|
|
|
-
|
|
|
-- name: Create third party etcd service.d directory exists
|
|
|
- file:
|
|
|
- path: "{{ etcd_systemd_dir }}"
|
|
|
- state: directory
|
|
|
- when: etcd_is_thirdparty | bool
|
|
|
-
|
|
|
-- name: Configure third part etcd service unit file
|
|
|
- template:
|
|
|
- dest: "{{ etcd_systemd_dir }}/custom.conf"
|
|
|
- src: custom.conf.j2
|
|
|
+ - name: Copy service file for etcd instance
|
|
|
+ copy:
|
|
|
+ src: /usr/lib/systemd/system/etcd.service
|
|
|
+ dest: "/etc/systemd/system/{{ etcd_service }}.service"
|
|
|
+ remote_src: True
|
|
|
+
|
|
|
+ - name: Create third party etcd service.d directory exists
|
|
|
+ file:
|
|
|
+ path: "{{ etcd_systemd_dir }}"
|
|
|
+ state: directory
|
|
|
+
|
|
|
+ - name: Configure third part etcd service unit file
|
|
|
+ template:
|
|
|
+ dest: "{{ etcd_systemd_dir }}/custom.conf"
|
|
|
+ src: custom.conf.j2
|
|
|
when: etcd_is_thirdparty
|
|
|
|
|
|
# TODO: this task may not be needed with Validate permissions
|
|
@@ -80,28 +74,28 @@
|
|
|
command: systemctl daemon-reload
|
|
|
when: etcd_is_thirdparty | bool
|
|
|
|
|
|
-- name: Disable system etcd when containerized
|
|
|
- systemd:
|
|
|
- name: etcd
|
|
|
- state: stopped
|
|
|
- enabled: no
|
|
|
- masked: yes
|
|
|
- daemon_reload: yes
|
|
|
- when:
|
|
|
- - etcd_is_containerized | bool
|
|
|
- - not openshift.common.is_etcd_system_container | bool
|
|
|
- register: task_result
|
|
|
- failed_when: "task_result|failed and 'could not' not in task_result.msg|lower"
|
|
|
-
|
|
|
-- name: Install etcd container service file
|
|
|
- template:
|
|
|
- dest: "/etc/systemd/system/etcd_container.service"
|
|
|
- src: etcd.docker.service
|
|
|
- when: etcd_is_containerized | bool and not openshift.common.is_etcd_system_container | bool
|
|
|
-
|
|
|
-- name: Install Etcd system container
|
|
|
- include: system_container.yml
|
|
|
- when: etcd_is_containerized | bool and openshift.common.is_etcd_system_container | bool
|
|
|
+- block:
|
|
|
+ - name: Disable system etcd when containerized
|
|
|
+ systemd:
|
|
|
+ name: etcd
|
|
|
+ state: stopped
|
|
|
+ enabled: no
|
|
|
+ masked: yes
|
|
|
+ daemon_reload: yes
|
|
|
+ when: not openshift.common.is_etcd_system_container | bool
|
|
|
+ register: task_result
|
|
|
+ failed_when: "task_result|failed and 'could not' not in task_result.msg|lower"
|
|
|
+
|
|
|
+ - name: Install etcd container service file
|
|
|
+ template:
|
|
|
+ dest: "/etc/systemd/system/etcd_container.service"
|
|
|
+ src: etcd.docker.service
|
|
|
+ when: not openshift.common.is_etcd_system_container | bool
|
|
|
+
|
|
|
+ - name: Install Etcd system container
|
|
|
+ include: system_container.yml
|
|
|
+ when: openshift.common.is_etcd_system_container | bool
|
|
|
+ when: etcd_is_containerized | bool
|
|
|
|
|
|
- name: Validate permissions on the config dir
|
|
|
file:
|