]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
ceph-ansible: allow to run containerized daemons 521/head
authorSébastien Han <seb@redhat.com>
Sun, 7 Feb 2016 21:30:32 +0000 (22:30 +0100)
committerSébastien Han <seb@redhat.com>
Sun, 7 Feb 2016 21:30:32 +0000 (22:30 +0100)
run containerized daemons in virtual machines.
to enable it simply do:

`cp site-docker.yml.sample site-docker.yml`

and set `docker: true` in `vagrant_variables.yml`

Signed-off-by: Sébastien Han <seb@redhat.com>
15 files changed:
.gitignore
Vagrantfile
roles/ceph-mds/tasks/docker/fetch_configs.yml
roles/ceph-mds/tasks/docker/pre_requisite.yml
roles/ceph-mon/tasks/docker/fetch_configs.yml
roles/ceph-mon/tasks/docker/pre_requisite.yml
roles/ceph-osd/tasks/docker/fetch_configs.yml
roles/ceph-osd/tasks/docker/pre_requisite.yml
roles/ceph-restapi/tasks/docker/fetch_configs.yml
roles/ceph-restapi/tasks/docker/pre_requisite.yml
roles/ceph-rgw/tasks/docker/fetch_configs.yml
roles/ceph-rgw/tasks/docker/pre_requisite.yml
site-docker.yml.sample [new file with mode: 0644]
site.yml.sample
vagrant_variables.yml.sample

index 4687914104100147840868e4fc1954cb201d248b..05ce69b8e996b88890dc393bea106316c92c7f1b 100644 (file)
@@ -11,4 +11,5 @@ group_vars/rgws
 group_vars/restapis
 *.DS_Store
 site.yml
+site-docker.yml
 *.pyc
index 11b7f10103dac741e79a0376a15835c95139d5d6..3ca7d390ad3fbc5a8a836c5a234b2b526f45f498 100644 (file)
@@ -17,9 +17,15 @@ BOX        = settings['vagrant_box']
 MEMORY     = settings['memory']
 STORAGECTL = settings['vagrant_storagectl']
 ETH        = settings['eth']
+DOCKER     = settings['docker']
 
 ansible_provision = proc do |ansible|
-  ansible.playbook = 'site.yml'
+  if DOCKER then
+    ansible.playbook = 'site-docker.yml'
+  else
+    ansible.playbook = 'site.yml'
+  end
+
   # Note: Can't do ranges like mon[0-2] in groups because
   # these aren't supported by Vagrant, see
   # https://github.com/mitchellh/vagrant/issues/3539
@@ -33,16 +39,31 @@ ansible_provision = proc do |ansible|
   }
 
   # In a production deployment, these should be secret
-  ansible.extra_vars = {
-    ceph_stable: 'true',
-    journal_collocation: 'true',
-    journal_size: 100,
-    monitor_interface: ETH,
-    cluster_network: "#{SUBNET}.0/24",
-    public_network: "#{SUBNET}.0/24",
-    devices: settings['disks'],
-    os_tuning_params: settings['os_tuning_params']
-  }
+  if DOCKER then
+    ansible.extra_vars = {
+      mon_containerized_deployment: 'true',
+      osd_containerized_deployment: 'true',
+      mds_containerized_deployment: 'true',
+      rgw_containerized_deployment: 'true',
+      restapi_containerized_deployment: 'true',
+      ceph_mon_docker_interface: ETH,
+      ceph_mon_docker_subnet: "#{SUBNET}.0/24",
+      ceph_osd_docker_extra_env: "CEPH_DAEMON=OSD_CEPH_DISK,OSD_JOURNAL_SIZE=100",
+      ceph_osd_docker_device: settings['disks'],
+      ceph_rgw_civetweb_port: 8080
+    }
+  else
+    ansible.extra_vars = {
+      ceph_stable: 'true',
+      journal_collocation: 'true',
+      journal_size: 100,
+      monitor_interface: ETH,
+      cluster_network: "#{SUBNET}.0/24",
+      public_network: "#{SUBNET}.0/24",
+      devices: settings['disks'],
+      os_tuning_params: settings['os_tuning_params']
+    }
+  end
   ansible.limit = 'all'
 end
 
