2016-04-27 21:17:56 +08:00
|
|
|
---
|
2018-03-21 03:13:28 +08:00
|
|
|
- name: check if it is atomic host
|
|
|
|
stat:
|
|
|
|
path: /run/ostree-booted
|
|
|
|
register: stat_ostree
|
|
|
|
|
|
|
|
- name: set_fact is_atomic
|
|
|
|
set_fact:
|
|
|
|
is_atomic: "{{ stat_ostree.stat.exists }}"
|
|
|
|
|
2017-09-15 06:48:53 +08:00
|
|
|
- name: set_fact monitor_name ansible_hostname
|
|
|
|
set_fact:
|
2017-07-29 05:02:51 +08:00
|
|
|
monitor_name: "{{ ansible_hostname }}"
|
2017-09-15 06:48:53 +08:00
|
|
|
when:
|
|
|
|
- not mon_use_fqdn
|
2017-07-29 05:02:51 +08:00
|
|
|
|
2017-09-15 06:48:53 +08:00
|
|
|
- name: set_fact monitor_name ansible_fqdn
|
|
|
|
set_fact:
|
2017-07-29 05:02:51 +08:00
|
|
|
monitor_name: "{{ ansible_fqdn }}"
|
2017-09-15 06:48:53 +08:00
|
|
|
when:
|
|
|
|
- mon_use_fqdn
|
2016-04-27 21:17:56 +08:00
|
|
|
|
containers: fix bug when looking for existing cluster
When containerized deployment, `docker_exec_cmd` is not set before the
task which try to retrieve the current fsid is played, it means it
considers there is no existing fsid and try to generate a new one.
Typical error:
```
ok: [mon0 -> mon0] => {
"changed": false,
"cmd": [
"ceph",
"--connect-timeout",
"3",
"--cluster",
"test",
"fsid"
],
"delta": "0:00:00.179909",
"end": "2018-01-09 10:36:58.759846",
"failed": false,
"failed_when_result": false,
"rc": 1,
"start": "2018-01-09 10:36:58.579937"
}
STDERR:
Error initializing cluster client: Error('error calling conf_read_file: errno EINVAL',)
```
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2018-01-10 17:18:27 +08:00
|
|
|
- name: set_fact docker_exec_cmd
|
|
|
|
set_fact:
|
|
|
|
docker_exec_cmd: "docker exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }}"
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
when:
|
|
|
|
- containerized_deployment
|
2018-04-04 21:30:55 +08:00
|
|
|
- groups.get(mon_group_name, []) | length > 0
|
containers: fix bug when looking for existing cluster
When containerized deployment, `docker_exec_cmd` is not set before the
task which try to retrieve the current fsid is played, it means it
considers there is no existing fsid and try to generate a new one.
Typical error:
```
ok: [mon0 -> mon0] => {
"changed": false,
"cmd": [
"ceph",
"--connect-timeout",
"3",
"--cluster",
"test",
"fsid"
],
"delta": "0:00:00.179909",
"end": "2018-01-09 10:36:58.759846",
"failed": false,
"failed_when_result": false,
"rc": 1,
"start": "2018-01-09 10:36:58.579937"
}
STDERR:
Error initializing cluster client: Error('error calling conf_read_file: errno EINVAL',)
```
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2018-01-10 17:18:27 +08:00
|
|
|
|
2017-02-18 04:29:45 +08:00
|
|
|
# this task shouldn't run in a rolling_update situation
|
|
|
|
# because it blindly picks a mon, which may be down because
|
|
|
|
# of the rolling update
|
2016-12-06 22:59:49 +08:00
|
|
|
- name: is ceph running already?
|
2018-01-25 01:49:41 +08:00
|
|
|
command: "timeout 5 {{ docker_exec_cmd }} ceph --cluster {{ cluster }} fsid"
|
2016-12-06 22:59:49 +08:00
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
2017-10-25 22:53:34 +08:00
|
|
|
check_mode: no
|
2016-12-06 22:59:49 +08:00
|
|
|
register: ceph_current_fsid
|
2018-04-10 00:07:31 +08:00
|
|
|
run_once: true
|
2016-12-09 03:16:02 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
2017-08-04 22:57:46 +08:00
|
|
|
when:
|
|
|
|
- not rolling_update
|
|
|
|
- groups.get(mon_group_name, []) | length > 0
|
2017-02-18 04:29:45 +08:00
|
|
|
|
2017-07-29 05:02:51 +08:00
|
|
|
# We want this check to be run only on the first node
|
|
|
|
- name: check if {{ fetch_directory }} directory exists
|
syntax: change local_action syntax
Use a nicer syntax for `local_action` tasks.
We used to have oneliner like this:
```
local_action: wait_for port=22 host={{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }} state=started delay=10 timeout=500 }}
```
The usual syntax:
```
local_action:
module: wait_for
port: 22
host: "{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}"
state: started
delay: 10
timeout: 500
```
is nicer and kind of way to keep consistency regarding the whole
playbook.
This also fix a potential issue about missing quotation :
```
Traceback (most recent call last):
File "/tmp/ansible_wQtWsi/ansible_module_command.py", line 213, in <module>
main()
File "/tmp/ansible_wQtWsi/ansible_module_command.py", line 185, in main
rc, out, err = module.run_command(args, executable=executable, use_unsafe_shell=shell, encoding=None, data=stdin)
File "/tmp/ansible_wQtWsi/ansible_modlib.zip/ansible/module_utils/basic.py", line 2710, in run_command
File "/usr/lib64/python2.7/shlex.py", line 279, in split
return list(lex) File "/usr/lib64/python2.7/shlex.py", line 269, in next
token = self.get_token()
File "/usr/lib64/python2.7/shlex.py", line 96, in get_token
raw = self.read_token()
File "/usr/lib64/python2.7/shlex.py", line 172, in read_token
raise ValueError, "No closing quotation"
ValueError: No closing quotation
```
writing `local_action: shell echo {{ fsid }} | tee {{ fetch_directory }}/ceph_cluster_uuid.conf`
can cause trouble because it's complaining with missing quotes, this fix solves this issue.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1510555
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2018-01-31 16:23:28 +08:00
|
|
|
local_action:
|
|
|
|
module: stat
|
|
|
|
path: "{{ fetch_directory }}/monitor_keyring.conf"
|
2017-07-29 05:02:51 +08:00
|
|
|
become: false
|
|
|
|
register: monitor_keyring_conf
|
|
|
|
run_once: true
|
|
|
|
|
2017-02-18 04:29:45 +08:00
|
|
|
# set this as a default when performing a rolling_update
|
|
|
|
# so the rest of the tasks here will succeed
|
2017-09-15 06:48:53 +08:00
|
|
|
- name: set_fact ceph_current_fsid rc 1
|
|
|
|
set_fact:
|
2017-02-18 04:29:45 +08:00
|
|
|
ceph_current_fsid:
|
|
|
|
rc: 1
|
2017-08-04 22:57:46 +08:00
|
|
|
when:
|
|
|
|
- rolling_update or groups.get(mon_group_name, []) | length == 0
|
2016-12-06 22:59:49 +08:00
|
|
|
|
2016-12-08 23:58:22 +08:00
|
|
|
- name: create a local fetch directory if it does not exist
|
syntax: change local_action syntax
Use a nicer syntax for `local_action` tasks.
We used to have oneliner like this:
```
local_action: wait_for port=22 host={{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }} state=started delay=10 timeout=500 }}
```
The usual syntax:
```
local_action:
module: wait_for
port: 22
host: "{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}"
state: started
delay: 10
timeout: 500
```
is nicer and kind of way to keep consistency regarding the whole
playbook.
This also fix a potential issue about missing quotation :
```
Traceback (most recent call last):
File "/tmp/ansible_wQtWsi/ansible_module_command.py", line 213, in <module>
main()
File "/tmp/ansible_wQtWsi/ansible_module_command.py", line 185, in main
rc, out, err = module.run_command(args, executable=executable, use_unsafe_shell=shell, encoding=None, data=stdin)
File "/tmp/ansible_wQtWsi/ansible_modlib.zip/ansible/module_utils/basic.py", line 2710, in run_command
File "/usr/lib64/python2.7/shlex.py", line 279, in split
return list(lex) File "/usr/lib64/python2.7/shlex.py", line 269, in next
token = self.get_token()
File "/usr/lib64/python2.7/shlex.py", line 96, in get_token
raw = self.read_token()
File "/usr/lib64/python2.7/shlex.py", line 172, in read_token
raise ValueError, "No closing quotation"
ValueError: No closing quotation
```
writing `local_action: shell echo {{ fsid }} | tee {{ fetch_directory }}/ceph_cluster_uuid.conf`
can cause trouble because it's complaining with missing quotes, this fix solves this issue.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1510555
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2018-01-31 16:23:28 +08:00
|
|
|
local_action:
|
|
|
|
module: file
|
|
|
|
path: "{{ fetch_directory }}"
|
|
|
|
state: directory
|
2016-12-08 23:58:22 +08:00
|
|
|
changed_when: false
|
|
|
|
become: false
|
2017-09-15 06:48:53 +08:00
|
|
|
when:
|
|
|
|
- (cephx or generate_fsid)
|
2016-12-08 23:58:22 +08:00
|
|
|
|
2017-09-15 06:48:53 +08:00
|
|
|
- name: set_fact fsid ceph_current_fsid.stdout
|
|
|
|
set_fact:
|
2016-12-06 22:59:49 +08:00
|
|
|
fsid: "{{ ceph_current_fsid.stdout }}"
|
2017-02-18 04:29:45 +08:00
|
|
|
when:
|
2018-04-10 00:07:31 +08:00
|
|
|
- ceph_current_fsid.get('rc', 1) == 0
|
2016-12-06 22:59:49 +08:00
|
|
|
|
2017-07-29 05:02:51 +08:00
|
|
|
# Set ceph_release to ceph_stable by default
|
2017-09-15 06:48:53 +08:00
|
|
|
- name: set_fact ceph_release ceph_stable_release
|
|
|
|
set_fact:
|
2017-07-29 05:02:51 +08:00
|
|
|
ceph_release: "{{ ceph_stable_release }}"
|
2016-12-08 23:58:22 +08:00
|
|
|
|
2017-07-29 05:02:51 +08:00
|
|
|
- name: generate cluster fsid
|
syntax: change local_action syntax
Use a nicer syntax for `local_action` tasks.
We used to have oneliner like this:
```
local_action: wait_for port=22 host={{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }} state=started delay=10 timeout=500 }}
```
The usual syntax:
```
local_action:
module: wait_for
port: 22
host: "{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}"
state: started
delay: 10
timeout: 500
```
is nicer and kind of way to keep consistency regarding the whole
playbook.
This also fix a potential issue about missing quotation :
```
Traceback (most recent call last):
File "/tmp/ansible_wQtWsi/ansible_module_command.py", line 213, in <module>
main()
File "/tmp/ansible_wQtWsi/ansible_module_command.py", line 185, in main
rc, out, err = module.run_command(args, executable=executable, use_unsafe_shell=shell, encoding=None, data=stdin)
File "/tmp/ansible_wQtWsi/ansible_modlib.zip/ansible/module_utils/basic.py", line 2710, in run_command
File "/usr/lib64/python2.7/shlex.py", line 279, in split
return list(lex) File "/usr/lib64/python2.7/shlex.py", line 269, in next
token = self.get_token()
File "/usr/lib64/python2.7/shlex.py", line 96, in get_token
raw = self.read_token()
File "/usr/lib64/python2.7/shlex.py", line 172, in read_token
raise ValueError, "No closing quotation"
ValueError: No closing quotation
```
writing `local_action: shell echo {{ fsid }} | tee {{ fetch_directory }}/ceph_cluster_uuid.conf`
can cause trouble because it's complaining with missing quotes, this fix solves this issue.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1510555
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2018-01-31 16:23:28 +08:00
|
|
|
local_action:
|
|
|
|
module: shell
|
|
|
|
python -c 'import uuid; print(str(uuid.uuid4()))' | tee {{ fetch_directory }}/ceph_cluster_uuid.conf
|
|
|
|
creates: "{{ fetch_directory }}/ceph_cluster_uuid.conf"
|
2017-07-29 05:02:51 +08:00
|
|
|
register: cluster_uuid
|
|
|
|
become: false
|
|
|
|
when:
|
|
|
|
- generate_fsid
|
|
|
|
- ceph_current_fsid.rc != 0
|
2016-12-08 23:58:22 +08:00
|
|
|
|
2017-07-29 05:02:51 +08:00
|
|
|
- name: reuse cluster fsid when cluster is already running
|
syntax: change local_action syntax
Use a nicer syntax for `local_action` tasks.
We used to have oneliner like this:
```
local_action: wait_for port=22 host={{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }} state=started delay=10 timeout=500 }}
```
The usual syntax:
```
local_action:
module: wait_for
port: 22
host: "{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}"
state: started
delay: 10
timeout: 500
```
is nicer and kind of way to keep consistency regarding the whole
playbook.
This also fix a potential issue about missing quotation :
```
Traceback (most recent call last):
File "/tmp/ansible_wQtWsi/ansible_module_command.py", line 213, in <module>
main()
File "/tmp/ansible_wQtWsi/ansible_module_command.py", line 185, in main
rc, out, err = module.run_command(args, executable=executable, use_unsafe_shell=shell, encoding=None, data=stdin)
File "/tmp/ansible_wQtWsi/ansible_modlib.zip/ansible/module_utils/basic.py", line 2710, in run_command
File "/usr/lib64/python2.7/shlex.py", line 279, in split
return list(lex) File "/usr/lib64/python2.7/shlex.py", line 269, in next
token = self.get_token()
File "/usr/lib64/python2.7/shlex.py", line 96, in get_token
raw = self.read_token()
File "/usr/lib64/python2.7/shlex.py", line 172, in read_token
raise ValueError, "No closing quotation"
ValueError: No closing quotation
```
writing `local_action: shell echo {{ fsid }} | tee {{ fetch_directory }}/ceph_cluster_uuid.conf`
can cause trouble because it's complaining with missing quotes, this fix solves this issue.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1510555
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2018-01-31 16:23:28 +08:00
|
|
|
local_action:
|
|
|
|
module: shell
|
|
|
|
echo {{ fsid }} | tee {{ fetch_directory }}/ceph_cluster_uuid.conf
|
|
|
|
creates: "{{ fetch_directory }}/ceph_cluster_uuid.conf"
|
2016-12-16 18:36:42 +08:00
|
|
|
become: false
|
2017-09-15 06:48:53 +08:00
|
|
|
when:
|
2018-04-10 00:07:31 +08:00
|
|
|
- ceph_current_fsid.get('rc', 1) == 0
|
2016-12-08 23:58:22 +08:00
|
|
|
|
2017-07-29 05:02:51 +08:00
|
|
|
- name: read cluster fsid if it already exists
|
syntax: change local_action syntax
Use a nicer syntax for `local_action` tasks.
We used to have oneliner like this:
```
local_action: wait_for port=22 host={{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }} state=started delay=10 timeout=500 }}
```
The usual syntax:
```
local_action:
module: wait_for
port: 22
host: "{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}"
state: started
delay: 10
timeout: 500
```
is nicer and kind of way to keep consistency regarding the whole
playbook.
This also fix a potential issue about missing quotation :
```
Traceback (most recent call last):
File "/tmp/ansible_wQtWsi/ansible_module_command.py", line 213, in <module>
main()
File "/tmp/ansible_wQtWsi/ansible_module_command.py", line 185, in main
rc, out, err = module.run_command(args, executable=executable, use_unsafe_shell=shell, encoding=None, data=stdin)
File "/tmp/ansible_wQtWsi/ansible_modlib.zip/ansible/module_utils/basic.py", line 2710, in run_command
File "/usr/lib64/python2.7/shlex.py", line 279, in split
return list(lex) File "/usr/lib64/python2.7/shlex.py", line 269, in next
token = self.get_token()
File "/usr/lib64/python2.7/shlex.py", line 96, in get_token
raw = self.read_token()
File "/usr/lib64/python2.7/shlex.py", line 172, in read_token
raise ValueError, "No closing quotation"
ValueError: No closing quotation
```
writing `local_action: shell echo {{ fsid }} | tee {{ fetch_directory }}/ceph_cluster_uuid.conf`
can cause trouble because it's complaining with missing quotes, this fix solves this issue.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1510555
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2018-01-31 16:23:28 +08:00
|
|
|
local_action:
|
|
|
|
module: command
|
|
|
|
cat {{ fetch_directory }}/ceph_cluster_uuid.conf
|
|
|
|
removes: "{{ fetch_directory }}/ceph_cluster_uuid.conf"
|
2017-07-29 05:02:51 +08:00
|
|
|
changed_when: false
|
|
|
|
register: cluster_uuid
|
|
|
|
become: false
|
2017-10-25 22:53:34 +08:00
|
|
|
check_mode: no
|
2017-09-15 06:48:53 +08:00
|
|
|
when:
|
|
|
|
- generate_fsid
|
2016-12-08 23:58:22 +08:00
|
|
|
|
2017-09-15 06:48:53 +08:00
|
|
|
- name: set_fact fsid
|
2017-07-29 05:02:51 +08:00
|
|
|
set_fact:
|
|
|
|
fsid: "{{ cluster_uuid.stdout }}"
|
2017-09-15 06:48:53 +08:00
|
|
|
when:
|
|
|
|
- generate_fsid
|
2017-07-29 05:02:51 +08:00
|
|
|
|
2017-09-15 06:48:53 +08:00
|
|
|
- name: set_fact mds_name ansible_hostname
|
|
|
|
set_fact:
|
2016-05-09 06:36:15 +08:00
|
|
|
mds_name: "{{ ansible_hostname }}"
|
2017-09-15 06:48:53 +08:00
|
|
|
when:
|
|
|
|
- not mds_use_fqdn
|
2016-05-09 06:36:15 +08:00
|
|
|
|
2017-09-15 06:48:53 +08:00
|
|
|
- name: set_fact mds_name ansible_fqdn
|
|
|
|
set_fact:
|
2016-05-09 06:36:15 +08:00
|
|
|
mds_name: "{{ ansible_fqdn }}"
|
2017-09-15 06:48:53 +08:00
|
|
|
when:
|
|
|
|
- mds_use_fqdn
|
2016-12-09 21:51:35 +08:00
|
|
|
|
2017-09-15 06:48:53 +08:00
|
|
|
- name: set_fact rbd_client_directory_owner ceph
|
|
|
|
set_fact:
|
2016-12-09 21:51:35 +08:00
|
|
|
rbd_client_directory_owner: ceph
|
|
|
|
when:
|
|
|
|
- rbd_client_directory_owner is not defined
|
|
|
|
or not rbd_client_directory_owner
|
|
|
|
|
2017-09-15 06:48:53 +08:00
|
|
|
- name: set_fact rbd_client_directory_group rbd_client_directory_group
|
|
|
|
set_fact:
|
2016-12-09 21:51:35 +08:00
|
|
|
rbd_client_directory_group: ceph
|
|
|
|
when:
|
|
|
|
- rbd_client_directory_group is not defined
|
|
|
|
or not rbd_client_directory_group
|
|
|
|
|
2017-09-15 06:48:53 +08:00
|
|
|
- name: set_fact rbd_client_directory_mode 0770
|
|
|
|
set_fact:
|
2016-12-09 21:51:35 +08:00
|
|
|
rbd_client_directory_mode: "0770"
|
|
|
|
when:
|
|
|
|
- rbd_client_directory_mode is not defined
|
|
|
|
or not rbd_client_directory_mode
|
2017-09-28 06:17:12 +08:00
|
|
|
|
|
|
|
- name: resolve device link(s)
|
|
|
|
command: readlink -f {{ item }}
|
|
|
|
changed_when: false
|
|
|
|
with_items: "{{ devices }}"
|
|
|
|
register: devices_prepare_canonicalize
|
|
|
|
when:
|
2018-05-02 00:22:31 +08:00
|
|
|
- devices is defined
|
2017-09-28 06:17:12 +08:00
|
|
|
- inventory_hostname in groups.get(osd_group_name, [])
|
2017-10-05 22:22:04 +08:00
|
|
|
- not osd_auto_discovery|default(False)
|
2018-02-08 21:51:15 +08:00
|
|
|
- osd_scenario|default('dummy') != 'lvm'
|
2017-09-28 06:17:12 +08:00
|
|
|
|
|
|
|
- name: set_fact build devices from resolved symlinks
|
|
|
|
set_fact:
|
|
|
|
devices: "{{ devices | default([]) + [ item.stdout ] }}"
|
|
|
|
with_items: "{{ devices_prepare_canonicalize.results }}"
|
|
|
|
when:
|
2018-05-02 00:22:31 +08:00
|
|
|
- devices is defined
|
2017-09-28 06:17:12 +08:00
|
|
|
- inventory_hostname in groups.get(osd_group_name, [])
|
2017-10-05 22:22:04 +08:00
|
|
|
- not osd_auto_discovery|default(False)
|
2018-02-08 21:51:15 +08:00
|
|
|
- osd_scenario|default('dummy') != 'lvm'
|
2017-09-28 06:17:12 +08:00
|
|
|
|
|
|
|
- name: set_fact build final devices list
|
|
|
|
set_fact:
|
|
|
|
devices: "{{ devices | reject('search','/dev/disk') | list | unique }}"
|
|
|
|
when:
|
2018-05-02 00:22:31 +08:00
|
|
|
- devices is defined
|
2017-09-28 06:17:12 +08:00
|
|
|
- inventory_hostname in groups.get(osd_group_name, [])
|
2017-10-05 22:22:04 +08:00
|
|
|
- not osd_auto_discovery|default(False)
|
2018-02-08 21:51:15 +08:00
|
|
|
- osd_scenario|default('dummy') != 'lvm'
|
2017-11-23 05:38:30 +08:00
|
|
|
|
2018-04-14 01:42:17 +08:00
|
|
|
- name: set_fact ceph_uid for debian based system - non container
|
|
|
|
set_fact:
|
|
|
|
ceph_uid: 64045
|
|
|
|
when:
|
|
|
|
- not containerized_deployment
|
|
|
|
- ansible_os_family == 'Debian'
|
|
|
|
|
2018-08-13 20:05:05 +08:00
|
|
|
- name: set_fact ceph_uid for red hat or suse based system - non container
|
2018-04-14 01:42:17 +08:00
|
|
|
set_fact:
|
|
|
|
ceph_uid: 167
|
|
|
|
when:
|
|
|
|
- not containerized_deployment
|
2018-08-13 20:05:05 +08:00
|
|
|
- ansible_os_family in ['RedHat', 'Suse']
|
2018-04-14 01:42:17 +08:00
|
|
|
|
|
|
|
- name: set_fact ceph_uid for debian based system - container
|
2017-11-23 05:38:30 +08:00
|
|
|
set_fact:
|
|
|
|
ceph_uid: 64045
|
|
|
|
when:
|
|
|
|
- containerized_deployment
|
2018-04-09 16:01:30 +08:00
|
|
|
- ceph_docker_image_tag | search("ubuntu")
|
2017-11-23 05:38:30 +08:00
|
|
|
|
2018-04-14 01:42:17 +08:00
|
|
|
- name: set_fact ceph_uid for red hat based system - container
|
2017-11-23 05:38:30 +08:00
|
|
|
set_fact:
|
|
|
|
ceph_uid: 167
|
|
|
|
when:
|
|
|
|
- containerized_deployment
|
2018-03-29 12:17:02 +08:00
|
|
|
- ceph_docker_image_tag | search("latest") or ceph_docker_image_tag | search("centos") or ceph_docker_image_tag | search("fedora")
|
|
|
|
|
2018-04-17 21:32:53 +08:00
|
|
|
- name: set_fact ceph_uid for red hat
|
2018-03-29 12:17:02 +08:00
|
|
|
set_fact:
|
|
|
|
ceph_uid: 167
|
|
|
|
when:
|
|
|
|
- containerized_deployment
|
|
|
|
- ceph_docker_image | search("rhceph")
|
2018-08-09 17:03:32 +08:00
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: get current cluster status (if already running)
|
|
|
|
command: "{{ docker_exec_cmd }} ceph --cluster {{ cluster }} -s -f json"
|
2018-08-14 14:52:04 +08:00
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
|
|
|
check_mode: no
|
|
|
|
run_once: true
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
when:
|
|
|
|
- not rolling_update
|
|
|
|
- groups.get(mon_group_name, []) | length > 0
|
2018-08-09 17:03:32 +08:00
|
|
|
register: ceph_current_status
|
|
|
|
|
|
|
|
- name: set_fact ceph_current_status (convert to json)
|
|
|
|
set_fact:
|
|
|
|
ceph_current_status: "{{ ceph_current_status.stdout | from_json }}"
|
|
|
|
|
|
|
|
- name: set_fact rgw_hostname
|
|
|
|
set_fact:
|
|
|
|
rgw_hostname: "{% for key in ceph_current_status['servicemap']['services']['rgw']['daemons'].keys() %}{% if key == ansible_fqdn %}{{ key }}{% endif %}{% endfor %}"
|
|
|
|
when:
|
|
|
|
- ceph_current_fsid.get('rc', 1) == 0
|
|
|
|
- inventory_hostname in groups.get(rgw_group_name, [])
|
|
|
|
# no servicemap before luminous
|
|
|
|
- ceph_release_num[ceph_release] >= ceph_release_num['luminous']
|
|
|
|
- ansible_hostname != ansible_fqdn
|
|
|
|
|
|
|
|
- name: set_fact rgw_hostname
|
|
|
|
set_fact:
|
|
|
|
rgw_hostname: "{{ ansible_hostname }}"
|
|
|
|
when:
|
|
|
|
- rgw_hostname is undefined
|