- name: restart ceph mons with systemd
service:
- name: ceph-mon@{{ ansible_hostname }}
+ name: ceph-mon@{{ monitor_name }}
state: restarted
when:
socket.rc == 0 and
- name: restart ceph mdss with systemd
service:
- name: ceph-mds@{{ ansible_hostname }}
+ name: ceph-mds@{{ mds_name }}
state: restarted
when:
socket.rc == 0 and
[mon.{{ hostvars[host]['ansible_fqdn'] }}]
host = {{ hostvars[host]['ansible_fqdn'] }}
mon addr = {{ hostvars[host]['ansible_' + (hostvars[host]['monitor_interface'] if hostvars[host]['monitor_interface'] is defined else monitor_interface) ]['ipv4']['address'] }}
-{% else %}
+{% elif hostvars[host]['ansible_hostname'] is defined %}
[mon.{{ hostvars[host]['ansible_hostname'] }}]
host = {{ hostvars[host]['ansible_hostname'] }}
mon addr = {{ hostvars[host]['ansible_' + (hostvars[host]['monitor_interface'] if hostvars[host]['monitor_interface'] is defined else monitor_interface) ]['ipv4']['address'] }}
{% if hostvars[host]['ansible_fqdn'] is defined and mds_use_fqdn %}
[mds.{{ hostvars[host]['ansible_fqdn'] }}]
host = {{ hostvars[host]['ansible_fqdn'] }}
-{% else %}
+{% elif hostvars[host]['ansible_hostname'] is defined %}
[mds.{{ hostvars[host]['ansible_hostname'] }}]
host = {{ hostvars[host]['ansible_hostname'] }}
{% endif %}
{% endfor %}
+{% endif %}
{% if enable_debug_mds %}
debug mds = {{ debug_mds_level }}
debug mds balancer = {{ debug_mds_level }}
debug mds log = {{ debug_mds_level }}
debug mds migrator = {{ debug_mds_level }}
{% endif %}
-{% endif %}
{% if groups[rgw_group_name] is defined %}
{% for host in groups[rgw_group_name] %}
---
+- set_fact:
+ mds_name: "{{ ansible_hostname }}"
+ when: not mds_use_fqdn
+
+- set_fact:
+ mds_name: "{{ ansible_fqdn }}"
+ when: mds_use_fqdn
+
- name: create bootstrap-mds directory
file:
path: /var/lib/ceph/bootstrap-mds/
- name: create mds directory
file:
- path: /var/lib/ceph/mds/ceph-{{ ansible_hostname }}
+ path: /var/lib/ceph/mds/ceph-{{ mds_name }}
state: directory
owner: "{{ dir_owner }}"
group: "{{ dir_group }}"
mode: "{{ dir_mode }}"
- name: create mds keyring
- command: ceph --cluster ceph --name client.bootstrap-mds --keyring /var/lib/ceph/bootstrap-mds/ceph.keyring auth get-or-create mds.{{ ansible_hostname }} osd 'allow rwx' mds 'allow' mon 'allow profile mds' -o /var/lib/ceph/mds/ceph-{{ ansible_hostname }}/keyring
+ command: ceph --cluster ceph --name client.bootstrap-mds --keyring /var/lib/ceph/bootstrap-mds/ceph.keyring auth get-or-create mds.{{ mds_name }} osd 'allow rwx' mds 'allow' mon 'allow profile mds' -o /var/lib/ceph/mds/ceph-{{ mds_name }}/keyring
args:
- creates: /var/lib/ceph/mds/ceph-{{ ansible_hostname }}/keyring
+ creates: /var/lib/ceph/mds/ceph-{{ mds_name }}/keyring
changed_when: false
when: cephx
- name: set mds key permissions
file:
- path: /var/lib/ceph/mds/ceph-{{ ansible_hostname }}/keyring
+ path: /var/lib/ceph/mds/ceph-{{ mds_name }}/keyring
mode: "{{ key_mode }}"
owner: "{{ key_owner }}"
group: "{{ key_group }}"
- name: activate metadata server with upstart
file:
- path: /var/lib/ceph/mds/ceph-{{ ansible_hostname }}/{{ item }}
+ path: /var/lib/ceph/mds/ceph-{{ mds_name }}/{{ item }}
state: touch
owner: "{{ activate_file_owner }}"
group: "{{ activate_file_group }}"
- name: activate metadata server with sysvinit
file:
- path: /var/lib/ceph/mds/ceph-{{ ansible_hostname }}/{{ item }}
+ path: /var/lib/ceph/mds/ceph-{{ mds_name }}/{{ item }}
state: touch
owner: "{{ activate_file_owner }}"
group: "{{ activate_file_group }}"
- name: enable systemd unit file for mds instance (for or after infernalis)
file:
src: /usr/lib/systemd/system/ceph-mds@.service
- dest: /etc/systemd/system/multi-user.target.wants/ceph-mds@{{ ansible_hostname }}.service
+ dest: /etc/systemd/system/multi-user.target.wants/ceph-mds@{{ mds_name }}.service
state: link
changed_when: false
failed_when: false
name: ceph-mds
state: started
enabled: yes
- args: "id={{ ansible_hostname }}"
+ args: "id={{ mds_name }}"
changed_when: false
when: ansible_distribution == "Ubuntu"
name: ceph
state: started
enabled: yes
- args: mds.{{ ansible_hostname }}
+ args: mds.{{ mds_name }}
changed_when: false
when:
ansible_distribution != "Ubuntu" and
- name: start and add that the metadata service to the init sequence (for or after infernalis)
service:
- name: ceph-mds@{{ ansible_hostname }}
+ name: ceph-mds@{{ mds_name }}
state: started
enabled: yes
changed_when: false
become: false
when: cephx
+- set_fact:
+ monitor_name: "{{ ansible_hostname }}"
+ when: not mon_use_fqdn
+
+- set_fact:
+ monitor_name: "{{ ansible_fqdn }}"
+ when: mon_use_fqdn
+
- name: create monitor initial keyring
- command: ceph-authtool /var/lib/ceph/tmp/keyring.mon.{{ ansible_hostname }} --create-keyring --name=mon. --add-key={{ monitor_secret }} --cap mon 'allow *'
+ command: ceph-authtool /var/lib/ceph/tmp/keyring.mon.{{ monitor_name }} --create-keyring --name=mon. --add-key={{ monitor_secret }} --cap mon 'allow *'
args:
- creates: /var/lib/ceph/tmp/keyring.mon.{{ ansible_hostname }}
+ creates: /var/lib/ceph/tmp/keyring.mon.{{ monitor_name }}
when: cephx
- name: set initial monitor key permissions
file:
- path: /var/lib/ceph/tmp/keyring.mon.{{ ansible_hostname }}
+ path: /var/lib/ceph/tmp/keyring.mon.{{ monitor_name }}
mode: "{{ key_mode }}"
owner: "{{ key_owner }}"
group: "{{ key_group }}"
- name: create monitor directory
file:
- path: /var/lib/ceph/mon/ceph-{{ ansible_hostname }}
+ path: /var/lib/ceph/mon/ceph-{{ monitor_name }}
state: directory
owner: "{{ dir_owner }}"
group: "{{ dir_group }}"
mode: "{{ dir_mode }}"
- name: ceph monitor mkfs with keyring (for or after infernalis release)
- command: ceph-mon --setuser ceph --setgroup ceph --mkfs -i {{ ansible_hostname }} --fsid {{ fsid }} --keyring /var/lib/ceph/tmp/keyring.mon.{{ ansible_hostname }}
+ command: ceph-mon --setuser ceph --setgroup ceph --mkfs -i {{ monitor_name }} --fsid {{ fsid }} --keyring /var/lib/ceph/tmp/keyring.mon.{{ monitor_name }}
args:
- creates: /var/lib/ceph/mon/ceph-{{ ansible_hostname }}/keyring
+ creates: /var/lib/ceph/mon/ceph-{{ monitor_name }}/keyring
when:
cephx and
is_ceph_infernalis
- name: ceph monitor mkfs without keyring (for or after infernalis release)
- command: ceph-mon --setuser ceph --setgroup ceph --mkfs -i {{ ansible_hostname }} --fsid {{ fsid }}
+ command: ceph-mon --setuser ceph --setgroup ceph --mkfs -i {{ monitor_name }} --fsid {{ fsid }}
args:
- creates: /var/lib/ceph/mon/ceph-{{ ansible_hostname }}/store.db
+ creates: /var/lib/ceph/mon/ceph-{{ monitor_name }}/store.db
when:
not cephx and
is_ceph_infernalis
- name: ceph monitor mkfs with keyring (before infernalis release)
- command: ceph-mon --mkfs -i {{ ansible_hostname }} --fsid {{ fsid }} --keyring /var/lib/ceph/tmp/keyring.mon.{{ ansible_hostname }}
+ command: ceph-mon --mkfs -i {{ monitor_name }} --fsid {{ fsid }} --keyring /var/lib/ceph/tmp/keyring.mon.{{ monitor_name }}
args:
- creates: /var/lib/ceph/mon/ceph-{{ ansible_hostname }}/keyring
+ creates: /var/lib/ceph/mon/ceph-{{ monitor_name }}/keyring
when:
cephx and
not is_ceph_infernalis
- name: ceph monitor mkfs without keyring (before infernalis release)
- command: ceph-mon --mkfs -i {{ ansible_hostname }} --fsid {{ fsid }}
+ command: ceph-mon --mkfs -i {{ monitor_name }} --fsid {{ fsid }}
args:
- creates: /var/lib/ceph/mon/ceph-{{ ansible_hostname }}/store.db
+ creates: /var/lib/ceph/mon/ceph-{{ monitor_name }}/store.db
when:
not cephx and
not is_ceph_infernalis
---
- name: activate monitor with upstart
file:
- path: /var/lib/ceph/mon/ceph-{{ ansible_hostname }}/{{ item }}
+ path: /var/lib/ceph/mon/ceph-{{ monitor_name }}/{{ item }}
state: touch
owner: "{{ activate_file_owner }}"
group: "{{ activate_file_group }}"
name: ceph-mon
state: started
enabled: yes
- args: "id={{ ansible_hostname }}"
+ args: "id={{ monitor_name }}"
when: ansible_distribution == "Ubuntu"
# NOTE (leseb): somehow the service ansible module is messing things up
- name: enable systemd unit file for mon instance (for or after infernalis)
file:
src: /usr/lib/systemd/system/ceph-mon@.service
- dest: /etc/systemd/system/multi-user.target.wants/ceph-mon@{{ ansible_hostname }}.service
+ dest: /etc/systemd/system/multi-user.target.wants/ceph-mon@{{ monitor_name }}.service
state: link
changed_when: false
failed_when: false
- name: start and add that the monitor service to the init sequence (for or after infernalis)
service:
- name: ceph-mon@{{ ansible_hostname }}
+ name: ceph-mon@{{ monitor_name }}
state: started
enabled: yes
changed_when: false
is_ceph_infernalis
- name: collect admin and bootstrap keys
- command: ceph-create-keys --id {{ ansible_hostname }}
+ command: ceph-create-keys --id {{ monitor_name }}
changed_when: false
failed_when: false
when: cephx
- name: get ceph monitor version
- shell: ceph daemon mon."{{ ansible_hostname }}" version | cut -d '"' -f 4 | cut -f 1,2 -d '.'
+ shell: ceph daemon mon."{{ monitor_name }}" version | cut -d '"' -f 4 | cut -f 1,2 -d '.'
changed_when: false
failed_when: "'No such file or directory' in ceph_version.stderr"
register: ceph_version