Use delegate_to: localhost instead.
Signed-off-by: Sébastien Han <seb@redhat.com>
- test_initial_monitor_keyring.rc != 0
- name: write initial mon keyring in {{ fetch_directory }}/monitor_keyring.conf if it doesn't exist
- local_action:
- module: shell
- echo {{ monitor_keyring.stdout }} | tee {{ fetch_directory }}/monitor_keyring.conf
+ shell: "echo {{ monitor_keyring.stdout }} | tee {{ fetch_directory }}/monitor_keyring.conf"
+ delegate_to: localhost
become: false
when:
- test_initial_monitor_keyring.rc == 0
- name: "ensure fetch directory exists"
run_once: true
become: false
- local_action:
- module: file
+ file:
path: "{{ fetch_directory }}/{{ fsid }}/etc/ceph"
state: directory
mode: "0755"
+ delegate_to: localhost
when:
- ceph_conf_local
- name: "generate {{ cluster }}.conf configuration file locally"
- local_action: config_template
+ config_template:
become: false
run_once: true
+ delegate_to: localhost
args:
src: "ceph.conf.j2"
dest: "{{ fetch_directory }}/{{ fsid }}/etc/ceph/{{ cluster }}.conf"
# we are not population kv_store with default ceph.conf AND there at least 1 nfs in nfs group AND host is the first nfs
- block:
- name: create a local fetch directory if it does not exist
- local_action:
- module: file
+ file:
path: "{{ fetch_directory }}"
state: directory
+ delegate_to: localhost
changed_when: false
become: false
run_once: true
and (inventory_hostname == groups.get(nfs_group_name, [])[0])))
- name: generate cluster uuid
- local_action:
- module: shell
- python -c 'import uuid; print(str(uuid.uuid4()))' | tee {{ fetch_directory }}/ceph_cluster_uuid.conf
+ shell: python -c 'import uuid; print(str(uuid.uuid4()))' | tee {{ fetch_directory }}/ceph_cluster_uuid.conf
+ args:
creates: "{{ fetch_directory }}/ceph_cluster_uuid.conf"
+ delegate_to: localhost
register: cluster_uuid
become: false
when:
- generate_fsid
- name: read cluster uuid if it already exists
- local_action:
- module: command
- cat {{ fetch_directory }}/ceph_cluster_uuid.conf
+ command: "cat {{ fetch_directory }}/ceph_cluster_uuid.conf"
+ args:
removes: "{{ fetch_directory }}/ceph_cluster_uuid.conf"
+ delegate_to: localhost
changed_when: false
register: cluster_uuid
check_mode: no
# We want this check to be run only on the first node
- name: check if {{ fetch_directory }} directory exists
- local_action:
- module: stat
+ stat:
path: "{{ fetch_directory }}/monitor_keyring.conf"
+ delegate_to: localhost
become: false
register: monitor_keyring_conf
run_once: true
- rolling_update or groups.get(mon_group_name, []) | length == 0
- name: create a local fetch directory if it does not exist
- local_action:
- module: file
+ file:
path: "{{ fetch_directory }}"
state: directory
+ delegate_to: localhost
changed_when: false
become: false
when:
ceph_release: "{{ ceph_stable_release }}"
- name: generate cluster fsid
- local_action:
- module: shell
- python -c 'import uuid; print(str(uuid.uuid4()))' | tee {{ fetch_directory }}/ceph_cluster_uuid.conf
+ shell: python -c 'import uuid; print(str(uuid.uuid4()))' | tee {{ fetch_directory }}/ceph_cluster_uuid.conf
+ args:
creates: "{{ fetch_directory }}/ceph_cluster_uuid.conf"
register: cluster_uuid
+ delegate_to: localhost
become: false
when:
- generate_fsid
- ceph_current_status.fsid is undefined
- name: reuse cluster fsid when cluster is already running
- local_action:
- module: shell
- echo {{ fsid }} | tee {{ fetch_directory }}/ceph_cluster_uuid.conf
+ shell: echo {{ fsid }} | tee {{ fetch_directory }}/ceph_cluster_uuid.conf
+ args:
creates: "{{ fetch_directory }}/ceph_cluster_uuid.conf"
+ delegate_to: localhost
become: false
when:
- ceph_current_status.fsid is defined
- name: read cluster fsid if it already exists
- local_action:
- module: command
- cat {{ fetch_directory }}/ceph_cluster_uuid.conf
+ command: cat {{ fetch_directory }}/ceph_cluster_uuid.conf
+ args:
removes: "{{ fetch_directory }}/ceph_cluster_uuid.conf"
+ delegate_to: localhost
changed_when: false
register: cluster_uuid
become: false
- ceph_nfs_image_repodigest_before_pulling != image_repodigest_after_pulling
- name: export local ceph dev image
- local_action:
- module: command
- docker save -o "/tmp/{{ ceph_docker_username }}-{{ ceph_docker_imagename }}-{{ ceph_docker_image_tag }}.tar" "{{ ceph_docker_username }}/{{ ceph_docker_imagename }}:{{ ceph_docker_image_tag }}"
+ command: >
+ docker save -o "/tmp/{{ ceph_docker_username }}-{{ ceph_docker_imagename }}-{{ ceph_docker_image_tag }}.tar"
+ "{{ ceph_docker_username }}/{{ ceph_docker_imagename }}:{{ ceph_docker_image_tag }}"
+ delegate_to: localhost
when:
- (ceph_docker_dev_image is defined and ceph_docker_dev_image)
run_once: true
when: groups.get(mgr_group_name, []) | length > 0
- name: stat for ceph config and keys
- local_action:
- module: stat
+ stat:
path: "{{ fetch_directory }}/{{ fsid }}/{{ item }}"
+ delegate_to: localhost
with_items: "{{ ceph_config_keys }}"
changed_when: false
become: false
- "iscsi-gateway-pub.key"
- name: stat for crt file(s)
- local_action:
- module: stat
+ stat:
path: "{{ fetch_directory }}/{{ fsid }}/{{ item }}"
+ delegate_to: localhost
with_items: "{{ crt_files }}"
changed_when: false
failed_when: false
register: crt_files_exist
- name: create ssl crt/key files
- local_action:
- module: command openssl req -newkey rsa:2048 -nodes -keyout {{ fetch_directory }}/{{ fsid }}/iscsi-gateway.key -x509 -days 365 -out {{ fetch_directory }}/{{ fsid }}/iscsi-gateway.crt -subj "/C=US/ST=./L=./O=RedHat/OU=Linux/CN={{ ansible_hostname }}"
+ command: >
+ openssl req -newkey rsa:2048 -nodes -keyout {{ fetch_directory }}/{{ fsid }}/iscsi-gateway.key
+ -x509 -days 365 -out {{ fetch_directory }}/{{ fsid }}/iscsi-gateway.crt
+ -subj "/C=US/ST=./L=./O=RedHat/OU=Linux/CN={{ ansible_hostname }}"
+ delegate_to: localhost
run_once: True
with_items: "{{ crt_files_exist.results }}"
when:
- item.stat.exists == false
- name: create pem
- local_action:
- module: shell cat {{ fetch_directory }}/{{ fsid }}/iscsi-gateway.crt {{ fetch_directory }}/{{ fsid }}/iscsi-gateway.key > {{ fetch_directory }}/{{ fsid }}/iscsi-gateway.pem
+ shell: >
+ cat {{ fetch_directory }}/{{ fsid }}/iscsi-gateway.crt
+ {{ fetch_directory }}/{{ fsid }}/iscsi-gateway.key > {{ fetch_directory }}/{{ fsid }}/iscsi-gateway.pem
+ delegate_to: localhost
run_once: True
register: pem
with_items: "{{ crt_files_exist.results }}"
- item.stat.exists == false
- name: create public key from pem
- local_action:
- module: shell openssl x509 -inform pem -in {{ fetch_directory }}/{{ fsid }}/iscsi-gateway.pem -pubkey -noout > {{ fetch_directory }}/{{ fsid }}/iscsi-gateway-pub.key
+ shell: >
+ openssl x509 -inform pem -in {{ fetch_directory }}/{{ fsid }}/iscsi-gateway.pem
+ -pubkey -noout > {{ fetch_directory }}/{{ fsid }}/iscsi-gateway-pub.key
+ delegate_to: localhost
run_once: True
when:
- pem.changed
- copy_admin_key
- name: stat for ceph config and keys
- local_action:
- module: stat
+ stat:
path: "{{ fetch_directory }}/{{ fsid }}/{{ item }}"
+ delegate_to: localhost
with_items: "{{ ceph_config_keys }}"
changed_when: false
become: false
---
- name: generate monitor initial keyring
- local_action:
- module: shell
- python -c "import os ; import struct ; import time; import base64 ; key = os.urandom(16) ; header = struct.pack('<hiih',1,int(time.time()),0,len(key)) ; print(base64.b64encode(header + key).decode())" | tee {{ fetch_directory }}/monitor_keyring.conf
+ shell: >
+ python -c "import os ; import struct ;
+ import time; import base64 ; key = os.urandom(16) ;
+ header = struct.pack('<hiih',1,int(time.time()),0,len(key)) ;
+ print(base64.b64encode(header + key).decode())" | tee {{ fetch_directory }}/monitor_keyring.conf
+ args:
creates: "{{ fetch_directory }}/monitor_keyring.conf"
+ delegate_to: localhost
register: monitor_keyring
become: false
when: cephx
- name: read monitor initial keyring if it already exists
- local_action:
- module: command
- cat {{ fetch_directory }}/monitor_keyring.conf
+ command: "cat {{ fetch_directory }}/monitor_keyring.conf"
+ args:
removes: "{{ fetch_directory }}/monitor_keyring.conf"
+ delegate_to: localhost
changed_when: false
register: monitor_keyring
become: false
- /var/lib/ceph/bootstrap-rbd/{{ cluster }}.keyring
- name: stat for ceph config and keys
- local_action:
- module: stat
+ stat:
path: "{{ fetch_directory }}/{{ fsid }}/{{ item }}"
+ delegate_to: localhost
with_items: "{{ ceph_config_keys }}"
changed_when: false
become: false
- copy_admin_key
- name: stat for config and keys
- local_action:
- module: stat
+ stat:
path: "{{ fetch_directory }}/{{ fsid }}/{{ item }}"
+ delegate_to: localhost
with_items: "{{ ceph_config_keys }}"
changed_when: false
become: false
- copy_admin_key
- name: wait for ceph.conf and keys
- local_action:
- module: wait_for
+ wait_for:
path: "{{ fetch_directory }}/{{ fsid }}/{{ item }}"
+ delegate_to: localhost
become: false
with_items: "{{ ceph_config_keys }}"
- name: stat for ceph config and keys
- local_action:
- module: stat
+ stat:
path: "{{ fetch_directory }}/{{ fsid }}/{{ item }}"
+ delegate_to: localhost
with_items: "{{ ceph_config_keys }}"
changed_when: false
become: false
- /var/lib/ceph/bootstrap-rbd/{{ cluster }}.keyring
- name: stat for ceph config and keys
- local_action:
- module: stat
+ stat:
path: "{{ fetch_directory }}/{{ fsid }}/{{ item }}"
+ delegate_to: localhost
with_items: "{{ ceph_config_keys }}"
changed_when: false
become: false