]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
docker: fix tons of issues 648/head
authorSébastien Han <seb@redhat.com>
Tue, 22 Mar 2016 15:58:20 +0000 (16:58 +0100)
committerSébastien Han <seb@redhat.com>
Thu, 24 Mar 2016 16:55:21 +0000 (17:55 +0100)
Signed-off-by: Sébastien Han <seb@redhat.com>
22 files changed:
group_vars/all.sample
group_vars/common-coreoss.sample
group_vars/mdss.sample
group_vars/osds.sample
group_vars/restapis.sample
group_vars/rgws.sample
roles/ceph-common-coreos/README.md
roles/ceph-common-coreos/tasks/install_pip.yml
roles/ceph-common-coreos/tasks/install_pypy.yml
roles/ceph-common/defaults/main.yml
roles/ceph-common/tasks/installs/install_on_redhat.yml
roles/ceph-mds/defaults/main.yml
roles/ceph-mon/tasks/ceph_keys.yml
roles/ceph-mon/tasks/docker/copy_configs.yml [new file with mode: 0644]
roles/ceph-mon/tasks/docker/main.yml
roles/ceph-mon/tasks/docker/start_docker_monitor.yml
roles/ceph-osd/defaults/main.yml
roles/ceph-osd/tasks/docker/start_docker_osd.yml
roles/ceph-restapi/defaults/main.yml
roles/ceph-restapi/tasks/docker/fetch_configs.yml
roles/ceph-rgw/defaults/main.yml
roles/ceph-rgw/tasks/docker/fetch_configs.yml

index 4284df5952a60e50a8e09120175614706ad3ea0c..48375f7114f106de385eb5f5f057ee3c1e12cf17 100644 (file)
@@ -337,3 +337,4 @@ dummy:
 ##########
 
 #docker: false
+
index 4cfc5bfa31e4669237d121759909671cad0d0ef0..32ae29553386d62055e4d83f38254a62dcb15692 100644 (file)
@@ -1,7 +1,7 @@
 ---
 # Variables here are applicable to all host groups NOT roles
 
-# This sample file generated by generate-group-vars.sh
+# This sample file generated by generate_group_vars_sample.sh
 
 # Dummy variable to avoid error because ansible does not recognize the
 # file as a good configuration file when no variable in it.
@@ -14,3 +14,4 @@ dummy:
 #pypy_binary_directory: /opt/bin
 #pip_url: https://bootstrap.pypa.io/get-pip.py
 #local_temp_directory: /tmp
+
index 3cb0d0e2eb5ee48a29d4c122a2511876c62ae470..aa7729bdfb4fab45e2becbf1613e04411c341528 100644 (file)
@@ -32,4 +32,5 @@ dummy:
 #ceph_mds_docker_username: ceph
 #ceph_mds_docker_imagename: daemon
 #ceph_mds_docker_extra_env: "MDS_NAME={{ ansible_hostname }}" # comma separated variables
+#ceph_docker_on_openstack: false
 
index fb60f230c0381c0c90e29466421fbe0be854f2a2..11f0caee1ccd0ccd89fdffca516d8f316bc2e822 100644 (file)
@@ -128,4 +128,5 @@ dummy:
 #ceph_osd_docker_extra_env: "CEPH_DAEMON=OSD_CEPH_DISK" # comma separated variables
 #ceph_osd_docker_devices:
 # - /dev/sdb
+#ceph_docker_on_openstack: false
 
index f87d0a85f20d79475cf3eb0dd3431d9825fcc713..e58bfbb315842b41cdb8bbc6feab57dbc31e407e 100644 (file)
@@ -24,4 +24,5 @@ dummy:
 #ceph_restapi_docker_username: ceph
 #ceph_restapi_docker_imagename: daemon
 #ceph_restapi_docker_extra_env: "RESTAPI_IP=0.0.0.0" # comma separated variables
+#ceph_docker_on_openstack: false
 
