Michal Nasiadka 1009931162 Change local_action to delegate_to: localhost
As part of the effort to implement Ansible code linting in CI
(using ansible-lint) - we need to implement recommendations from
ansible-lint output [1].

One of them is to stop using local_action in favor of delegate_to -
to increase readability and and match the style of typical ansible
tasks.

[1]: https://review.opendev.org/694779/

Partially implements: blueprint ansible-lint

Change-Id: I46c259ddad5a6aaf9c7301e6c44cd8a1d5c457d3
2019-11-22 15:04:44 +00:00

54 lines
1.3 KiB
YAML

---
- name: Cleaning up temp file on localhost
file:
path: /tmp/kolla_ceph_cluster
state: absent
delegate_to: localhost
changed_when: False
check_mode: no
run_once: True
- name: Creating temp file on localhost
copy:
content: None
dest: /tmp/kolla_ceph_cluster
mode: 0644
delegate_to: localhost
changed_when: False
check_mode: no
run_once: True
- name: Creating ceph_mon_config volume
become: true
kolla_docker:
action: "create_volume"
common_options: "{{ docker_common_options }}"
name: "ceph_mon_config"
register: ceph_mon_config_volume
- name: Writing hostname of host with existing cluster files to temp file
copy:
content: "{{ inventory_hostname }}"
dest: /tmp/kolla_ceph_cluster
mode: 0644
delegate_to: localhost
changed_when: False
check_mode: no
when: not ceph_mon_config_volume.changed
- name: Registering host from temp file
set_fact:
delegate_host: "{{ lookup('file', '/tmp/kolla_ceph_cluster') }}"
- name: Cleaning up temp file on localhost
file:
path: /tmp/kolla_ceph_cluster
state: absent
delegate_to: localhost
changed_when: False
check_mode: no
run_once: True
- include_tasks: generate_cluster.yml
when: delegate_host == 'None' and inventory_hostname == groups['ceph-mon'][0]