Skip to content

Commit c3292ed

Browse files
authored
Merge pull request #7 from merizrizal/ceph-integration
Ceph integration - part 2
2 parents 40f3662 + fca5e68 commit c3292ed

File tree

27 files changed

+98
-212
lines changed

27 files changed

+98
-212
lines changed

README.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,18 @@ Run `make -C base_image/ rebuild-base-image-ubuntu`. This will create a new Vagr
112112
3. Run `make -C controller/ start-provider-network` to create a new interface which will be used by Controller, Compute and Storage node.
113113
4. Run `make -C controller/ start-vm` to spin up 4 VMs which are 1 Controller, 2 Computes and 1 Storage node.
114114

115+
**Provision Ceph:**
116+
1. Run `source envrc` then navigate to `./ansible` directory.
117+
2. Run `ansible-playbook -i deploy_ceph/inventories/local/local.yml deploy_ceph/playbook_pre_setup.yml` to install and configure the pre-requisite packages.
118+
3. Run `ansible-playbook -i deploy_ceph/inventories/local/local.yml deploy_ceph/playbook_setup_adm.yml` to install and configure Ceph ADM service.
119+
4. Run `ansible-playbook -i deploy_ceph/inventories/local/local.yml deploy_ceph/playbook_setup_common.yml` to install and configure Ceph common packages to the other hosts.
120+
5. Run `ansible-playbook -i deploy_ceph/inventories/local/local.yml deploy_ceph/playbook_apply_osd.yml` to add the other hosts and apply the OSD.
121+
6. Run `ansible-playbook -i deploy_ceph/inventories/local/local.yml deploy_ceph/playbook_openstack_init.yml` to configure OpenStack Cinder and Nova to be able to integrate with Ceph
122+
123+
or
124+
125+
Run `ansible-playbook -i deploy_ceph/inventories/local/local.yml deploy_ceph/playbook_deploy.yml` to deploy all at once.
126+
115127
**Provision OpenStack:**
116128
1. Run `source envrc` then navigate to `./ansible` directory.
117129
2. Run `ansible-playbook -i deploy_openstack/inventories/local/local.yml deploy_openstack/playbook_pre_setup.yml` to install and configure the pre-requisite packages.
@@ -141,19 +153,6 @@ Replace `<host-external-interface>` with the actual NIC connected to the interne
141153
You can replace `<host-external-interface>` with `$(ip route get 1.1.1.1 | awk '{print $5}')` to dynamically detect your default NIC.
142154
<br>
143155

144-
145-
**Provision Ceph:**
146-
1. Run `source envrc` then navigate to `./ansible` directory.
147-
2. Run `ansible-playbook -i deploy_ceph/inventories/local/local.yml deploy_ceph/playbook_pre_setup.yml` to install and configure the pre-requisite packages.
148-
3. Run `ansible-playbook -i deploy_ceph/inventories/local/local.yml deploy_ceph/playbook_setup_adm.yml` to install and configure Ceph ADM service.
149-
4. Run `ansible-playbook -i deploy_ceph/inventories/local/local.yml deploy_ceph/playbook_setup_common.yml` to install and configure Ceph common packages to the other hosts.
150-
5. Run `ansible-playbook -i deploy_ceph/inventories/local/local.yml deploy_ceph/playbook_apply_osd.yml` to add the other hosts and apply the OSD.
151-
6. Run `ansible-playbook -i deploy_ceph/inventories/local/local.yml deploy_ceph/playbook_openstack_init.yml` to configure OpenStack Cinder and Nova to be able to integrate with Ceph
152-
153-
or
154-
155-
Run `ansible-playbook -i deploy_ceph/inventories/local/local.yml deploy_ceph/playbook_deploy.yml` to deploy all at once.
156-
157156
---
158157

159158
**CI/CD Lab Deployment**

ansible/cicd_in_openstack/inventories/local/group_vars/all/common_gitlab.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ gitlab_url: http://{{ hostvars[cicd_list.gitlab01.name].ansible_host }}
77
gitlab_api_url: "{{ gitlab_url }}/api/v4"
88

99
gitlab_runner_binary: >
10-
https://s3.dualstack.us-east-1.amazonaws.com/gitlab-runner-downloads/latest/binaries/gitlab-runner-linux-{{ arch_mapping[ansible_architecture] }}
10+
https://s3.dualstack.us-east-1.amazonaws.com/gitlab-runner-downloads/latest/binaries/gitlab-runner-linux-{{ arch_mapping[ansible_facts['architecture']] }}
1111
1212
gitlab_runner_installed: /usr/local/bin/gitlab-runner
1313
gitlab_runner_token_var: gitlab_runner_token

ansible/deploy_ceph/inventories/local/group_vars/all/common.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,8 @@ ntp_server: time.aws.com
77
ceph_pub_key_fetch_path: /tmp/fetch-ceph.pub
88
device_name: vdb
99

10-
mon_count: 3
11-
mgr_count: 2
10+
ceph_common_nodes: "{{ groups.ceph_common | default([]) }}"
11+
is_single_node: "{{ ceph_common_nodes | length == 0 }}"
12+
13+
mon_count: "{{ is_single_node | ternary(1, 3) }}"
14+
mgr_count: "{{ is_single_node | ternary(1, 2) }}"

