1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- ---
- - name: Set hostname and ip facts
- set_fact:
- # Store etcd_hostname and etcd_ip such that they will be available
- # in hostvars. Defaults for these variables are set in etcd_common.
- etcd_hostname: "{{ etcd_hostname }}"
- etcd_ip: "{{ etcd_ip }}"
- - name: Install etcd
- package: name=etcd 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"
- when: etcd_is_containerized | bool
- - name: Install etcd container service file
- template:
- dest: "/etc/systemd/system/etcd_container.service"
- src: etcd.docker.service
- when: etcd_is_containerized | bool
- - name: Ensure etcd datadir exists when containerized
- file:
- path: "{{ etcd_data_dir }}"
- state: directory
- mode: 0700
- when: etcd_is_containerized | bool
- - name: Disable system etcd when containerized
- systemd:
- name: etcd
- state: stopped
- enabled: no
- masked: yes
- daemon_reload: yes
- when: etcd_is_containerized | bool
- register: task_result
- failed_when: "task_result|failed and 'could not' not in task_result.msg|lower"
- - name: Validate permissions on the config dir
- file:
- path: "{{ etcd_conf_dir }}"
- state: directory
- owner: "{{ 'etcd' if not etcd_is_containerized | bool else omit }}"
- group: "{{ 'etcd' if not etcd_is_containerized | bool else omit }}"
- mode: 0700
- - name: Write etcd global config file
- template:
- src: etcd.conf.j2
- dest: /etc/etcd/etcd.conf
- backup: true
- notify:
- - restart etcd
- - name: Enable etcd
- systemd:
- name: "{{ etcd_service }}"
- state: started
- enabled: yes
- register: start_result
- - include: etcdctl.yml
- when: openshift_etcd_etcdctl_profile | default(true) | bool
- - name: Set fact etcd_service_status_changed
- set_fact:
- etcd_service_status_changed: "{{ start_result | changed }}"
|