index 1ab999b49ec772d02d6a9f5c6ced18f29926e1ae..b500cfcdb2831cb670dc9ade2c9a7d9db836bd1e 100644 (file)
@@ -9,7 +9,7 @@
       - /var/lib/ceph/bootstrap-mds/ceph.keyring
 
 - name: stat for ceph config and keys
-  local_action: stat path={{ item }}
+  local_action: stat path={{ fetch_directory }}/docker_mon_files/{{ item }}
   with_items: ceph_config_keys
   changed_when: false
   become: false
index 71a03bd05c8d27d33d8fc023968a70438adaf47c..8e40aa963ab2eae0e1dbf61bd178b2dcb2233dc9 100644 (file)
@@ -7,24 +7,45 @@
     - /etc/ceph/
     - /var/lib/ceph/bootstrap-mds
 
-- name: install pip on debian
+- name: install pip and docker on ubuntu
   apt:
-    name: python-pip
+    name: "{{ item }}"
     state: present
-  when: ansible_os_family == 'Debian'
+    update_cache: yes
+  with_items:
+    - python-pip
+    - docker
+    - docker.io
+  when: ansible_distribution == 'Ubuntu'
 
-- name: install pip on redhat
+- name: install pip and docker on debian
+  apt:
+    name: "{{ item }}"
+    state: present
+    update_cache: yes
+  with_items:
+    - python-pip
+    - docker-engine
+  when: ansible_distribution == 'Debian'
+
+- name: install pip and docker on redhat
   yum:
-    name: python-pip
+    name: "{{ item }}"
     state: present
+  with_items:
+    - python-pip
+    - docker-engine
   when:
     ansible_os_family == 'RedHat' and
     ansible_pkg_mgr == "yum"
 
-- name: install pip on redhat
+- name: install pip and docker on redhat
   dnf:
-    name: python-pip
+    name: "{{ item }}"
     state: present
+  with_items:
+    - python-pip
+    - docker-engine
   when:
     ansible_os_family == 'RedHat' and
     ansible_pkg_mgr == "dnf"
index 5381c1adefb73be90369cce38cc1a5ee0df03301..bdf71b92a72891f8918128d7de6cfffc8a50754c 100644 (file)
@@ -11,7 +11,7 @@
       - /var/lib/ceph/bootstrap-mds/ceph.keyring
 
 - name: stat for ceph config and keys
-  local_action: stat path={{ item }}
+  local_action: stat path={{ fetch_directory }}/docker_mon_files/{{ item }}
   with_items: ceph_config_keys
   changed_when: false
   become: false
index c4fb42d022959afa578dd93e1625054230a994e1..41fb0e7fd85d71c9ea8b0251126f55c62a0514fd 100644 (file)
@@ -9,24 +9,45 @@
     - /var/lib/ceph/bootstrap-mds
     - /var/lib/ceph/bootstrap-rgw
 
-- name: install pip on debian
+- name: install pip and docker on ubuntu
   apt:
-    name: python-pip
+    name: "{{ item }}"
     state: present
-  when: ansible_os_family == 'Debian'
+    update_cache: yes
+  with_items:
+    - python-pip
+    - docker
+    - docker.io
+  when: ansible_distribution == 'Ubuntu'
 
-- name: install pip on redhat
+- name: install pip and docker on debian
+  apt:
+    name: "{{ item }}"
+    state: present
+    update_cache: yes
+  with_items:
+    - python-pip
+    - docker-engine
+  when: ansible_distribution == 'Debian'
+
+- name: install pip and docker on redhat
   yum:
-    name: python-pip
+    name: "{{ item }}"
     state: present
+  with_items:
+    - python-pip
+    - docker-engine
   when:
     ansible_os_family == 'RedHat' and
     ansible_pkg_mgr == "yum"
 
