Skip to content

Instantly share code, notes, and snippets.

@danilochilene
Last active May 21, 2018 11:26
Show Gist options
  • Save danilochilene/9d2a7bc64e6f6290ac075396840e3021 to your computer and use it in GitHub Desktop.
Save danilochilene/9d2a7bc64e6f6290ac075396840e3021 to your computer and use it in GitHub Desktop.
Ceph ansible install
---
dummy:
cluster: ceph
mon_group_name: mons
osd_group_name: osds
rgw_group_name: rgws
mgr_group_name: mgrs
check_firewall: False
ntp_service_enabled: true
ceph_origin: 'repository'
ceph_repository: 'community'
ceph_mirror: http://download.ceph.com
ceph_stable_release: luminous
ansible_dir: "/opt/ceph-ansible"
ceph_conf_key_directory: /etc/ceph
cephx: true
max_open_files: 131072
rbd_cache: "true"
rbd_cache_writethrough_until_flush: "true"
rbd_concurrent_management_ops: 20
#rbd_client_directory_owner: "libvirt-qemu"
#rbd_client_directory_group: "kvm"
#rbd_client_directory_mode: "0755"
monitor_interface: br_storage
ip_version: ipv4
public_network: 192.168.1.0/24
osd_mkfs_type: xfs
osd_mkfs_options_xfs: -f -i size=2048
osd_mount_options_xfs: noatime,largeio,inode64,swalloc
osd_objectstore: bluestore
radosgw_interface: br_storage
restapi_interface: "{{ monitor_interface }}"
restapi_address: "{{ monitor_address }}"
restapi_port: 5000
handler_health_mon_check_retries: 5
handler_health_mon_check_delay: 10
handler_health_osd_check_retries: 40
handler_health_osd_check_delay: 30
handler_health_osd_check: true
handler_health_rgw_check_retries: 5
handler_health_rgw_check_delay: 10
handler_health_rbd_mirror_check_retries: 5
handler_health_rbd_mirror_check_delay: 10
handler_health_mgr_check_retries: 5
handler_health_mgr_check_delay: 10
docker: false
sudo ceph osd pool create images 128
sudo ceph auth get-or-create client.images mon 'allow r' osd 'allow class-read object_prefix rdb_children, allow rwx pool=images' -o /etc/ceph/ceph.client.images.keyring
sudo ceph osd pool create volumes 128
sudo ceph auth get-or-create client.volumes mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=volumes, allow rx pool=images' -o /etc/ceph/ceph.client.volumes.keyring
sudo ceph osd pool create vms 128
sudo ceph auth get-or-create client.nova mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=vms, allow rx pool=images' -o /etc/ceph/ceph.client.nova.keyring
ceph auth get-or-create client.cinder mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=volumes, allow rwx pool=vms, allow rx pool=images'
ceph auth get-or-create client.glance mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=volumes, allow rwx pool=vms, allow rx pool=images'
ceph auth get-or-create client.glance mon 'profile rbd' osd 'profile rbd pool=images'
ceph auth get-or-create client.cinder mon 'profile rbd' osd 'profile rbd pool=volumes, profile rbd pool=vms, profile rbd pool=images'
ceph auth get-or-create client.cinder-backup mon 'profile rbd' osd 'profile rbd pool=backups'
[mons]
10.20.20.100
10.20.20.101
10.20.20.102
[osds]
10.20.20.100
10.20.20.101
10.20.20.102
10.20.20.103
[rgws]
10.20.20.100
[mgrs]
10.20.20.100
10.20.20.101
10.20.20.102
---
dummy:
#osd_scenario: "{{ 'collocated' if journal_collocation or dmcrypt_journal_collocation else 'non-collocated' if raw_multi_journal or dmcrypt_dedicated_journal else 'dummy' }}" # backward compatibility with stable-2.2, will disappear in stable 3.1
osd_scenario: collocated
bluestore: true
devices: []
osd_auto_discovery: True
---
# Defines deployment design and assigns role to server groups
- hosts:
- mons
- agents
- osds
- mdss
- rgws
- nfss
- restapis
- rbdmirrors
- clients
- mgrs
- iscsi-gws
gather_facts: false
tags:
- always
tasks:
# If we can't get python2 installed before any module is used we will fail
# so just try what we can to get it installed
- name: check for python2
stat:
path: /usr/bin/python
ignore_errors: yes
register: systempython2
- name: install python2 for debian based systems
raw: sudo apt-get -y install python-simplejson
ignore_errors: yes
when:
- systempython2.stat.exists is undefined or systempython2.stat.exists == false
- name: install python2 for fedora
raw: sudo dnf -y install python creates=/usr/bin/python
ignore_errors: yes
when:
- systempython2.stat.exists is undefined or systempython2.stat.exists == false
- name: gather and delegate facts
setup:
delegate_to: "{{ item }}"
delegate_facts: True
with_items: "{{ groups['all'] }}"
- name: install required packages for fedora > 23
raw: sudo dnf -y install python2-dnf libselinux-python ntp
when:
- ansible_distribution == 'Fedora'
- ansible_distribution_major_version|int >= 23
- hosts: mons
gather_facts: false
become: True
roles:
- ceph-defaults
- ceph-common
- ceph-config
- ceph-mon
- hosts: mgrs
gather_facts: false
become: True
roles:
- ceph-defaults
- ceph-common
- { role: ceph-config, when: "ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous" }
- { role: ceph-mgr, when: "ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous" }
- hosts: agents
gather_facts: false
become: True
roles:
- ceph-defaults
- ceph-common
- ceph-config
- ceph-agent
- hosts: osds
gather_facts: false
become: True
roles:
- ceph-defaults
- ceph-common
- ceph-config
- ceph-osd
- hosts: mdss
gather_facts: false
become: True
roles:
- ceph-defaults
- ceph-common
- ceph-config
- ceph-mds
- hosts: rgws
gather_facts: false
become: True
roles:
- ceph-defaults
- ceph-common
- ceph-config
- ceph-rgw
- hosts: nfss
gather_facts: false
become: True
roles:
- ceph-defaults
- ceph-common
- { role: ceph-config, when: "ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous" }
- { role: ceph-nfs, when: "ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous" }
- hosts: restapis
gather_facts: false
become: True
roles:
- ceph-defaults
- ceph-common
- ceph-config
- ceph-restapi
- hosts: rbdmirrors
gather_facts: false
become: True
roles:
- ceph-defaults
- ceph-common
- ceph-config
- ceph-rbd-mirror
- hosts: clients
gather_facts: false
become: True
roles:
- ceph-defaults
- ceph-common
- ceph-config
- ceph-client
- hosts: iscsi-gws
gather_facts: false
become: True
roles:
- ceph-defaults
- ceph-common
- { role: ceph-config, when: "ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous" }
- { role: ceph-iscsi-gw, when: "ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous" }
stable-3.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment