moving to ansible v2.2 compatibility

Signed-off-by: Sébastien Han <seb@redhat.com>
Co-Authored-By: Julien Francoz julien@francoz.net
pull/1082/head
Sébastien Han 2016-11-03 10:16:33 +01:00
parent 899c8b309f
commit a2fcd222d2
51 changed files with 138 additions and 123 deletions

View File

@ -45,14 +45,14 @@
command: git subtree split --prefix=roles/{{ item }} -b {{ item }} --squash command: git subtree split --prefix=roles/{{ item }} -b {{ item }} --squash
args: args:
chdir: "{{ basedir }}" chdir: "{{ basedir }}"
with_items: roles with_items: "{{ roles }}"
- name: adds remote github repos for the splits - name: adds remote github repos for the splits
tags: split tags: split
command: git remote add {{ item }} git@github.com:{{ github }}-{{ item }}.git command: git remote add {{ item }} git@github.com:{{ github }}-{{ item }}.git
args: args:
chdir: "{{ basedir }}" chdir: "{{ basedir }}"
with_items: roles with_items: "{{ roles }}"
- name: adds upstream remote - name: adds upstream remote
tags: update tags: update
@ -68,4 +68,4 @@
shell: git push {{ item }} $(git subtree split --prefix roles/{{ item }} master):master --force shell: git push {{ item }} $(git subtree split --prefix roles/{{ item }} master):master --force
args: args:
chdir: "{{ basedir }}" chdir: "{{ basedir }}"
with_items: roles with_items: "{{ roles }}"

View File

@ -37,4 +37,5 @@ dummy:
#ceph_mds_docker_image_tag: latest #ceph_mds_docker_image_tag: latest
#ceph_mds_docker_extra_env: "MDS_NAME={{ ansible_hostname }}" # comma separated variables #ceph_mds_docker_extra_env: "MDS_NAME={{ ansible_hostname }}" # comma separated variables
#ceph_docker_on_openstack: false #ceph_docker_on_openstack: false
#ceph_config_keys: [] # DON'T TOUCH ME

View File

@ -89,4 +89,5 @@ dummy:
#ceph_docker_on_openstack: false #ceph_docker_on_openstack: false
#mon_docker_privileged: false #mon_docker_privileged: false
#mon_docker_net_host: true #mon_docker_net_host: true
#ceph_config_keys: [] # DON'T TOUCH ME

View File

@ -19,6 +19,7 @@ dummy:
# #
#cephx: true #cephx: true
####################### #######################
# Access type options # # Access type options #
####################### #######################
@ -89,4 +90,5 @@ dummy:
#ceph_nfs_docker_image_tag: latest #ceph_nfs_docker_image_tag: latest
#ceph_nfs_docker_extra_env: "GANESHA_EPOCH={{ ganesha_epoch }}" # comma separated variables #ceph_nfs_docker_extra_env: "GANESHA_EPOCH={{ ganesha_epoch }}" # comma separated variables
#ceph_docker_on_openstack: false #ceph_docker_on_openstack: false
#ceph_config_keys: [] # DON'T TOUCH ME

View File

@ -183,4 +183,5 @@ dummy:
#ceph_osd_docker_devices: #ceph_osd_docker_devices:
# - /dev/sdb # - /dev/sdb
#ceph_docker_on_openstack: false #ceph_docker_on_openstack: false
#ceph_config_keys: [] # DON'T TOUCH ME

View File

@ -11,6 +11,7 @@ dummy:
# SETUP # # SETUP #
######### #########
# NOTE (leseb): the rbd-mirror daemon needs a user to start # NOTE (leseb): the rbd-mirror daemon needs a user to start
# because it has to authenticate with the local cluster. # because it has to authenticate with the local cluster.
# By default, using the admin user is fine, so you should not # By default, using the admin user is fine, so you should not
@ -49,4 +50,5 @@ dummy:
#ceph_rbd_mirror_docker_imagename: daemon #ceph_rbd_mirror_docker_imagename: daemon
#ceph_rbd_mirror_docker_image_tag: latest #ceph_rbd_mirror_docker_image_tag: latest
#ceph_docker_on_openstack: false #ceph_docker_on_openstack: false
#ceph_config_keys: [] # DON'T TOUCH ME

View File

@ -26,4 +26,5 @@ dummy:
#ceph_restapi_docker_image_tag: latest #ceph_restapi_docker_image_tag: latest
#ceph_restapi_docker_extra_env: "RESTAPI_IP=0.0.0.0" # comma separated variables #ceph_restapi_docker_extra_env: "RESTAPI_IP=0.0.0.0" # comma separated variables
#ceph_docker_on_openstack: false #ceph_docker_on_openstack: false
#ceph_config_keys: [] # DON'T TOUCH ME

View File

@ -44,4 +44,5 @@ dummy:
#ceph_rgw_docker_image_tag: latest #ceph_rgw_docker_image_tag: latest
#ceph_rgw_docker_extra_env: "RGW_CIVETWEB_PORT={{ ceph_rgw_civetweb_port }}" # comma separated variables #ceph_rgw_docker_extra_env: "RGW_CIVETWEB_PORT={{ ceph_rgw_civetweb_port }}" # comma separated variables
#ceph_docker_on_openstack: false #ceph_docker_on_openstack: false
#ceph_config_keys: [] # DON'T TOUCH ME

View File

@ -119,7 +119,7 @@
group=root group=root
mode=0644 mode=0644
delegate_to: "{{ item }}" delegate_to: "{{ item }}"
with_items: groups.backup[0] with_items: "{{ groups.backup[0] }}"
when: migration_completed.stat.exists == False when: migration_completed.stat.exists == False
# NOTE (leseb): should we convert upstart to sysvinit here already? # NOTE (leseb): should we convert upstart to sysvinit here already?
@ -224,7 +224,7 @@
retries: 5 retries: 5
delay: 10 delay: 10
delegate_to: "{{ item }}" delegate_to: "{{ item }}"
with_items: groups.backup[0] with_items: "{{ groups.backup[0] }}"
when: migration_completed.stat.exists == False when: migration_completed.stat.exists == False
- name: Done moving to the next monitor - name: Done moving to the next monitor
@ -280,7 +280,7 @@
- name: Set the noout flag - name: Set the noout flag
command: ceph osd set noout command: ceph osd set noout
delegate_to: "{{ item }}" delegate_to: "{{ item }}"
with_items: groups.mons[0] with_items: "{{ groups.mons[0] }}"
when: migration_completed.stat.exists == False when: migration_completed.stat.exists == False
- name: Check if sysvinit - name: Check if sysvinit
@ -310,7 +310,7 @@
group=root group=root
mode=0644 mode=0644
delegate_to: "{{ item }}" delegate_to: "{{ item }}"
with_items: groups.backup[0] with_items: "{{ groups.backup[0] }}"
when: migration_completed.stat.exists == False when: migration_completed.stat.exists == False
- name: Scp OSDs dirs and configs - name: Scp OSDs dirs and configs
@ -345,8 +345,7 @@
port={{ item }} port={{ item }}
timeout=10 timeout=10
state=stopped state=stopped
with_items: with_items: "{{ osd_ports.stdout_lines }}"
- "{{ osd_ports.stdout_lines }}"
when: migration_completed.stat.exists == False when: migration_completed.stat.exists == False
- name: Configure RHEL with sysvinit - name: Configure RHEL with sysvinit
@ -413,7 +412,7 @@
retries: 10 retries: 10
delay: 10 delay: 10
delegate_to: "{{ item }}" delegate_to: "{{ item }}"
with_items: groups.backup[0] with_items: "{{ groups.backup[0] }}"
when: migration_completed.stat.exists == False when: migration_completed.stat.exists == False
- name: Done moving to the next OSD - name: Done moving to the next OSD
@ -428,7 +427,7 @@
- name: Unset the noout flag - name: Unset the noout flag
command: ceph osd unset noout command: ceph osd unset noout
delegate_to: "{{ item }}" delegate_to: "{{ item }}"
with_items: groups.mons[0] with_items: "{{ groups.mons[0] }}"
when: migration_completed.stat.exists == False when: migration_completed.stat.exists == False
- hosts: rgws - hosts: rgws
@ -468,7 +467,7 @@
group=root group=root
mode=0644 mode=0644
delegate_to: "{{ item }}" delegate_to: "{{ item }}"
with_items: groups.backup[0] with_items: "{{ groups.backup[0] }}"
when: migration_completed.stat.exists == False when: migration_completed.stat.exists == False
- name: Scp RGWs dirs and configs - name: Scp RGWs dirs and configs

View File

@ -420,7 +420,7 @@
raw_device=$(echo "{{ item }}" | egrep -o '/dev/([hsv]d[a-z]{1,2}|cciss/c[0-9]d[0-9]p|nvme[0-9]n[0-9]p){1,2}') raw_device=$(echo "{{ item }}" | egrep -o '/dev/([hsv]d[a-z]{1,2}|cciss/c[0-9]d[0-9]p|nvme[0-9]n[0-9]p){1,2}')
partition_nb=$(echo "{{ item }}" | egrep -o '[0-9]{1,2}$') partition_nb=$(echo "{{ item }}" | egrep -o '[0-9]{1,2}$')
sgdisk --delete $partition_nb $raw_device sgdisk --delete $partition_nb $raw_device
with_items: "{{ceph_journal_partition_to_erase_path.stdout_lines}}" with_items: "{{ ceph_journal_partition_to_erase_path.stdout_lines }}"
when: when:
ceph_journal_partlabels.rc == 0 and ceph_journal_partlabels.rc == 0 and
zap_block_devs zap_block_devs

View File

@ -111,7 +111,7 @@
- name: select a running monitor - name: select a running monitor
set_fact: mon_host={{ item }} set_fact: mon_host={{ item }}
with_items: groups.mons with_items: "{{ groups.mons }}"
when: item != inventory_hostname when: item != inventory_hostname
- name: waiting for the monitor to join the quorum... - name: waiting for the monitor to join the quorum...

View File

@ -70,7 +70,7 @@
- fail: - fail:
msg: "Ceph's configuration file is not present in /etc/ceph" msg: "Ceph's configuration file is not present in /etc/ceph"
with_items: "{{ceph_conf_key.results}}" with_items: "{{ ceph_conf_key.results }}"
when: when:
- item.stat.exists == false - item.stat.exists == false
@ -91,11 +91,11 @@
# #
- name: find the host where the osd(s) is/are running on - name: find the host where the osd(s) is/are running on
command: ceph --cluster {{ cluster }} osd find {{ item }} command: ceph --cluster {{ cluster }} osd find {{ item }}
with_items: "{{osd_ids.split(',')}}" with_items: "{{ osd_ids.split(',') }}"
register: osd_hosts register: osd_hosts
- set_fact: ip_item="{{(item.stdout | from_json).ip}}" - set_fact: ip_item="{{(item.stdout | from_json).ip}}"
with_items: "{{osd_hosts.results}}" with_items: "{{ osd_hosts.results }}"
register: ip_result register: ip_result
- set_fact: ips="{{ ip_result.results | map(attribute='ansible_facts.ip_item') | list }}" - set_fact: ips="{{ ip_result.results | map(attribute='ansible_facts.ip_item') | list }}"
@ -106,26 +106,26 @@
stat: stat:
path: "/etc/ceph/{{ cluster }}.client.admin.keyring" path: "/etc/ceph/{{ cluster }}.client.admin.keyring"
register: ceph_admin_key register: ceph_admin_key
with_items: "{{real_ips}}" with_items: "{{ real_ips }}"
delegate_to: "{{item}}" delegate_to: "{{ item }}"
failed_when: false failed_when: false
- fail: - fail:
msg: "The Ceph admin key is not present on the OSD node, please add it and remove it after the playbook is done." msg: "The Ceph admin key is not present on the OSD node, please add it and remove it after the playbook is done."
with_items: "{{ceph_admin_key.results}}" with_items: "{{ ceph_admin_key.results }}"
when: when:
- item.stat.exists == false - item.stat.exists == false
- name: deactivating osd(s) - name: deactivating osd(s)
command: ceph-disk deactivate --cluster {{ cluster }} --deactivate-by-id {{ item.0 }} --mark-out command: ceph-disk deactivate --cluster {{ cluster }} --deactivate-by-id {{ item.0 }} --mark-out
with_together: with_together:
- "{{osd_ids.split(',')}}" - "{{ osd_ids.split(',') }}"
- "{{real_ips}}" - "{{ real_ips }}"
delegate_to: "{{item.1}}" delegate_to: "{{ item.1 }}"
- name: destroying osd(s) - name: destroying osd(s)
command: ceph-disk destroy --cluster {{ cluster }} --destroy-by-id {{ item.0 }} --zap command: ceph-disk destroy --cluster {{ cluster }} --destroy-by-id {{ item.0 }} --zap
with_together: with_together:
- "{{osd_ids.split(',')}}" - "{{ osd_ids.split(',') }}"
- "{{real_ips}}" - "{{ real_ips }}"
delegate_to: "{{item.1}}" delegate_to: "{{ item.1 }}"

