diff options
author | Jason DeTiberus <detiber@gmail.com> | 2016-11-29 10:39:42 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-29 10:39:42 -0500 |
commit | 4c2a6db2b968abdf7ab641340700856ff179e8e3 (patch) | |
tree | 1e1f99b1a04e7b95f14c20ea3333b74d8cfc4b9d /roles/etcd/tasks | |
parent | 244132714dac209ebebe9141a58da5d2e9f1bb13 (diff) | |
parent | ec9c22ca6a376b7d1139a384dcb78f3f5bb5b607 (diff) | |
download | openshift-4c2a6db2b968abdf7ab641340700856ff179e8e3.tar.gz openshift-4c2a6db2b968abdf7ab641340700856ff179e8e3.tar.bz2 openshift-4c2a6db2b968abdf7ab641340700856ff179e8e3.tar.xz openshift-4c2a6db2b968abdf7ab641340700856ff179e8e3.zip |
Merge pull request #2868 from mtnbikenc/systemd-refactor
Refactored to use Ansible systemd module
Diffstat (limited to 'roles/etcd/tasks')
-rw-r--r-- | roles/etcd/tasks/main.yml | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/roles/etcd/tasks/main.yml b/roles/etcd/tasks/main.yml index 7b61e9b73..41f25be70 100644 --- a/roles/etcd/tasks/main.yml +++ b/roles/etcd/tasks/main.yml @@ -20,36 +20,25 @@ template: dest: "/etc/systemd/system/etcd_container.service" src: etcd.docker.service - register: install_etcd_result when: etcd_is_containerized | bool -- name: Ensure etcd datadir exists - when: etcd_is_containerized | bool +- name: Ensure etcd datadir exists when containerized file: path: "{{ etcd_data_dir }}" state: directory mode: 0700 - -- name: Check for etcd service presence - command: systemctl show etcd.service - register: etcd_show - changed_when: false - failed_when: false + when: etcd_is_containerized | bool - name: Disable system etcd when containerized - when: etcd_is_containerized | bool and etcd_show.rc == 0 and 'LoadState=not-found' not in etcd_show.stdout - service: + systemd: name: etcd state: stopped enabled: no - -- name: Mask system etcd when containerized - when: etcd_is_containerized | bool and etcd_show.rc == 0 and 'LoadState=not-found' not in etcd_show.stdout - command: systemctl mask etcd - -- name: Reload systemd units - command: systemctl daemon-reload - when: etcd_is_containerized | bool and ( install_etcd_result | changed ) + 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: @@ -68,7 +57,7 @@ - restart etcd - name: Enable etcd - service: + systemd: name: "{{ etcd_service }}" state: started enabled: yes @@ -77,5 +66,6 @@ - include: etcdctl.yml when: openshift_etcd_etcdctl_profile | default(true) | bool -- set_fact: +- name: Set fact etcd_service_status_changed + set_fact: etcd_service_status_changed: "{{ start_result | changed }}" |