ansible/deploy_ceph/inventories/local/local.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ lab:
88
hosts:
99
ceph01:
1010
ansible_host: "{{ ceph01.mgmtnet_ip_address }}"
11-
ceph_common:
12-
hosts:
13-
ceph02:
14-
ansible_host: "{{ ceph02.mgmtnet_ip_address }}"
15-
ceph03:
16-
ansible_host: "{{ ceph03.mgmtnet_ip_address }}"
11+
# ceph_common:
12+
# hosts:
13+
# ceph02:
14+
# ansible_host: "{{ ceph02.mgmtnet_ip_address }}"
15+
# ceph03:
16+
# ansible_host: "{{ ceph03.mgmtnet_ip_address }}"

ansible/deploy_ceph/playbook_deploy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
- name: Setup Ceph common
99
ansible.builtin.import_playbook: playbook_setup_common.yml
10+
when: not is_single_node
1011

1112
- name: Apply Ceph OSDs
1213
ansible.builtin.import_playbook: playbook_apply_osd.yml

ansible/deploy_ceph/roles/ceph_adm/tasks/add_hosts.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
cmd: ceph orch host add {{ item }} {{ node_vars.mgmtnet_ip_address }}
55
vars:
66
node_vars: "{{ lookup('ansible.builtin.vars', item) }}"
7-
loop: "{{ groups['ceph_common'] }}"
7+
loop: "{{ ceph_common_nodes }}"
88
changed_when: false
99

1010
- name: Wait hosts and its devices to be ready
@@ -15,7 +15,7 @@
1515
sleep 1
1616
done
1717
executable: /bin/bash
18-
loop: "{{ groups['ceph_common'] }}"
18+
loop: "{{ ceph_common_nodes }}"
1919
changed_when: false
2020

2121
- name: Place MON

ansible/deploy_ceph/roles/ceph_adm/tasks/add_osds.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,25 @@
33
ansible.builtin.command:
44
cmd: ceph orch daemon add osd {{ item }}:/dev/{{ device_name }}
55
register: apply_osd
6-
loop: "{{ groups['ceph_adm'] + groups['ceph_common'] }}"
6+
loop: "{{ groups.ceph_adm + ceph_common_nodes }}"
77
changed_when: apply_osd.stdout is defined and 'Created osd' in apply_osd.stdout
88

9+
- name: Set pool size limit to 1 on single_node mode
10+
ansible.builtin.shell:
11+
cmd: |
12+
ceph config set global osd_pool_default_size 1
13+
ceph config set global osd_pool_default_min_size 1
14+
executable: /bin/bash
15+
when: is_single_node
16+
changed_when: false
17+
918
- name: Create OSD pool
1019
ansible.builtin.shell:
1120
cmd: |
12-
ceph osd pool create {{ item }} 16
21+
ceph osd pool create {{ item }} {{ is_single_node | ternary(8, 16) }}
1322
ceph osd pool application enable {{ item }} rbd
1423
rbd pool init {{ item }}
24+
executable: /bin/bash
1525
loop:
1626
- images
1727
- volumes

ansible/deploy_ceph/roles/openstack/tasks/main.yml

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
cmd: >
2121
ceph auth get-or-create client.cinder
2222
mon 'profile rbd'
23-
osd 'profile rbd pool=volumes, profile rbd pool=images'
24-
mgr 'profile rbd pool=volumes, profile rbd pool=images'
23+
osd 'profile rbd pool=volumes, profile rbd pool=vms, profile rbd pool=images'
24+
mgr 'profile rbd pool=volumes, profile rbd pool=vms, profile rbd pool=images'
2525
-o /etc/ceph/ceph.client.cinder.keyring
2626
changed_when: false
2727

@@ -31,22 +31,6 @@
3131
dest: "{{ cinder_keyring_path }}"
3232
flat: true
3333

34-
- name: Create auth for Nova
35-
ansible.builtin.command:
36-
cmd: >
37-
ceph auth get-or-create client.nova
38-
mon 'profile rbd'
39-
osd 'profile rbd pool=volumes, profile rbd pool=vms, profile rbd pool=images'
40-
mgr 'profile rbd pool=volumes, profile rbd pool=vms, profile rbd pool=images'
41-
-o /etc/ceph/ceph.client.nova.keyring
42-
changed_when: false
43-
44-
- name: Fetch Nova keyring
45-
ansible.builtin.fetch:
46-
src: /etc/ceph/ceph.client.nova.keyring
47-
dest: "{{ nova_keyring_path }}"
48-
flat: true
49-
5034
- name: Fetch Ceph config
5135
ansible.builtin.fetch:
5236
src: /etc/ceph/ceph.conf

ansible/deploy_openstack/inventories/local/group_vars/all/common.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ controller01_host_addr: "{{ use_hostname | ternary(controller01.hostname, contro
99
compute01_host_addr: "{{ use_hostname | ternary(compute01.hostname, compute01.mgmtnet_ip_address) }}"
1010
storage01_host_addr: "{{ use_hostname | ternary(storage01.hostname, storage01.mgmtnet_ip_address) }}"
1111

12-
ceph_enabled: false
12+
ceph_enabled: true

ansible/deploy_openstack/roles/ceph/tasks/cinder.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
ansible.builtin.set_fact:
44
mgmtnet_ip_address: "{{ node.mgmtnet_ip_address }}"
55
vars:
6-
node: "{{ lookup('ansible.builtin.vars', ansible_hostname) }}"
6+
node: "{{ lookup('ansible.builtin.vars', ansible_facts['hostname']) }}"
77

88
- name: Reconfigure cinder.conf - set default - apply ceph
99
ansible.builtin.replace:

0 commit comments

Comments
 (0)