View File

@ -93,7 +93,7 @@
- name: switching from non-containerized to containerized ceph mon - name: switching from non-containerized to containerized ceph mon
vars: vars:
mon_group_name: mons mon_group_name: mons
restapi_group_name: restapis restapi_group_name: restapis
hosts: hosts:
@ -115,7 +115,7 @@
- name: select a running monitor - name: select a running monitor
set_fact: mon_host={{ item }} set_fact: mon_host={{ item }}
with_items: groups.mons with_items: "{{ groups.mons }}"
when: item != inventory_hostname when: item != inventory_hostname
- name: get current ceph fsid - name: get current ceph fsid

View File

@ -1,7 +1,7 @@
--- ---
- name: create pools - name: create pools
command: ceph --cluster {{ cluster }} osd pool create {{ item.name }} {{ item.pgs }} command: ceph --cluster {{ cluster }} osd pool create {{ item.name }} {{ item.pgs }}
with_items: pools with_items: "{{ pools }}"
changed_when: false changed_when: false
failed_when: false failed_when: false
@ -9,6 +9,6 @@
command: ceph --cluster {{ cluster }} auth get-or-create {{ item.name }} {{ item.value }} -o /etc/ceph/{{ cluster }}.{{ item.name }}.keyring command: ceph --cluster {{ cluster }} auth get-or-create {{ item.name }} {{ item.value }} -o /etc/ceph/{{ cluster }}.{{ item.name }}.keyring
args: args:
creates: /etc/ceph/{{ cluster }}.{{ item.name }}.keyring creates: /etc/ceph/{{ cluster }}.{{ item.name }}.keyring
with_items: keys with_items: "{{ keys }}"
changed_when: false changed_when: false
when: cephx when: cephx

View File

@ -5,7 +5,7 @@
state: present state: present
update_cache: yes update_cache: yes
cache_valid_time: 3600 cache_valid_time: 3600
with_items: "{{debian_package_dependencies}}" with_items: "{{ debian_package_dependencies }}"
- name: configure ceph apt repository - name: configure ceph apt repository
include: debian_ceph_repository.yml include: debian_ceph_repository.yml
@ -17,7 +17,7 @@
update_cache: yes update_cache: yes
state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}"
default_release: "{{ ceph_stable_release_uca | default(ansible_distribution_release) }}{{ '-backports' if ceph_origin == 'distro' and ceph_use_distro_backports else ''}}" default_release: "{{ ceph_stable_release_uca | default(ansible_distribution_release) }}{{ '-backports' if ceph_origin == 'distro' and ceph_use_distro_backports else ''}}"
with_items: "{{debian_ceph_packages}}" with_items: "{{ debian_ceph_packages }}"
- name: install ceph-test - name: install ceph-test
apt: apt:

View File

@ -37,7 +37,7 @@
state: present state: present
update_cache: yes update_cache: yes
cache_valid_time: 3600 cache_valid_time: 3600
with_items: debian_package_dependencies with_items: "{{ debian_package_dependencies }}"
- name: install red hat storage ceph mon - name: install red hat storage ceph mon
apt: apt:

View File

@ -20,7 +20,7 @@
yum: yum:
name: "{{ item }}" name: "{{ item }}"
state: present state: present
with_items: redhat_package_dependencies with_items: "{{ redhat_package_dependencies }}"
when: when:
- ansible_pkg_mgr == "yum" - ansible_pkg_mgr == "yum"

View File

@ -28,4 +28,4 @@
state: present state: present
sysctl_file: /etc/sysctl.conf sysctl_file: /etc/sysctl.conf
ignoreerrors: yes ignoreerrors: yes
with_items: os_tuning_params with_items: "{{ os_tuning_params }}"

View File

@ -29,3 +29,4 @@ ceph_mds_docker_imagename: daemon
ceph_mds_docker_image_tag: latest ceph_mds_docker_image_tag: latest
ceph_mds_docker_extra_env: "MDS_NAME={{ ansible_hostname }}" # comma separated variables ceph_mds_docker_extra_env: "MDS_NAME={{ ansible_hostname }}" # comma separated variables
ceph_docker_on_openstack: false ceph_docker_on_openstack: false
ceph_config_keys: [] # DON'T TOUCH ME

View File

@ -13,7 +13,7 @@
- name: stat for ceph config and keys - name: stat for ceph config and keys
stat: stat:
path: "{{ item }}" path: "{{ item }}"
with_items: ceph_config_keys with_items: "{{ ceph_config_keys }}"
changed_when: false changed_when: false
failed_when: false failed_when: false
register: statleftover register: statleftover
@ -22,6 +22,6 @@
fail: fail:
msg: "looks like no cluster is running but ceph files are present, please remove them" msg: "looks like no cluster is running but ceph files are present, please remove them"
with_together: with_together:
- ceph_config_keys - "{{ ceph_config_keys }}"
- statleftover.results - "{{ statleftover.results }}"
when: item.1.stat.exists == true when: item.1.stat.exists == true