-- name: install pip on redhat
+- name: install pip and docker on redhat
   dnf:
-    name: python-pip
+    name: "{{ item }}"
     state: present
+  with_items:
+    - python-pip
+    - docker-engine
   when:
     ansible_os_family == 'RedHat' and
     ansible_pkg_mgr == "dnf"
index 802b4b9d28970c8b560cb0c8f5be06def6009bb8..f8e4d0c276a37c5c9bd054c4bc976fdcf2180441 100644 (file)
@@ -6,7 +6,7 @@
       - /var/lib/ceph/bootstrap-osd/ceph.keyring
 
 - name: stat for ceph config and keys
-  local_action: stat path={{ item }}
+  local_action: stat path={{ fetch_directory }}/docker_mon_files/{{ item }}
   with_items: ceph_config_keys
   changed_when: false
   become: false
index 6797f6954abfcfd4bacec748097b6571c3838ac6..3f3a982c4482e97272eb47b183ce1b44aa98f41d 100644 (file)
@@ -7,24 +7,45 @@
     - /etc/ceph/
     - /var/lib/ceph/bootstrap-osd
 
-- name: install pip on debian
+- name: install pip and docker on ubuntu
   apt:
-    name: python-pip
+    name: "{{ item }}"
     state: present
-  when: ansible_os_family == 'Debian'
+    update_cache: yes
+  with_items:
+    - python-pip
+    - docker
+    - docker.io
+  when: ansible_distribution == 'Ubuntu'
 
-- name: install pip on redhat
+- name: install pip and docker on debian
+  apt:
+    name: "{{ item }}"
+    state: present
+    update_cache: yes
+  with_items:
+    - python-pip
+    - docker-engine
+  when: ansible_distribution == 'Debian'
+
+- name: install pip and docker on redhat
   yum:
-    name: python-pip
+    name: "{{ item }}"
     state: present
+  with_items:
+    - python-pip
+    - docker-engine
   when:
     ansible_os_family == 'RedHat' and
     ansible_pkg_mgr == "yum"
 
-- name: install pip on redhat
+- name: install pip and docker on redhat
   dnf:
-    name: python-pip
+    name: "{{ item }}"
     state: present
+  with_items:
+    - python-pip
+    - docker-engine
   when:
     ansible_os_family == 'RedHat' and
     ansible_pkg_mgr == "dnf"
index 0b7e43dbb9ef7b19740fda5ee01bb9efd00f4318..c432478dbee9cbd255639e2333346324a909827e 100644 (file)
@@ -6,7 +6,7 @@
       - /etc/ceph/ceph.client.admin.keyring
 
 - name: stat for ceph config and keys
-  local_action: stat path={{ item }}
+  local_action: stat path={{ fetch_directory }}/docker_mon_files/{{ item }}
   with_items: ceph_config_keys
   changed_when: false
   become: false
index dd8b011ba24f180a509452531334e8f80f9ead2b..3eef686899afeabcc494659302a8333bd35cb917 100644 (file)
@@ -1,22 +1,43 @@
 ---
-- name: install pip on debian
+- name: install pip and docker on ubuntu
   apt:
-    name: python-pip
+    name: "{{ item }}"
     state: present
-  when: ansible_os_family == 'Debian'
+    update_cache: yes
+  with_items:
+    - python-pip
+    - docker
+    - docker.io
+  when: ansible_distribution == 'Ubuntu'
 
-- name: install pip on redhat
+- name: install pip and docker on debian
+  apt:
+    name: "{{ item }}"
+    state: present
+    update_cache: yes
+  with_items:
+    - python-pip
+    - docker-engine
+  when: ansible_distribution == 'Debian'
+
+- name: install pip and docker on redhat
   yum:
-    name: python-pip
+    name: "{{ item }}"
     state: present
+  with_items:
+    - python-pip
+    - docker-engine
   when:
     ansible_os_family == 'RedHat' and
     ansible_pkg_mgr == "yum"
 
