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
Huamin Chen 2016-05-12 15:25:12 +00:00
parent 84dad9a775
commit a124078612
3 changed files with 27 additions and 59 deletions

View File

@ -27,7 +27,7 @@ dummy:
#ceph_osd_docker_username: ceph
#ceph_osd_docker_imagename: daemon
#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:
# - /dev/sdb
# - /dev/sdc

View File

@ -30,7 +30,15 @@ host = {{ hostvars[host]['ansible_fqdn'] }}
host = {{ hostvars[host]['ansible_hostname'] }}
{% 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
{% 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' %}
{% else %}
{% include 'mon_addr_address.j2' %}

View File

@ -15,16 +15,24 @@
with_items: ceph_osd_docker_devices
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
docker:
image: "{{ ceph_osd_docker_username }}/{{ ceph_osd_docker_imagename }}"
name: "{{ ansible_hostname }}-osd-prepare-{{ item.0 | regex_replace('/', '') }}"
net: host
pid: host
state: started
privileged: yes
env: "OSD_DEVICE={{ item.0 }},{{ ceph_osd_docker_prepare_env }}"
volumes: "/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph,/dev:/dev,/run:/run"
shell: |
docker run -ti --net=host \
--pid=host \
--privileged=true \
--name="{{ ansible_hostname }}-osd-prepare-{{ item.0 |
regex_replace('/', '') }}" \
-v /etc/ceph:/etc/ceph \
-v /var/lib/ceph/:/var/lib/ceph/ \
-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:
- ceph_osd_docker_devices
- osd_prepared.results
@ -32,8 +40,6 @@
- item.1.get("rc", 0) != 0
- ceph_osd_docker_prepare_env is defined
- not osd_containerized_deployment_with_kv
- not is_atomic
- not ansible_os_family == 'CoreOS'
- name: prepare ceph osd disk with kv_store
docker:
@ -53,52 +59,6 @@
- item.1.get("rc", 0) != 0
- ceph_osd_docker_prepare_env is defined
- 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
- name: generate systemd unit file