View File

@ -10,7 +10,7 @@
- name: stat for ceph config and keys - name: stat for ceph config and keys
local_action: stat path={{ fetch_directory }}/docker_mon_files/{{ item }} local_action: stat path={{ fetch_directory }}/docker_mon_files/{{ item }}
with_items: ceph_config_keys with_items: "{{ ceph_config_keys }}"
changed_when: false changed_when: false
become: false become: false
failed_when: false failed_when: false
@ -25,6 +25,6 @@
mode: 0644 mode: 0644
changed_when: false changed_when: false
with_together: with_together:
- ceph_config_keys - "{{ ceph_config_keys }}"
- statconfig.results - "{{ statconfig.results }}"
when: item.1.stat.exists == true when: item.1.stat.exists == true

View File

@ -81,3 +81,4 @@ ceph_mon_extra_envs: "MON_NAME={{ ansible_hostname }}" # comma separated variabl
ceph_docker_on_openstack: false ceph_docker_on_openstack: false
mon_docker_privileged: false mon_docker_privileged: false
mon_docker_net_host: true mon_docker_net_host: true
ceph_config_keys: [] # DON'T TOUCH ME

View File

@ -13,7 +13,7 @@
- name: stat for ceph config and keys - name: stat for ceph config and keys
stat: stat:
path: "{{ item }}" path: "{{ item }}"
with_items: ceph_config_keys with_items: "{{ ceph_config_keys }}"
changed_when: false changed_when: false
failed_when: false failed_when: false
register: statleftover register: statleftover
@ -22,6 +22,6 @@
fail: fail:
msg: "looks like no cluster is running but ceph files are present, please remove them" msg: "looks like no cluster is running but ceph files are present, please remove them"
with_together: with_together:
- ceph_config_keys - "{{ ceph_config_keys }}"
- statleftover.results - "{{ statleftover.results }}"
when: item.1.stat.exists == true when: item.1.stat.exists == true

View File

@ -5,6 +5,6 @@
dest: "{{ fetch_directory }}/docker_mon_files/{{ item.0 }}" dest: "{{ fetch_directory }}/docker_mon_files/{{ item.0 }}"
flat: yes flat: yes
with_together: with_together:
- ceph_config_keys - "{{ ceph_config_keys }}"
- statconfig.results - "{{ statconfig.results }}"
when: item.1.stat.exists == false when: item.1.stat.exists == false

View File

@ -12,7 +12,7 @@
- name: stat for ceph config and keys - name: stat for ceph config and keys
local_action: stat path={{ fetch_directory }}/docker_mon_files/{{ item }} local_action: stat path={{ fetch_directory }}/docker_mon_files/{{ item }}
with_items: ceph_config_keys with_items: "{{ ceph_config_keys }}"
changed_when: false changed_when: false
become: false become: false
failed_when: false failed_when: false
@ -27,6 +27,6 @@
mode: 0644 mode: 0644
changed_when: false changed_when: false
with_together: with_together:
- ceph_config_keys - "{{ ceph_config_keys }}"
- statconfig.results - "{{ statconfig.results }}"
when: item.1.stat.exists == true when: item.1.stat.exists == true

View File

@ -8,5 +8,5 @@
command: ceph --cluster {{ cluster }} osd pool set {{ item[0] }} {{ item[1] }} true command: ceph --cluster {{ cluster }} osd pool set {{ item[0] }} {{ item[1] }} true
with_nested: with_nested:
- "{{ ceph_pools.stdout_lines|default([]) }}" - "{{ ceph_pools.stdout_lines|default([]) }}"
- secure_cluster_flags - "{{ secure_cluster_flags }}"
when: ceph_release_num.{{ ceph_release }} >= ceph_release_num.hammer when: ceph_release_num.{{ ceph_release }} >= ceph_release_num.hammer

View File

@ -11,6 +11,7 @@ fetch_directory: fetch/
# #
cephx: true cephx: true
####################### #######################
# Access type options # # Access type options #
####################### #######################
@ -81,3 +82,4 @@ ceph_nfs_docker_imagename: ganesha
ceph_nfs_docker_image_tag: latest ceph_nfs_docker_image_tag: latest
#ceph_nfs_docker_extra_env: "GANESHA_EPOCH={{ ganesha_epoch }}" # comma separated variables #ceph_nfs_docker_extra_env: "GANESHA_EPOCH={{ ganesha_epoch }}" # comma separated variables
ceph_docker_on_openstack: false ceph_docker_on_openstack: false
ceph_config_keys: [] # DON'T TOUCH ME

View File

@ -11,7 +11,7 @@
- name: stat for ceph config and keys - name: stat for ceph config and keys
stat: stat:
path: "{{ item }}" path: "{{ item }}"
with_items: ceph_config_keys with_items: "{{ ceph_config_keys }}"
changed_when: false changed_when: false
failed_when: false failed_when: false
register: statleftover register: statleftover
@ -20,6 +20,6 @@
fail: fail:
msg: "looks like no cluster is running but ceph files are present, please remove them" msg: "looks like no cluster is running but ceph files are present, please remove them"
with_together: with_together:
- ceph_config_keys - "{{ ceph_config_keys }}"
- statleftover.results - "{{ statleftover.results }}"
when: item.1.stat.exists == true when: item.1.stat.exists == true

View File

@ -8,7 +8,7 @@
- name: stat for config and keys - name: stat for config and keys
local_action: stat path={{ fetch_directory }}/docker_mon_files/{{ item }} local_action: stat path={{ fetch_directory }}/docker_mon_files/{{ item }}
with_items: ceph_config_keys with_items: "{{ ceph_config_keys }}"
changed_when: false changed_when: false
become: false become: false
failed_when: false failed_when: false
@ -23,6 +23,6 @@
mode: 0644 mode: 0644
changed_when: false changed_when: false
with_together: with_together:
- ceph_config_keys - "{{ ceph_config_keys }}"
- statconfig.results - "{{ statconfig.results }}"
when: item.1.stat.exists == true when: item.1.stat.exists == true