index 6c4adc9b10fcf0d9af8bd3b96bd8954df50e28c4..f7d6425c67cb735d2a6c227fd482d7d5bfa5e064 100644 (file)
@@ -39,4 +39,5 @@ dummy:
 #ceph_rgw_docker_username: ceph
 #ceph_rgw_docker_imagename: daemon
 #ceph_rgw_docker_extra_env: "RGW_CIVETWEB_PORT={{ ceph_rgw_civetweb_port }}" # comma separated variables
+#ceph_docker_on_openstack: false
 
index 29765085353dd3f941fbc1693bae02289ae223d6..8574a6f2dbf513b99c45ba72f9b68fae7fbeb578 100644 (file)
@@ -24,7 +24,7 @@ has to be used with pypy in version 2.4 and below due to some dependency issues.
 ```
 - hosts: servers
   remote_user: core
-  sudo: True
+  become: True
   gather_facts: false
   roles:
      - { role: ceph-common-coreos }
index bac7d6975017cd4aa6f176c6eaecef0d87ace295..366d93f854b4149ebe3722ed09981834280533f4 100644 (file)
@@ -7,11 +7,11 @@
 
 - name: create local temp directory
   local_action: raw mkdir -p {{local_temp_directory}}
-  sudo: no
+  become: no
 
 - name: prepare install_pip.sh
   local_action: template src=install_pip.sh.j2 dest={{local_temp_directory}}/install_pip.sh
-  sudo: no
+  become: no
 
 - name: run pip.sh
   script: "{{local_temp_directory}}/install_pip.sh"
@@ -27,4 +27,4 @@
 
 - name: remove pip.sh
   local_action: file path="{{local_temp_directory}}/pip.sh" state=absent
-  sudo: no
+  become: no
index fb0ad0c3ce638c58078650a81a724345382cc8a4..a441101a9489c5eaef68009f65a91f69b9725920 100644 (file)
@@ -7,11 +7,11 @@
 
 - name: create local temp directory
   local_action: raw mkdir -p {{local_temp_directory}}
-  sudo: no
+  become: no
 
 - name: prepare python executable
   local_action: template src=install_python.sh.j2 dest={{local_temp_directory}}/install_python.sh
-  sudo: no
+  become: no
 
 - name: fix library
   raw: ln -s /lib64/libncurses.so.5.9 {{pypy_directory}}/lib_pypy/libtinfo.so.5
@@ -30,4 +30,4 @@
 
 - name: remove install_python.sh
   local_action: file path="{{local_temp_directory}}/install_python.sh" state=absent
-  sudo: no
+  become: no
index b810aae1b7064b23b65a33afb7f4a810e3daddf2..1a66d3c46e806b69ddfb37d4724e69913564954e 100644 (file)
@@ -42,6 +42,7 @@ centos_package_dependencies:
   - epel-release
   - ntp
   - python-setuptools
+  - libselinux-python
 
 redhat_package_dependencies:
   - python-pycurl
@@ -182,7 +183,10 @@ rbd_default_format: 2
 
 ## Monitor options
 #
+# You must define either monitor_interface or monitor_address. Preference
+# will go to monitor_interface if both are defined.
 monitor_interface: interface
+monitor_address: 0.0.0.0
 mon_use_fqdn: false # if set to true, the MON name used will be the fqdn in the ceph.conf
 mon_osd_down_out_interval: 600
 mon_osd_min_down_reporters: 7 # number of OSDs per host + 1
@@ -277,6 +281,7 @@ email_address: foo@bar.com
 ## REST API options
 #
 restapi_interface: "{{ monitor_interface }}"
+restapi_address: "{{ monitor_address }}"
 restapi_port: 5000
 restapi_base_url: /api/v0.1
 restapi_log_level: warning # available level are: critical, error, warning, info, debug
index 670e529ef6693b8028bf779f209267b8bd5bfee9..da0ce967e2c39f39e8a37c973c469d721919c478 100644 (file)
@@ -46,7 +46,9 @@
   when:
     (ceph_origin == "distro" or ceph_stable_rh_storage) and
     mon_group_name in group_names and
-    ansible_pkg_mgr == "yum"
+    ansible_pkg_mgr == "yum" and
+    ceph_stable and
+    ceph_stable_release not in ceph_stable_releases
 
 - name: install distro or red hat storage ceph mon
   dnf:
@@ -58,7 +60,9 @@
   when:
     (ceph_origin == "distro" or ceph_stable_rh_storage) and
     mon_group_name in group_names and
-    ansible_pkg_mgr == "dnf"
+    ansible_pkg_mgr == "dnf" and
+    ceph_stable and
+    ceph_stable_release not in ceph_stable_releases
 
 - name: install distro or red hat storage ceph osd
   yum:
@@ -70,7 +74,9 @@
   when:
     (ceph_origin == "distro" or ceph_stable_rh_storage) and
     osd_group_name in group_names and
-    ansible_pkg_mgr == "yum"
+    ansible_pkg_mgr == "yum" and
+    ceph_stable and
+    ceph_stable_release not in ceph_stable_releases
 
 - name: install distro or red hat storage ceph osd
   dnf:
@@ -82,7 +88,9 @@
   when:
     (ceph_origin == "distro" or ceph_stable_rh_storage) and
     osd_group_name in group_names and
-    ansible_pkg_mgr == "dnf"
+    ansible_pkg_mgr == "dnf" and
+    ceph_stable and
+    ceph_stable_release not in ceph_stable_releases
 
 - name: install ceph-test
   yum:
index 2df43d9dd5dbd5624d69a56b668131415e0a7056..9229d2a2dadd43a97f05a71a566542f05d17f9f1 100644 (file)
@@ -24,3 +24,4 @@ mds_containerized_deployment: false
 ceph_mds_docker_username: ceph
 ceph_mds_docker_imagename: daemon
 ceph_mds_docker_extra_env: "MDS_NAME={{ ansible_hostname }}" # comma separated variables
+ceph_docker_on_openstack: false
index c9ddc68541668ae4e4b936ecb5e27de3e3d75e4f..d28d8776bf19f7ecc144d94efc3d250a4a82e57c 100644 (file)
   changed_when: false
   when:
     cephx and
-    not mon_containerized_deployment and
     groups[restapi_group_name] is defined
 
-- name: create ceph rest api keyring when mon is containerized
-  command: docker exec {{ ansible_hostname }} ceph auth get-or-create client.restapi osd 'allow *' mon 'allow *' -o /etc/ceph/ceph.client.restapi.keyring
-  args:
-     creates: /etc/ceph/ceph.client.restapi.keyring
-  changed_when: false
-  when:
-    cephx and
-    mon_containerized_deployment and
-    groups[restapi_group_name] is defined and
-    inventory_hostname == groups.mons|last
-
-
 - include: openstack_config.yml
   when: openstack_config
 
diff --git a/roles/ceph-mon/tasks/docker/copy_configs.yml b/roles/ceph-mon/tasks/docker/copy_configs.yml
new file mode 100644 (file)
index 0000000..f2ba50e
--- /dev/null
@@ -0,0 +1,10 @@
+---
+- name: push ceph files to the ansible server
+  fetch:
+    src: "{{ item.0 }}"
+    dest: "{{ fetch_directory }}/docker_mon_files/{{ item.0 }}"
+    flat: yes
+  with_together:
+    - ceph_config_keys
+    - statconfig.results
+  when: item.1.stat.exists == false
index 469cf9357092b250778f91337dba092c60ae4e8d..49a381886e30ada6f8d8552fd28f5b5cdee7e145 100644 (file)
@@ -12,7 +12,7 @@
 - name: set fact for using Atomic host
   set_fact:
       is_atomic='{{ stat_ostree.stat.exists }}'
-                                  
+
 - include: checks.yml
   when: ceph_health.rc != 0 and not mon_containerized_deployment_with_kv
 
 
 # let the first mon create configs and keyrings
 - include: create_configs.yml
-  when: inventory_hostname == groups.mons[0] and not mon_containerized_default_ceph_conf_with_kv
+  when: inventory_hostname == groups.mons[0] and mon_containerized_default_ceph_conf_with_kv
 
 - include: fetch_configs.yml
   when: not mon_containerized_deployment_with_kv
 
 - include: start_docker_monitor.yml
 
-- include: ../ceph_keys.yml
-  when: not mon_containerized_deployment_with_kv
\ No newline at end of file
+- include: copy_configs.yml
+  when: not mon_containerized_deployment_with_kv
+
+- name: create ceph rest api keyring when mon is containerized
+  command: docker exec {{ ansible_hostname }} ceph auth get-or-create client.restapi osd 'allow *' mon 'allow *' -o /etc/ceph/ceph.client.restapi.keyring
+  args:
+     creates: /etc/ceph/ceph.client.restapi.keyring
+  changed_when: false
+  when:
+    cephx and
+    mon_containerized_deployment and
+    groups[restapi_group_name] is defined and
+    inventory_hostname == groups.mons|last and
+    not mon_containerized_deployment_with_kv
index 1b5602cf510bd33ae7d77c364e7b280d2ab0534b..48fb8ad6d833a3710958c6941a5f7ea1644ca263 100644 (file)
@@ -1,13 +1,4 @@
 ---
-- name: set config and keys paths
-  set_fact:
-      ceph_bootstrap_config_keys:
-          - /etc/ceph/ceph.conf
-          - /var/lib/ceph/bootstrap-osd/ceph.keyring
-          - /var/lib/ceph/bootstrap-rgw/ceph.keyring
-          - /var/lib/ceph/bootstrap-mds/ceph.keyring
-  when: not mon_containerized_deployment_with_kv
-
 - name: pull ceph daemon image
   shell: "docker pull {{ ceph_mon_docker_username }}/{{ ceph_mon_docker_imagename }}"
 
       KV_IP: "{{kv_endpoint}}"
       KV_PORT: "{{kv_port}}"
   run_once: true
-  when: inventory_hostname == groups.mons[0] and mon_containerized_deployment_with_kv
-        and mon_containerized_default_ceph_conf_with_kv
+  when:
+    inventory_hostname == groups.mons[0] and
+    mon_containerized_deployment_with_kv and
+    mon_containerized_default_ceph_conf_with_kv
 
 - name: populate kv_store with custom ceph.conf
   docker:
     volumes:
       - /etc/ceph/ceph.conf:/etc/ceph/ceph.defaults
   run_once: true
-  when: inventory_hostname == groups.mons[0] and mon_containerized_deployment_with_kv
-        and not mon_containerized_default_ceph_conf_with_kv
+  when:
+    inventory_hostname == groups.mons[0] and
+    mon_containerized_deployment_with_kv and
+    not mon_containerized_default_ceph_conf_with_kv
 
 - name: delete populate-kv-store docker
   docker:
@@ -49,7 +44,7 @@
 
 # Use systemd to manage container on Atomic host and CoreOS
 - name: generate systemd unit file
-  sudo: true
+  become: true
   template:
     src: ceph-mon.service.j2
     dest: /var/lib/ceph/ceph-mon@.service
     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:
+    is_atomic 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:
+    is_atomic or
+    ansible_os_family == 'CoreOS'
 
 - name: reload systemd unit files
   shell: systemctl daemon-reload
-  when: is_atomic or ansible_os_family == 'CoreOS'
+  when:
+    is_atomic or
+    ansible_os_family == 'CoreOS'
 
 - name: systemd start mon container
   service:
     state: started
     enabled: yes
   changed_when: false
-  when: is_atomic or ansible_os_family == 'CoreOS'
+  when:
+    is_atomic or
+    ansible_os_family == 'CoreOS'
 
 - name: wait for ceph.conf exists
   wait_for:
       path: /etc/ceph/ceph.conf
   when: is_atomic
 
-- name: run the ceph Monitor docker image
+- name: run the ceph monitor docker image
   docker:
     image: "{{ ceph_mon_docker_username }}/{{ ceph_mon_docker_imagename }}"
     name: "{{ ansible_hostname }}"
     privileged: "{{ mon_docker_privileged }}"
     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 and ansible_os_family != 'CoreOS'
-
-- name: stat for ceph config and keys
-  stat: path="{{ item }}"
-  with_items: ceph_bootstrap_config_keys
-  changed_when: false
-  failed_when: false
-  register: statmonconfig
-  when: not mon_containerized_deployment_with_kv
-
-- name: fetch boostrap keys and conf from mon
-  fetch:
-     dest: "{{ playbook_dir }}/{{ fetch_directory }}/{{ fsid }}/{{ item.0 }}"
-     src: "{{ item.0 }}"
-     flat: yes
-  with_together:
-    - ceph_bootstrap_config_keys
-    - statmonconfig.results
-  when: not mon_containerized_deployment_with_kv and item.1.stat.exists == true
-        and inventory_hostname == groups.mons[0]
+  when:
+    not is_atomic and
+    ansible_os_family != 'CoreOS'
index d7c13e0b8740de36138d76edfcf8ae659ce796a7..0b86c1fe3f1c1cac672c068d2784639abc62b450 100644 (file)
@@ -120,3 +120,4 @@ ceph_osd_docker_imagename: daemon
 ceph_osd_docker_extra_env: "CEPH_DAEMON=OSD_CEPH_DISK" # comma separated variables
 #ceph_osd_docker_devices:
 # - /dev/sdb
+ceph_docker_on_openstack: false
index 919b98de905796790a739853870931a20ae31fca..2892f92628d77c353a6c374abd39a11c7ca64447 100644 (file)
@@ -2,13 +2,13 @@
 # For openstack VMs modify the mount point below depending on if the Openstack
 # VM deploy tool defaults to mounting ephemeral disks
 - name: umount ceph disk (if on openstack)
-  mount: 
+  mount:
     name: /mnt
     src: /dev/vdb
     fstype: ext3
     state: unmounted
   when: ceph_docker_on_openstack
-  
+
 # (rootfs) for reasons I haven't figured out, docker pull and run will fail.
 - name: pull ceph daemon image
   shell: "docker pull {{ ceph_osd_docker_username }}/{{ ceph_osd_docker_imagename }}"
@@ -28,7 +28,7 @@
 
 # Use systemd to manage container on Atomic host
 - name: generate systemd unit file
-  sudo: true
+  become: true
   template:
     src: ceph-osd.service.j2
     dest: /var/lib/ceph/ceph-osd@.service
index c8320c1142ad896289b63e89922b450ae17ac63f..4ac192eed1cabfb1c1d9b75a596ce27227bf9f27 100644 (file)
@@ -16,3 +16,4 @@ ceph_restapi_port: 5000
 ceph_restapi_docker_username: ceph
 ceph_restapi_docker_imagename: daemon
 ceph_restapi_docker_extra_env: "RESTAPI_IP=0.0.0.0" # comma separated variables
+ceph_docker_on_openstack: false
index 2faf8ade5289a289f50751ba698dfb1ea5fa3ec6..8af56884ec106d370fd29dcea20c947e7c2d668f 100644 (file)
@@ -15,7 +15,7 @@
 
 - name: try to fetch ceph config and keys
   copy:
-    src: "{{ playbook_dir }}/{{ fetch_directory }}/{{ fsid }}/{{ item.0 }}"
+    src: "{{ playbook_dir }}/{{ fetch_directory }}/docker_mon_files/{{ item.0 }}"
     dest: "{{ item.0 }}"
     owner: root
     group: root
index 26b2b0913a46b818d5018da0cab343e95b1e76bc..076c93fe73edc37fb140586108df27ed30989a3c 100644 (file)
@@ -31,3 +31,4 @@ ceph_rgw_civetweb_port: 80
 ceph_rgw_docker_username: ceph
 ceph_rgw_docker_imagename: daemon
 ceph_rgw_docker_extra_env: "RGW_CIVETWEB_PORT={{ ceph_rgw_civetweb_port }}" # comma separated variables
+ceph_docker_on_openstack: false
index 45dd3bebcd40db0d1fc14a5c9aabe29ed56524f3..6902b591900ee38ed277e1094704086cdedd71a3 100644 (file)
@@ -15,7 +15,7 @@
 
 - name: try to fetch ceph config and keys
   copy:
-    src: "{{ playbook_dir }}/{{ fetch_directory }}/{{ fsid }}/{{ item.0 }}"
+    src: "{{ playbook_dir }}/{{ fetch_directory }}/docker_mon_files/{{ item.0 }}"
     dest: "{{ item.0 }}"
     owner: root
     group: root