summaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_openstack_pre.yml
blob: f6d1a12de604ac91623dd82b0ccea65bf97d34ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
---

- name: create pool
  shell: ceph osd pool create {{ item }} 128
  with_items:
    - volumes
    - images
    - backups
    - vms

- name: create ceph users for openstack
  shell: 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=images'

- name: send glance key to controller nodes
  shell: ceph auth get-or-create client.glance | ssh {{ item }} sudo tee /etc/ceph/ceph.client.glance.keyring && ssh {{ item }} sudo chown glance:glance /etc/ceph/ceph.client.glance.keyring
  with_items:
    - "{{ groups['controller'] }}"

- name: send cinder key to compute nodes
  shell: ceph auth get-or-create client.cinder | ssh {{ item }} sudo tee /etc/ceph/ceph.client.cinder.keyring && ssh {{ item }} sudo chown cinder:cinder /etc/ceph/ceph.client.cinder.keyring
  with_items:
    - "{{ groups['compute'] }}"
  tags:
    - ceph_send_key

- name: copy cinder key to compute node
  shell: ceph auth get-key client.cinder | ssh {{ item }} tee client.cinder.key
  with_items:
    - "{{ groups['compute'] }}"
  tags:
    - ceph_copy_secret

- name: gen ceph uuid
  shell: uuidgen
  register: ceph_uuid
  tags:
    - ceph_copy_secret

- name: gen template secret.xml
  template: src=secret.j2 dest=~/secret.xml mode=0777
  tags:
    - ceph_copy_secret

- name: copy secret.xml to compute nodes
  shell: scp -o StrictHostKeyChecking=no ~/secret.xml {{ item }}:~/secret.xml
  with_items:
    - "{{ groups['compute'] }}"
  tags:
    - ceph_copy_secret

- name: create key for libvirt on compute nodes
  shell: ssh -o StrictHostKeyChecking=no -t {{ item }} "virsh secret-define --file secret.xml && virsh secret-set-value --secret {{ ceph_uuid.stdout_lines[0] }} --base64 \$(cat client.cinder.key) && rm client.cinder.key secret.xml"
  with_items:
    - "{{ groups['compute'] }}"
  tags:
    - ceph_copy_secret
  ignore_errors: True
class="p">, {}), $apache_postsave_cmd = undef, $haproxy_certificates_specs = hiera('tripleo::profile::base::haproxy::certificates_specs', {}), $haproxy_postsave_cmd = undef, $libvirt_certificates_specs = hiera('libvirt_certificates_specs', {}), $libvirt_postsave_cmd = undef, $mongodb_certificate_specs = hiera('mongodb_certificate_specs',{}), $mysql_certificate_specs = hiera('tripleo::profile::base::database::mysql::certificate_specs', {}), $rabbitmq_certificate_specs = hiera('tripleo::profile::base::rabbitmq::certificate_specs', {}), $etcd_certificate_specs = hiera('tripleo::profile::base::etcd::certificate_specs', {}), ) { unless empty($haproxy_certificates_specs) { $reload_haproxy = ['systemctl reload haproxy'] Class['::tripleo::certmonger::ca::crl'] ~> Haproxy::Balancermember<||> if defined(Class['::haproxy']) { Class['::tripleo::certmonger::ca::crl'] ~> Class['::haproxy'] } } else { $reload_haproxy = [] } class { '::tripleo::certmonger::ca::crl' : reload_cmds => $reload_haproxy, } Certmonger_certificate<||> -> Class['::tripleo::certmonger::ca::crl'] include ::tripleo::certmonger::ca::libvirt unless empty($apache_certificates_specs) { include ::tripleo::certmonger::apache_dirs ensure_resources('tripleo::certmonger::httpd', $apache_certificates_specs, {'postsave_cmd' => $apache_postsave_cmd}) } unless empty($libvirt_certificates_specs) { include ::tripleo::certmonger::libvirt_dirs ensure_resources('tripleo::certmonger::libvirt', $libvirt_certificates_specs, {'postsave_cmd' => $libvirt_postsave_cmd}) } unless empty($haproxy_certificates_specs) { include ::tripleo::certmonger::haproxy_dirs ensure_resources('tripleo::certmonger::haproxy', $haproxy_certificates_specs, {'postsave_cmd' => $haproxy_postsave_cmd}) # The haproxy fronends (or listen resources) depend on the certificate # existing and need to be refreshed if it changed. Tripleo::Certmonger::Haproxy<||> ~> Haproxy::Listen<||> } unless empty($mongodb_certificate_specs) { ensure_resource('class', 'tripleo::certmonger::mongodb', $mongodb_certificate_specs) } unless empty($mysql_certificate_specs) { ensure_resource('class', 'tripleo::certmonger::mysql', $mysql_certificate_specs) } unless empty($rabbitmq_certificate_specs) { ensure_resource('class', 'tripleo::certmonger::rabbitmq', $rabbitmq_certificate_specs) } unless empty($etcd_certificate_specs) { ensure_resource('class', 'tripleo::certmonger::etcd', $etcd_certificate_specs) } }