View File

@ -6,7 +6,7 @@
- name: stat for config and keys - name: stat for config and keys
local_action: stat path={{ fetch_directory }}/docker_mon_files/{{ item }} local_action: stat path={{ fetch_directory }}/docker_mon_files/{{ item }}
with_items: nfs_config_keys with_items: "{{ nfs_config_keys }}"
changed_when: false changed_when: false
become: false become: false
failed_when: false failed_when: false
@ -21,8 +21,8 @@
mode: 0644 mode: 0644
changed_when: false changed_when: false
with_together: with_together:
- nfs_config_keys - "{{ nfs_config_keys }}"
- statconfig.results - "{{ statconfig.results }}"
when: item.1.stat.exists == true when: item.1.stat.exists == true
- name: push ganesha files to the ansible server - name: push ganesha files to the ansible server
@ -31,6 +31,6 @@
dest: "{{ fetch_directory }}/docker_mon_files/{{ item.0 }}" dest: "{{ fetch_directory }}/docker_mon_files/{{ item.0 }}"
flat: yes flat: yes
with_together: with_together:
- nfs_config_keys - "{{ nfs_config_keys }}"
- statconfig.results - "{{ statconfig.results }}"
when: item.1.stat.exists == false when: item.1.stat.exists == false

View File

@ -175,3 +175,4 @@ ceph_osd_docker_extra_env: "CEPH_DAEMON=OSD_CEPH_DISK_ACTIVATE" # comma separate
#ceph_osd_docker_devices: #ceph_osd_docker_devices:
# - /dev/sdb # - /dev/sdb
ceph_docker_on_openstack: false ceph_docker_on_openstack: false
ceph_config_keys: [] # DON'T TOUCH ME

View File

@ -5,7 +5,7 @@
- name: automatically activate osd disk(s) without partitions - name: automatically activate osd disk(s) without partitions
command: ceph-disk activate "/dev/{{ item.key | regex_replace('^(\/dev\/cciss\/c[0-9]{1}d[0-9]{1})$', '\\1p') }}1" command: ceph-disk activate "/dev/{{ item.key | regex_replace('^(\/dev\/cciss\/c[0-9]{1}d[0-9]{1})$', '\\1p') }}1"
ignore_errors: true ignore_errors: true
with_dict: ansible_devices with_dict: "{{ ansible_devices }}"
when: when:
- ansible_devices is defined - ansible_devices is defined
- item.value.removable == "0" - item.value.removable == "0"
@ -30,7 +30,7 @@
- name: automatically activate osd disk(s) without partitions (dmcrypt) - name: automatically activate osd disk(s) without partitions (dmcrypt)
command: ceph-disk activate --dmcrypt "/dev/{{ item.key }}" command: ceph-disk activate --dmcrypt "/dev/{{ item.key }}"
ignore_errors: true ignore_errors: true
with_dict: ansible_devices with_dict: "{{ ansible_devices }}"
when: when:
- ansible_devices is defined - ansible_devices is defined
- item.value.removable == "0" - item.value.removable == "0"

View File

@ -11,7 +11,7 @@
- name: check the partition status of the osd disks (autodiscover disks) - name: check the partition status of the osd disks (autodiscover disks)
shell: "parted --script /dev/{{ item.key }} print > /dev/null 2>&1" shell: "parted --script /dev/{{ item.key }} print > /dev/null 2>&1"
with_dict: '{{ ansible_devices }}' with_dict: "{{ ansible_devices }}"
changed_when: false changed_when: false
failed_when: false failed_when: false
register: osd_partition_status_results register: osd_partition_status_results

View File

@ -13,7 +13,7 @@
- name: stat for ceph config and keys - name: stat for ceph config and keys
stat: stat:
path: "{{ item }}" path: "{{ item }}"
with_items: ceph_config_keys with_items: "{{ ceph_config_keys }}"
changed_when: false changed_when: false
failed_when: false failed_when: false
register: statleftover register: statleftover
@ -22,6 +22,6 @@
fail: fail:
msg: "looks like no cluster is running but ceph files are present, please remove them" msg: "looks like no cluster is running but ceph files are present, please remove them"
with_together: with_together:
- ceph_config_keys - "{{ ceph_config_keys }}"
- statleftover.results - "{{ statleftover.results }}"
when: item.1.stat.exists == true when: item.1.stat.exists == true

View File

@ -10,12 +10,11 @@
wait_for wait_for
path="{{ playbook_dir }}/{{ fetch_directory }}/docker_mon_files/{{ item.0 }}" path="{{ playbook_dir }}/{{ fetch_directory }}/docker_mon_files/{{ item.0 }}"
become: false become: false
with_together: with_together: "{{ ceph_config_keys }}"
- ceph_config_keys
- name: stat for ceph config and keys - name: stat for ceph config and keys
local_action: stat path={{ fetch_directory }}/docker_mon_files/{{ item }} local_action: stat path={{ fetch_directory }}/docker_mon_files/{{ item }}
with_items: ceph_config_keys with_items: "{{ ceph_config_keys }}"
changed_when: false changed_when: false
become: false become: false
failed_when: false failed_when: false
@ -29,5 +28,4 @@
group: root group: root
mode: 0644 mode: 0644
changed_when: false changed_when: false
with_together: with_together: "{{ ceph_config_keys }}"
- ceph_config_keys

View File