-- name: install pip on redhat
+- name: install pip and docker on redhat
   dnf:
-    name: python-pip
+    name: "{{ item }}"
     state: present
+  with_items:
+    - python-pip
+    - docker-engine
   when:
     ansible_os_family == 'RedHat' and
     ansible_pkg_mgr == "dnf"
index 0154d911ccb64fa3c601eb75c82beb1cf47256be..7ee37682357a303462423955dcf7f0cf9e6f2790 100644 (file)
@@ -6,7 +6,7 @@
       - /var/lib/ceph/bootstrap-rgw/ceph.keyring
 
 - name: stat for ceph config and keys
-  local_action: stat path={{ item }}
+  local_action: stat path={{ fetch_directory }}/docker_mon_files/{{ item }}
   with_items: ceph_config_keys
   changed_when: false
   become: false
index 2b322050e95ac5815ffb3752b094e7aa432a54d0..48b57c252ccb4b73f69aea7877cfbb3fd1608025 100644 (file)
@@ -7,24 +7,45 @@
     - /etc/ceph/
     - /var/lib/ceph/bootstrap-rgw
 
-- name: install pip on debian
+ name: install pip and docker on ubuntu
   apt:
-    name: python-pip
+    name: "{{ item }}"
     state: present
-  when: ansible_os_family == 'Debian'
+    update_cache: yes
+  with_items:
+    - python-pip
+    - docker
+    - docker.io
+  when: ansible_distribution == 'Ubuntu'
 
-- name: install pip on redhat
+- name: install pip and docker on debian
+  apt:
+    name: "{{ item }}"
+    state: present
+    update_cache: yes
+  with_items:
+    - python-pip
+    - docker-engine
+  when: ansible_distribution == 'Debian'
+
+- name: install pip and docker on redhat
   yum:
-    name: python-pip
+    name: "{{ item }}"
     state: present
+  with_items:
+    - python-pip
+    - docker-engine
   when:
     ansible_os_family == 'RedHat' and
     ansible_pkg_mgr == "yum"
 
-- name: install pip on redhat
+- name: install pip and docker on redhat
   dnf:
-    name: python-pip
+    name: "{{ item }}"
     state: present
+  with_items:
+    - python-pip
+    - docker-engine
   when:
     ansible_os_family == 'RedHat' and
     ansible_pkg_mgr == "dnf"
diff --git a/site-docker.yml.sample b/site-docker.yml.sample
new file mode 100644 (file)
index 0000000..4cba5a7
--- /dev/null
@@ -0,0 +1,28 @@
+---
+# Defines deployment design and assigns role to server groups
+
+- hosts: mons
+  become: True
+  roles:
+  - ceph-mon
+  serial: 1 # MUST be '1' WHEN DEPLOYING MONITORS ON DOCKER CONTAINERS
+
+- hosts: osds
+  become: True
+  roles:
+  - ceph-osd
+
+- hosts: mdss
+  become: True
+  roles:
+  - ceph-mds
+
+- hosts: rgws
+  become: True
+  roles:
+  - ceph-rgw
+
+- hosts: restapis
+  become: True
+  roles:
+  - ceph-restapi
index b13c1c2abc82e51da4f48278c4c710c078d8ccf1..f74ace05390c65c9d7fa58e6cebcc1ea8a7a7fde 100644 (file)
@@ -5,7 +5,6 @@
   become: True
   roles:
   - ceph-mon
-  #serial: 1 # ENABLE THIS WHEN DEPLOYING MONITORS ON DOCKER CONTAINERS
 
 - hosts: osds
   become: True
index a9e1e5fcba216caddc70bded122dbcceb6470ca1..28c8729b3df32ad9060c84783fe4fc099e816ff4 100644 (file)
@@ -1,5 +1,8 @@
 ---
 
+# DEPLOY CONTAINERIZED DAEMONS
+docker: false
+
 # DEFINE THE NUMBER OF VMS TO RUN
 mon_vms: 3
 osd_vms: 3