123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- ---
- - fail:
- msg: Interface {{ etcd_interface }} not found
- when: "'ansible_' ~ etcd_interface not in hostvars[inventory_hostname]"
- - fail:
- msg: IPv4 address not found for {{ etcd_interface }}
- when: "'ipv4' not in hostvars[inventory_hostname]['ansible_' ~ etcd_interface] or 'address' not in hostvars[inventory_hostname]['ansible_' ~ etcd_interface].ipv4"
- - name: Install etcd
- yum: pkg=etcd-2.* state=present
- when: ansible_pkg_mgr == "yum"
- - name: Install etcd
- dnf: pkg=etcd* state=present
- when: ansible_pkg_mgr == "dnf"
- - name: Validate permissions on the config dir
- file:
- path: "{{ etcd_conf_dir }}"
- state: directory
- owner: etcd
- group: etcd
- mode: 0700
- - name: Validate permissions on certificate files
- file:
- path: "{{ item }}"
- mode: 0600
- group: etcd
- owner: etcd
- when: etcd_url_scheme == 'https'
- with_items:
- - "{{ etcd_ca_file }}"
- - "{{ etcd_cert_file }}"
- - "{{ etcd_key_file }}"
- - name: Validate permissions on peer certificate files
- file:
- path: "{{ item }}"
- mode: 0600
- group: etcd
- owner: etcd
- when: etcd_peer_url_scheme == 'https'
- with_items:
- - "{{ etcd_peer_ca_file }}"
- - "{{ etcd_peer_cert_file }}"
- - "{{ etcd_peer_key_file }}"
- - name: Write etcd global config file
- template:
- src: etcd.conf.j2
- dest: /etc/etcd/etcd.conf
- backup: true
- notify:
- - restart etcd
- - name: Enable etcd
- service:
- name: etcd
- state: started
- enabled: yes
- register: start_result
- - set_fact:
- etcd_service_status_changed = start_result | changed
|