@ -12,7 +12,7 @@
- name: verify if the disk was already prepared - name: verify if the disk was already prepared
shell: "lsblk -o PARTLABEL {{ item }} | grep -sq 'ceph'" shell: "lsblk -o PARTLABEL {{ item }} | grep -sq 'ceph'"
failed_when: false failed_when: false
with_items: ceph_osd_docker_devices with_items: "{{ ceph_osd_docker_devices }}"
register: osd_prepared register: osd_prepared
# use shell rather than docker module # use shell rather than docker module
@ -34,8 +34,8 @@
-e CEPH_DAEMON=OSD_CEPH_DISK_PREPARE \ -e CEPH_DAEMON=OSD_CEPH_DISK_PREPARE \
"{{ ceph_osd_docker_username }}/{{ ceph_osd_docker_imagename }}:{{ ceph_osd_docker_image_tag }}" "{{ ceph_osd_docker_username }}/{{ ceph_osd_docker_imagename }}:{{ ceph_osd_docker_image_tag }}"
with_together: with_together:
- ceph_osd_docker_devices - "{{ ceph_osd_docker_devices }}"
- osd_prepared.results - "{{ osd_prepared.results }}"
when: when:
- 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
@ -58,8 +58,8 @@
-e KV_PORT={{kv_port}} \ -e KV_PORT={{kv_port}} \
"{{ ceph_osd_docker_username }}/{{ ceph_osd_docker_imagename }}:{{ ceph_osd_docker_image_tag }}" \ "{{ ceph_osd_docker_username }}/{{ ceph_osd_docker_imagename }}:{{ ceph_osd_docker_image_tag }}" \
with_together: with_together:
- ceph_osd_docker_devices - "{{ ceph_osd_docker_devices }}"
- osd_prepared.results - "{{ osd_prepared.results }}"
when: when:
- 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
@ -81,7 +81,7 @@
shell: systemctl enable ceph-osd@{{ item | basename }}.service shell: systemctl enable ceph-osd@{{ item | basename }}.service
failed_when: false failed_when: false
changed_when: false changed_when: false
with_items: ceph_osd_docker_devices with_items: "{{ ceph_osd_docker_devices }}"
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
- name: reload systemd unit files - name: reload systemd unit files
@ -96,7 +96,7 @@
state: started state: started
enabled: yes enabled: yes
changed_when: false changed_when: false
with_items: ceph_osd_docker_devices with_items: "{{ ceph_osd_docker_devices }}"
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
- name: run the ceph osd docker image - name: run the ceph osd docker image
@ -109,7 +109,7 @@
privileged: yes privileged: yes
env: "OSD_DEVICE={{ item }},{{ ceph_osd_docker_extra_env }}" env: "OSD_DEVICE={{ item }},{{ ceph_osd_docker_extra_env }}"
volumes: "/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph,/etc/localtime:/etc/localtime:ro,/dev:/dev,/run:/run" volumes: "/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph,/etc/localtime:/etc/localtime:ro,/dev:/dev,/run:/run"
with_items: ceph_osd_docker_devices with_items: "{{ ceph_osd_docker_devices }}"
when: when:
- ansible_os_family != 'RedHat' - ansible_os_family != 'RedHat'
- ansible_os_family != 'CoreOS' - ansible_os_family != 'CoreOS'
@ -125,9 +125,9 @@
privileged: yes privileged: yes
env: "KV_TYPE={{kv_type}},KV_IP={{kv_endpoint}},OSD_DEVICE={{ item }},{{ ceph_osd_docker_extra_env }}" env: "KV_TYPE={{kv_type}},KV_IP={{kv_endpoint}},OSD_DEVICE={{ item }},{{ ceph_osd_docker_extra_env }}"
volumes: "/etc/localtime:/etc/localtime:ro,/dev/:/dev/" volumes: "/etc/localtime:/etc/localtime:ro,/dev/:/dev/"
with_items: ceph_osd_docker_devices with_items: "{{ ceph_osd_docker_devices }}"
when: when:
- ansible_os_family != 'RedHat' - ansible_os_family != 'RedHat'
- ansible_os_family != 'CoreOS' - ansible_os_family != 'CoreOS'
- osd_containerized_deployment_with_kv - osd_containerized_deployment_with_kv

View File

@ -1,7 +1,7 @@
--- ---
- name: get osd path - name: get osd path
shell: "df | grep {{ item }} | awk '{print $6}'" shell: "df | grep {{ item }} | awk '{print $6}'"
with_items: devices with_items: "{{ devices }}"
changed_when: false changed_when: false
failed_when: false failed_when: false
register: osd_path register: osd_path
@ -9,7 +9,7 @@
- name: get osd id - name: get osd id
command: cat {{ item.stdout }}/whoami command: cat {{ item.stdout }}/whoami
with_items: osd_path.results with_items: "{{ osd_path.results }}"
changed_when: false changed_when: false
failed_when: false failed_when: false
register: osd_id_non_dir_scenario register: osd_id_non_dir_scenario
@ -17,7 +17,7 @@
- name: get osd id for directory scenario - name: get osd id for directory scenario
command: cat {{ item.stdout }}/whoami command: cat {{ item.stdout }}/whoami
with_items: osd_directories with_items: "{{ osd_directories }}"
changed_when: false changed_when: false
failed_when: false failed_when: false
register: osd_id_dir_scenario register: osd_id_dir_scenario
@ -47,7 +47,7 @@
owner: "{{ dir_owner }}" owner: "{{ dir_owner }}"
group: "{{ dir_group }}" group: "{{ dir_group }}"
mode: "{{ activate_file_mode }}" mode: "{{ activate_file_mode }}"
with_items: combined_osd_id.results with_items: "{{ combined_osd_id.results }}"
- name: copy {{ cluster }}.conf for assembling - name: copy {{ cluster }}.conf for assembling
command: cp /etc/ceph/{{ cluster }}.conf /etc/ceph/ceph.d/ command: cp /etc/ceph/{{ cluster }}.conf /etc/ceph/ceph.d/

View File

