fix containerized deployment on centos

Signed-off-by: Huamin Chen <hchen@redhat.com>
pull/812/head
Huamin Chen 2016-06-03 15:24:00 +00:00
parent a124078612
commit 6b84f5475b
7 changed files with 225 additions and 90 deletions

View File

@ -24,19 +24,60 @@
tags:
with_pkg
- name: install pip and docker on redhat
# install epel for pip
- name: install epel on redhat
yum:
name: "{{ item }}"
state: present
with_items:
- epel-release
when:
- ansible_os_family == 'RedHat'
- ansible_pkg_mgr == "yum"
tags:
with_pkg
failed_when: false
- name: install pip on redhat
yum:
name: "{{ item }}"
state: present
with_items:
- python-pip
- docker-engine
when:
- ansible_os_family == 'RedHat'
- ansible_pkg_mgr == "yum"
tags:
with_pkg
- name: install docker-engine on redhat
yum:
name: "{{ item }}"
state: present
with_items:
- docker-engine
when:
- ansible_os_family == 'RedHat'
- ansible_pkg_mgr == "yum"
tags:
with_pkg
failed_when: false
# for CentOS
- name: install docker on redhat
yum:
name: "{{ item }}"
state: present
with_items:
- docker
when:
- ansible_os_family == 'RedHat'
- ansible_pkg_mgr == "yum"
tags:
with_pkg
failed_when: false
# docker package could be docker-enginer or docker
- name: install pip and docker on redhat
dnf:
name: "{{ item }}"

View File

@ -24,32 +24,7 @@
tags:
with_pkg
- name: install pip and docker on redhat
yum:
name: "{{ item }}"
state: present
with_items:
- python-pip
- docker-engine
when:
- ansible_os_family == 'RedHat'
- ansible_pkg_mgr == "yum"
tags:
with_pkg
- name: install pip and docker on redhat
dnf:
name: "{{ item }}"
state: present
with_items:
- python-pip
- docker-engine
when:
- ansible_os_family == 'RedHat'
- ansible_pkg_mgr == "dnf"
tags:
with_pkg
# install epel for pip
- name: install epel-release on redhat
yum:
name: epel-release
@ -58,6 +33,60 @@
tags:
with_pkg
- name: install pip on redhat
yum:
name: "{{ item }}"
state: present
with_items:
- python-pip
when:
- ansible_os_family == 'RedHat'
- ansible_pkg_mgr == "yum"
tags:
with_pkg
- name: install docker-engine on redhat
yum:
name: "{{ item }}"
state: present
with_items:
- docker-engine
when:
- ansible_os_family == 'RedHat'
- ansible_pkg_mgr == "yum"
tags:
with_pkg
failed_when: false
# for CentOS
- name: install docker on redhat
yum:
name: "{{ item }}"
state: present
with_items:
- docker
when:
- ansible_os_family == 'RedHat'
- ansible_pkg_mgr == "yum"
tags:
with_pkg
failed_when: false
- name: install pip and docker on redhat (dnf)
dnf:
name: "{{ item }}"
state: present
with_items:
- python-pip
- docker-engine
- docker
when:
- ansible_os_family == 'RedHat'
- ansible_pkg_mgr == "dnf"
tags:
with_pkg
# NOTE (jimcurtis): need at least version 1.9.0 of six or we get:
# re:NameError: global name 'DEFAULT_DOCKER_API_VERSION' is not defined
- name: install six

View File

