mirror of https://github.com/ceph/ceph-ansible.git
in containerized deployment, use the right interface name variable in mon; remove one line inline files
cleanup on docker osd tasks Signed-off-by: Huamin Chen <hchen@redhat.com>pull/812/head
parent
84dad9a775
commit
a124078612
|
@ -27,7 +27,7 @@ dummy:
|
||||||
#ceph_osd_docker_username: ceph
|
#ceph_osd_docker_username: ceph
|
||||||
#ceph_osd_docker_imagename: daemon
|
#ceph_osd_docker_imagename: daemon
|
||||||
#ceph_osd_docker_extra_env: "CEPH_DAEMON=OSD_CEPH_DISK_ACTIVATE" # comma separated variables
|
#ceph_osd_docker_extra_env: "CEPH_DAEMON=OSD_CEPH_DISK_ACTIVATE" # comma separated variables
|
||||||
#ceph_osd_docker_prepare_env: "CEPH_DAEMON=OSD_CEPH_DISK_PREPARE,OSD_FORCE_ZAP=1" # comma separated variables
|
#ceph_osd_docker_prepare_env: "OSD_FORCE_ZAP=1" # comma separated variables
|
||||||
#ceph_osd_docker_devices:
|
#ceph_osd_docker_devices:
|
||||||
# - /dev/sdb
|
# - /dev/sdb
|
||||||
# - /dev/sdc
|
# - /dev/sdc
|
||||||
|
|
|
@ -30,7 +30,15 @@ host = {{ hostvars[host]['ansible_fqdn'] }}
|
||||||
host = {{ hostvars[host]['ansible_hostname'] }}
|
host = {{ hostvars[host]['ansible_hostname'] }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
# we need to check if monitor_interface is defined in the inventory per host or if it's set in a group_vars file
|
# we need to check if monitor_interface is defined in the inventory per host or if it's set in a group_vars file
|
||||||
{% if (hostvars[host]['monitor_interface'] is defined and hostvars[host]['monitor_interface'] != "interface") or monitor_interface != "interface" %}
|
{% if mon_containerized_deployment or mon_containerized_deployment_with_kv %}
|
||||||
|
{% set interface = ["ansible_",ceph_mon_docker_interface]|join %}
|
||||||
|
{% if (hostvars[host][interface] is defined and hostvars[host][interface] != "interface") or interface != "interface" %}
|
||||||
|
# user address from interface {{ ceph_mon_docker_interface }}
|
||||||
|
mon addr = {{ hostvars[host][interface]['ipv4']['address'] }}
|
||||||
|
{% else %}
|
||||||
|
mon addr = {{ hostvars[host]['monitor_address'] if hostvars[host]['monitor_address'] is defined else monitor_address }}
|
||||||
|
{% endif %}
|
||||||
|
{% elif (hostvars[host]['monitor_interface'] is defined and hostvars[host]['monitor_interface'] != "interface") or monitor_interface != "interface" %}
|
||||||
{% include 'mon_addr_interface.j2' %}
|
{% include 'mon_addr_interface.j2' %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% include 'mon_addr_address.j2' %}
|
{% include 'mon_addr_address.j2' %}
|
||||||
|
|
|
@ -15,16 +15,24 @@
|
||||||
with_items: ceph_osd_docker_devices
|
with_items: ceph_osd_docker_devices
|
||||||
register: osd_prepared
|
register: osd_prepared
|
||||||
|
|
||||||
|
# use shell rather than docker module
|
||||||
|
# to ensure osd disk prepare finishes before
|
||||||
|
# starting the next task
|
||||||
- name: prepare ceph osd disk
|
- name: prepare ceph osd disk
|
||||||
docker:
|
shell: |
|
||||||
image: "{{ ceph_osd_docker_username }}/{{ ceph_osd_docker_imagename }}"
|
docker run -ti --net=host \
|
||||||
name: "{{ ansible_hostname }}-osd-prepare-{{ item.0 | regex_replace('/', '') }}"
|
--pid=host \
|
||||||
net: host
|
--privileged=true \
|
||||||
pid: host
|
--name="{{ ansible_hostname }}-osd-prepare-{{ item.0 |
|
||||||
state: started
|
regex_replace('/', '') }}" \
|
||||||
privileged: yes
|
-v /etc/ceph:/etc/ceph \
|
||||||
env: "OSD_DEVICE={{ item.0 }},{{ ceph_osd_docker_prepare_env }}"
|
-v /var/lib/ceph/:/var/lib/ceph/ \
|
||||||
volumes: "/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph,/dev:/dev,/run:/run"
|
-v /dev:/dev \
|
||||||
|
-e "OSD_DEVICE={{ item.0 }}" \
|
||||||
|
-e "{{ ceph_osd_docker_prepare_env }}" \
|
||||||
|
"{{ ceph_osd_docker_username }}/{{ ceph_osd_docker_imagename }}" \
|
||||||
|
OSD_CEPH_DISK_PREPARE
|
||||||
|
failed_when: false
|
||||||
with_together:
|
with_together:
|
||||||
- ceph_osd_docker_devices
|
- ceph_osd_docker_devices
|
||||||
- osd_prepared.results
|
- osd_prepared.results
|
||||||
|
@ -32,8 +40,6 @@
|
||||||
- item.1.get("rc", 0) != 0
|
- item.1.get("rc", 0) != 0
|
||||||
- ceph_osd_docker_prepare_env is defined
|
- ceph_osd_docker_prepare_env is defined
|
||||||
- not osd_containerized_deployment_with_kv
|
- not osd_containerized_deployment_with_kv
|
||||||
- not is_atomic
|
|
||||||
- not ansible_os_family == 'CoreOS'
|
|
||||||
|
|
||||||
- name: prepare ceph osd disk with kv_store
|
- name: prepare ceph osd disk with kv_store
|
||||||
docker:
|
docker:
|
||||||
|
@ -53,52 +59,6 @@
|
||||||
- item.1.get("rc", 0) != 0
|
- item.1.get("rc", 0) != 0
|
||||||
- ceph_osd_docker_prepare_env is defined
|
- ceph_osd_docker_prepare_env is defined
|
||||||
- osd_containerized_deployment_with_kv
|
- osd_containerized_deployment_with_kv
|
||||||
- not is_atomic
|
|
||||||
- not ansible_os_family == 'CoreOS'
|
|
||||||
|
|
||||||
- name: prepare ceph osd disk for container operating systems
|
|
||||||
shell: |
|
|
||||||
docker run -d --net=host \
|
|
||||||
--pid=host \
|
|
||||||
--privileged=true \
|
|
||||||
-v /etc/ceph:/etc/ceph \
|
|
||||||
-v /var/lib/ceph/:/var/lib/ceph/ \
|
|
||||||
-v {{ item.0 }}:{{ item.0 }} \
|
|
||||||
-e OSD_DEVICE="{{ item.0 }}" \
|
|
||||||
-e "{{ ceph_osd_docker_prepare_env }}" \
|
|
||||||
"{{ ceph_osd_docker_username }}/{{ ceph_osd_docker_imagename }}" \
|
|
||||||
osd_ceph_disk_prepare
|
|
||||||
failed_when: false
|
|
||||||
changed_when: false
|
|
||||||
with_together:
|
|
||||||
- ceph_osd_docker_devices
|
|
||||||
- osd_prepared.results
|
|
||||||
when:
|
|
||||||
- item.1.get("rc", 0) != 0
|
|
||||||
- is_atomic or ansible_os_family == 'CoreOS'
|
|
||||||
- not osd_containerized_deployment_with_kv
|
|
||||||
|
|
||||||
- name: prepare ceph osd disk for container operating systems with kv_store
|
|
||||||
shell: |
|
|
||||||
docker run -d --net=host \
|
|
||||||
--pid=host \
|
|
||||||
--privileged=true \
|
|
||||||
-e KV_TYPE={{ kv_type }} \
|
|
||||||
-e KV_IP={{ kv_endpoint }} \
|
|
||||||
-v {{ item.0 }}:{{ item.0 }} \
|
|
||||||
-e OSD_DEVICE={{ item.0 }} \
|
|
||||||
-e "{{ ceph_osd_docker_prepare_env }}" \
|
|
||||||
"{{ ceph_osd_docker_username }}/{{ ceph_osd_docker_imagename }}" \
|
|
||||||
osd_ceph_disk_prepare
|
|
||||||
failed_when: false
|
|
||||||
changed_when: false
|
|
||||||
with_together:
|
|
||||||
- ceph_osd_docker_devices
|
|
||||||
- osd_prepared.results
|
|
||||||
when:
|
|
||||||
- item.1.get("rc", 0) != 0
|
|
||||||
- is_atomic or ansible_os_family == 'CoreOS'
|
|
||||||
- osd_containerized_deployment_with_kv
|
|
||||||
|
|
||||||
# Use systemd to manage container on Atomic host
|
# Use systemd to manage container on Atomic host
|
||||||
- name: generate systemd unit file
|
- name: generate systemd unit file
|
||||||
|
|
Loading…
Reference in New Issue