@ -12,7 +12,7 @@
- name: automatic prepare osd disk(s) without partitions - name: automatic prepare osd disk(s) without partitions
command: ceph-disk prepare --bluestore --cluster "{{ cluster }}" "/dev/{{ item.key }}" command: ceph-disk prepare --bluestore --cluster "{{ cluster }}" "/dev/{{ item.key }}"
register: prepared_osds register: prepared_osds
with_dict: ansible_devices with_dict: "{{ ansible_devices }}"
when: when:
- ansible_devices is defined - ansible_devices is defined
- item.value.removable == "0" - item.value.removable == "0"
@ -23,9 +23,9 @@
- name: manually prepare osd disk(s) - name: manually prepare osd disk(s)
command: ceph-disk prepare --bluestore --cluster "{{ cluster }}" "{{ item.2 }}" command: ceph-disk prepare --bluestore --cluster "{{ cluster }}" "{{ item.2 }}"
with_together: with_together:
- parted_results.results - "{{ parted_results.results }}"
- ispartition_results.results - "{{ ispartition_results.results }}"
- devices - "{{ devices }}"
when: when:
- not item.0.get("skipped") - not item.0.get("skipped")
- not item.1.get("skipped") - not item.1.get("skipped")

View File

@ -12,10 +12,10 @@
- name: prepare osd disk(s) - name: prepare osd disk(s)
command: "ceph-disk prepare --dmcrypt --cluster {{ cluster }} {{ item.2 }} {{ item.3 }}" command: "ceph-disk prepare --dmcrypt --cluster {{ cluster }} {{ item.2 }} {{ item.3 }}"
with_together: with_together:
- parted_results.results - "{{ parted_results.results }}"
- ispartition_results.results - "{{ ispartition_results.results }}"
- devices - "{{ devices }}"
- raw_journal_devices - "{{ raw_journal_devices }}"
changed_when: false changed_when: false
when: when:
- not item.0.get("skipped") - not item.0.get("skipped")

View File

@ -11,7 +11,7 @@
# failed, this is why we check if the device is a partition too. # failed, this is why we check if the device is a partition too.
- name: automatic prepare osd disk(s) without partitions (dmcrypt) - name: automatic prepare osd disk(s) without partitions (dmcrypt)
command: ceph-disk prepare --dmcrypt --cluster "{{ cluster }}" "/dev/{{ item.key }}" command: ceph-disk prepare --dmcrypt --cluster "{{ cluster }}" "/dev/{{ item.key }}"
with_dict: ansible_devices with_dict: "{{ ansible_devices }}"
when: when:
- ansible_devices is defined - ansible_devices is defined
- item.value.removable == "0" - item.value.removable == "0"
@ -22,9 +22,9 @@
- name: manually prepare osd disk(s) (dmcrypt) - name: manually prepare osd disk(s) (dmcrypt)
command: ceph-disk prepare --dmcrypt --cluster "{{ cluster }}" "{{ item.2 }}" command: ceph-disk prepare --dmcrypt --cluster "{{ cluster }}" "{{ item.2 }}"
with_together: with_together:
- parted_results.results - "{{ parted_results.results }}"
- ispartition_results.results - "{{ ispartition_results.results }}"
- devices - "{{ devices }}"
when: when:
- not item.0.get("skipped") - not item.0.get("skipped")
- not item.1.get("skipped") - not item.1.get("skipped")

View File

@ -12,7 +12,7 @@
- name: automatic prepare osd disk(s) without partitions - name: automatic prepare osd disk(s) without partitions
command: ceph-disk prepare --cluster "{{ cluster }}" "/dev/{{ item.key }}" command: ceph-disk prepare --cluster "{{ cluster }}" "/dev/{{ item.key }}"
register: prepared_osds register: prepared_osds
with_dict: ansible_devices with_dict: "{{ ansible_devices }}"
when: when:
- ansible_devices is defined - ansible_devices is defined
- item.value.removable == "0" - item.value.removable == "0"
@ -23,9 +23,9 @@
- name: manually prepare osd disk(s) - name: manually prepare osd disk(s)
command: "ceph-disk prepare --cluster {{ cluster }} {{ item.2 }}" command: "ceph-disk prepare --cluster {{ cluster }} {{ item.2 }}"
with_together: with_together:
- parted_results.results - "{{ parted_results.results }}"
- ispartition_results.results - "{{ ispartition_results.results }}"
- devices - "{{ devices }}"
when: when:
- not item.0.get("skipped") - not item.0.get("skipped")
- not item.1.get("skipped") - not item.1.get("skipped")

View File

@ -10,20 +10,20 @@
state: directory state: directory
owner: "{{ dir_owner }}" owner: "{{ dir_owner }}"
group: "{{ dir_group }}" group: "{{ dir_group }}"
with_items: osd_directories with_items: "{{ osd_directories }}"
# NOTE (leseb): the prepare process must be parallelized somehow... # NOTE (leseb): the prepare process must be parallelized somehow...
# if you have 64 disks with 4TB each, this will take a while # if you have 64 disks with 4TB each, this will take a while
# since Ansible will sequential process the loop # since Ansible will sequential process the loop
- name: prepare OSD disk(s) - name: prepare OSD disk(s)
command: "ceph-disk prepare --cluster {{ cluster }} {{ item }}" command: "ceph-disk prepare --cluster {{ cluster }} {{ item }}"
with_items: osd_directories with_items: "{{ osd_directories }}"
changed_when: false changed_when: false
when: osd_directory when: osd_directory
- name: activate OSD(s) - name: activate OSD(s)
command: "ceph-disk activate {{ item }}" command: "ceph-disk activate {{ item }}"
with_items: osd_directories with_items: "{{ osd_directories }}"
changed_when: false changed_when: false
- name: start and add that the OSD service to the init sequence - name: start and add that the OSD service to the init sequence

View File

@ -3,6 +3,7 @@
# SETUP # # SETUP #
######### #########
# NOTE (leseb): the rbd-mirror daemon needs a user to start # NOTE (leseb): the rbd-mirror daemon needs a user to start
# because it has to authenticate with the local cluster. # because it has to authenticate with the local cluster.
# By default, using the admin user is fine, so you should not # By default, using the admin user is fine, so you should not
@ -41,3 +42,4 @@ ceph_rbd_mirror_docker_username: ceph
ceph_rbd_mirror_docker_imagename: daemon ceph_rbd_mirror_docker_imagename: daemon
ceph_rbd_mirror_docker_image_tag: latest ceph_rbd_mirror_docker_image_tag: latest
ceph_docker_on_openstack: false ceph_docker_on_openstack: false
ceph_config_keys: [] # DON'T TOUCH ME