@ -49,26 +49,26 @@
owner: "root"
group: "root"
mode: "0644"
when: is_atomic or ansible_os_family == 'CoreOS'
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
- name: link systemd unit file for mon instance
file:
src: /var/lib/ceph/ceph-mon@.service
dest: /etc/systemd/system/multi-user.target.wants/ceph-mon@{{ ansible_hostname }}.service
state: link
when: is_atomic or ansible_os_family == 'CoreOS'
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
- name: enable systemd unit file for mon instance
shell: systemctl enable /etc/systemd/system/multi-user.target.wants/ceph-mon@{{ ansible_hostname }}.service
failed_when: false
changed_when: false
when: is_atomic or ansible_os_family == 'CoreOS'
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
- name: reload systemd unit files
shell: systemctl daemon-reload
changed_when: false
failed_when: false
when: is_atomic or ansible_os_family == 'CoreOS'
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
- name: systemd start mon container
service:
@ -76,12 +76,12 @@
state: started
enabled: yes
changed_when: false
when: is_atomic or ansible_os_family == 'CoreOS'
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
- name: wait for ceph.conf exists
wait_for:
path: /etc/ceph/ceph.conf
when: is_atomic
when: ansible_os_family == 'RedHat'
- name: run the ceph monitor docker image
docker:
@ -93,7 +93,7 @@
env: "MON_IP={{ hostvars[inventory_hostname]['ansible_' + ceph_mon_docker_interface]['ipv4']['address'] }},CEPH_DAEMON=MON,CEPH_PUBLIC_NETWORK={{ ceph_mon_docker_subnet }},{{ ceph_mon_extra_envs }}"
volumes: "/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph"
when:
- not is_atomic
- ansible_os_family != 'RedHat'
- ansible_os_family != 'CoreOS'
- not mon_containerized_deployment_with_kv
@ -106,6 +106,6 @@
privileged: "{{ mon_docker_privileged }}"
env: "KV_TYPE={{kv_type}},KV_IP={{kv_endpoint}},MON_IP={{ hostvars[inventory_hostname]['ansible_' + ceph_mon_docker_interface]['ipv4']['address'] }},CEPH_DAEMON=MON,CEPH_PUBLIC_NETWORK={{ ceph_mon_docker_subnet }},{{ ceph_mon_extra_envs }}"
when:
- not is_atomic
- ansible_os_family != 'RedHat'
- ansible_os_family != 'CoreOS'
- mon_containerized_deployment_with_kv

View File

@ -24,18 +24,52 @@
tags:
with_pkg
- name: install pip and docker on redhat
- name: install epel-release on redhat
yum:
name: epel-release
state: present
when: ansible_os_family == 'RedHat'
tags:
with_pkg
- name: install pip on redhat
yum:
name: "{{ item }}"
state: present
with_items:
- python-pip
when:
- ansible_os_family == 'RedHat'
- ansible_pkg_mgr == "yum"
tags:
with_pkg
- name: install docker-engine on redhat
yum:
name: "{{ item }}"
state: present
with_items:
- docker-engine
when:
- ansible_os_family == 'RedHat'
- ansible_pkg_mgr == "yum"
tags:
with_pkg
failed_when: false
# for CentOS
- name: install docker on redhat
yum:
name: "{{ item }}"
state: present
with_items:
- docker
when:
- ansible_os_family == 'RedHat'
- ansible_pkg_mgr == "yum"
tags:
with_pkg
failed_when: false
- name: install pip and docker on redhat
dnf:
@ -44,19 +78,13 @@
with_items:
- python-pip
- docker-engine
- docker
when:
- ansible_os_family == 'RedHat'
- ansible_pkg_mgr == "dnf"
tags:
with_pkg
- name: install epel-release on redhat
yum:
name: epel-release
state: present
when: ansible_os_family == 'RedHat'
tags:
with_pkg
# NOTE (jimcurtis): need at least version 1.9.0 of six or we get:
# re:NameError: global name 'DEFAULT_DOCKER_API_VERSION' is not defined

View File

@ -20,7 +20,7 @@
# starting the next task
- name: prepare ceph osd disk
shell: |
docker run -ti --net=host \
docker run --net=host \
--pid=host \
--privileged=true \
--name="{{ ansible_hostname }}-osd-prepare-{{ item.0 |
@ -32,7 +32,6 @@
-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
@ -60,7 +59,7 @@
- ceph_osd_docker_prepare_env is defined
- osd_containerized_deployment_with_kv
# Use systemd to manage container on Atomic host
# Use systemd to manage container on appropriate host
- name: generate systemd unit file
become: true
template:
@ -70,7 +69,7 @@
group: "root"
mode: "0644"
failed_when: false
when: is_atomic or ansible_os_family == 'CoreOS'
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
- name: link systemd unit file for osd instance
file:
@ -78,20 +77,20 @@
dest: /etc/systemd/system/multi-user.target.wants/ceph-osd@{{ item | basename }}.service
state: link
with_items: ceph_osd_docker_devices
when: is_atomic or ansible_os_family == 'CoreOS'
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
- name: enable systemd unit file for osd instance
shell: systemctl enable /etc/systemd/system/multi-user.target.wants/ceph-osd@{{ item | basename }}.service
failed_when: false
changed_when: false
with_items: ceph_osd_docker_devices
when: is_atomic or ansible_os_family == 'CoreOS'
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
- name: reload systemd unit files
shell: systemctl daemon-reload
changed_when: false
failed_when: false
when: is_atomic or ansible_os_family == 'CoreOS'
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
- name: systemd start osd container
service:
@ -100,7 +99,7 @@
enabled: yes
changed_when: false
with_items: ceph_osd_docker_devices
when: is_atomic or ansible_os_family == 'CoreOS'
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
- name: run the ceph osd docker image
docker:
@ -114,7 +113,7 @@
volumes: "/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph,/dev:/dev,/run:/run"
with_items: ceph_osd_docker_devices
when:
- not is_atomic
- ansible_os_family != 'RedHat'
- ansible_os_family != 'CoreOS'
- not osd_containerized_deployment_with_kv
@ -130,6 +129,6 @@
volumes: "/dev/:/dev/"
with_items: ceph_osd_docker_devices
when:
- not is_atomic
- ansible_os_family != 'RedHat'
- ansible_os_family != 'CoreOS'
- osd_containerized_deployment_with_kv

View File

@ -24,19 +24,52 @@
tags:
with_pkg
- name: install pip and docker on redhat
- name: install epel-release on redhat
yum:
name: epel-release
state: present
when: ansible_os_family == 'RedHat'
tags:
with_pkg
- name: install pip on redhat
yum:
name: "{{ item }}"
state: present
with_items:
- python-pip
- docker-engine
when:
- ansible_os_family == 'RedHat'
- ansible_pkg_mgr == "yum"
tags:
with_pkg
- name: install docker-engine on redhat
yum:
name: "{{ item }}"
state: present
with_items:
- docker-engine
when:
- ansible_os_family == 'RedHat'
- ansible_pkg_mgr == "yum"
tags:
with_pkg
failed_when: false
# for CentOS
- name: install docker on redhat
yum:
name: "{{ item }}"
state: present
with_items:
- docker
when:
- ansible_os_family == 'RedHat'
- ansible_pkg_mgr == "yum"
tags:
with_pkg
failed_when: false
- name: install pip and docker on redhat
dnf:
name: "{{ item }}"
@ -50,14 +83,6 @@
tags:
with_pkg
- name: install epel-release on redhat
yum:
name: epel-release
state: present
when: ansible_os_family == 'RedHat'
tags:
with_pkg
# NOTE (jimcurtis): need at least version 1.9.0 of six or we get:
# re:NameError: global name 'DEFAULT_DOCKER_API_VERSION' is not defined
- name: install six

View File

@ -24,32 +24,6 @@
tags:
with_pkg
- name: install pip and docker on redhat
yum:
name: "{{ item }}"
state: present
with_items:
- python-pip
- docker-engine
when:
- ansible_os_family == 'RedHat'
- ansible_pkg_mgr == "yum"
tags:
with_pkg
- name: install pip and docker on redhat
dnf:
name: "{{ item }}"
state: present
with_items:
- python-pip
- docker-engine
when:
- ansible_os_family == 'RedHat'
- ansible_pkg_mgr == "dnf"
tags:
with_pkg
- name: install epel-release on redhat
yum:
name: epel-release
@ -57,6 +31,45 @@
when: ansible_os_family == 'RedHat'
tags:
with_pkg
- name: install pip on redhat
yum:
name: "{{ item }}"
state: present
with_items:
- python-pip
when:
- ansible_os_family == 'RedHat'
- ansible_pkg_mgr == "yum"
tags:
with_pkg
- name: install docker-engine on redhat
yum:
name: "{{ item }}"
state: present
with_items:
- docker-engine
when:
- ansible_os_family == 'RedHat'
- ansible_pkg_mgr == "yum"
tags:
with_pkg
failed_when: false
# for CentOS
- name: install docker on redhat
yum:
name: "{{ item }}"
state: present
with_items:
- docker
when:
- ansible_os_family == 'RedHat'
- ansible_pkg_mgr == "yum"
tags:
with_pkg
failed_when: false
# NOTE (jimcurtis): need at least version 1.9.0 of six or we get:
# re:NameError: global name 'DEFAULT_DOCKER_API_VERSION' is not defined