View File

@ -13,7 +13,7 @@
- name: stat for ceph config and keys - name: stat for ceph config and keys
stat: stat:
path: "{{ item }}" path: "{{ item }}"
with_items: ceph_config_keys with_items: "{{ ceph_config_keys }}"
changed_when: false changed_when: false
failed_when: false failed_when: false
register: statleftover register: statleftover
@ -22,6 +22,6 @@
fail: fail:
msg: "looks like no cluster is running but ceph files are present, please remove them" msg: "looks like no cluster is running but ceph files are present, please remove them"
with_together: with_together:
- ceph_config_keys - "{{ ceph_config_keys }}"
- statleftover.results - "{{ statleftover.results }}"
when: item.1.stat.exists == true when: item.1.stat.exists == true

View File

@ -9,7 +9,7 @@
- name: stat for ceph config and keys - name: stat for ceph config and keys
local_action: stat path={{ fetch_directory }}/docker_mon_files/{{ item }} local_action: stat path={{ fetch_directory }}/docker_mon_files/{{ item }}
with_items: ceph_config_keys with_items: "{{ ceph_config_keys }}"
changed_when: false changed_when: false
become: false become: false
failed_when: false failed_when: false
@ -24,6 +24,6 @@
mode: 0644 mode: 0644
changed_when: false changed_when: false
with_together: with_together:
- ceph_config_keys - "{{ ceph_config_keys }}"
- statconfig.results - "{{ statconfig.results }}"
when: item.1.stat.exists == true when: item.1.stat.exists == true

View File

@ -18,3 +18,4 @@ ceph_restapi_docker_imagename: daemon
ceph_restapi_docker_image_tag: latest ceph_restapi_docker_image_tag: latest
ceph_restapi_docker_extra_env: "RESTAPI_IP=0.0.0.0" # comma separated variables ceph_restapi_docker_extra_env: "RESTAPI_IP=0.0.0.0" # comma separated variables
ceph_docker_on_openstack: false ceph_docker_on_openstack: false
ceph_config_keys: [] # DON'T TOUCH ME

View File

@ -7,7 +7,7 @@
- name: stat for ceph config and keys - name: stat for ceph config and keys
local_action: stat path={{ fetch_directory }}/docker_mon_files/{{ item }} local_action: stat path={{ fetch_directory }}/docker_mon_files/{{ item }}
with_items: ceph_config_keys with_items: "{{ ceph_config_keys }}"
changed_when: false changed_when: false
become: false become: false
ignore_errors: true ignore_errors: true
@ -22,6 +22,6 @@
mode: 0644 mode: 0644
changed_when: false changed_when: false
with_together: with_together:
- ceph_config_keys - "{{ ceph_config_keys }}"
- statconfig.results - "{{ statconfig.results }}"
when: item.1.stat.exists == true when: item.1.stat.exists == true

View File

@ -36,3 +36,4 @@ ceph_rgw_docker_imagename: daemon
ceph_rgw_docker_image_tag: latest ceph_rgw_docker_image_tag: latest
ceph_rgw_docker_extra_env: "RGW_CIVETWEB_PORT={{ ceph_rgw_civetweb_port }}" # comma separated variables ceph_rgw_docker_extra_env: "RGW_CIVETWEB_PORT={{ ceph_rgw_civetweb_port }}" # comma separated variables
ceph_docker_on_openstack: false ceph_docker_on_openstack: false
ceph_config_keys: [] # DON'T TOUCH ME

View File

@ -13,7 +13,7 @@
- name: stat for ceph config and keys - name: stat for ceph config and keys
stat: stat:
path: "{{ item }}" path: "{{ item }}"
with_items: ceph_config_keys with_items: "{{ ceph_config_keys }}"
changed_when: false changed_when: false
failed_when: false failed_when: false
register: statleftover register: statleftover
@ -22,6 +22,6 @@
fail: fail:
msg: "looks like no cluster is running but ceph files are present, please remove them" msg: "looks like no cluster is running but ceph files are present, please remove them"
with_together: with_together:
- ceph_config_keys - "{{ ceph_config_keys }}"
- statleftover.results - "{{ statleftover.results }}"
when: item.1.stat.exists == true when: item.1.stat.exists == true

View File

@ -13,7 +13,7 @@
- name: stat for config and keys - name: stat for config and keys
local_action: stat path={{ fetch_directory }}/docker_mon_files/{{ item }} local_action: stat path={{ fetch_directory }}/docker_mon_files/{{ item }}
with_items: rgw_config_keys with_items: "{{ rgw_config_keys }}"
changed_when: false changed_when: false
become: false become: false
failed_when: false failed_when: false
@ -28,8 +28,8 @@
dest: "{{ fetch_directory }}/docker_mon_files/var/lib/ceph/radosgw/keyring" dest: "{{ fetch_directory }}/docker_mon_files/var/lib/ceph/radosgw/keyring"
flat: yes flat: yes
with_together: with_together:
- rgw_config_keys - "{{ rgw_config_keys }}"
- statconfig.results - "{{ statconfig.results }}"
when: when:
- nfs_obj_gw - nfs_obj_gw
- item.1.stat.exists == false - item.1.stat.exists == false

View File

@ -7,7 +7,7 @@
- name: stat for ceph config and keys - name: stat for ceph config and keys
local_action: stat path={{ fetch_directory }}/docker_mon_files/{{ item }} local_action: stat path={{ fetch_directory }}/docker_mon_files/{{ item }}
with_items: ceph_config_keys with_items: "{{ ceph_config_keys }}"
changed_when: false changed_when: false
become: false become: false
ignore_errors: true ignore_errors: true
@ -22,6 +22,6 @@
mode: 0644 mode: 0644
changed_when: false changed_when: false
with_together: with_together:
- ceph_config_keys - "{{ ceph_config_keys }}"
- statconfig.results - "{{ statconfig.results }}"
when: item.1.stat.exists == true when: item.1.stat.exists == true