Skip to content

Commit

Permalink
cephadm-adopt: configure repository for cephadm installation
Browse files Browse the repository at this point in the history
Configure repository for cephadm installation and use package install in both containerized and non containerized deployment

Signed-off-by: Seena Fallah <seenafallah@gmail.com>
(cherry picked from commit 339212a)
  • Loading branch information
clwluvw authored and guits committed Oct 13, 2021
1 parent f6c4101 commit 7b19748
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
33 changes: 16 additions & 17 deletions infrastructure-playbooks/cephadm-adopt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,22 @@
inventory_hostname in groups.get(iscsi_gw_group_name, []) or
inventory_hostname in groups.get(nfs_group_name, [])

- name: configure repository for installing cephadm
when: containerized_deployment | bool
vars:
ceph_origin: repository
ceph_repository: community
block:
- name: validate repository variables
import_role:
name: ceph-validate
tasks_from: check_repository.yml

- name: configure repository
import_role:
name: ceph-common
tasks_from: "configure_repository.yml"

- name: install cephadm requirements
package:
name: ['python3', 'lvm2']
Expand All @@ -156,7 +172,6 @@
name: cephadm
register: result
until: result is succeeded
when: not containerized_deployment | bool

- name: install cephadm mgr module
package:
Expand All @@ -167,22 +182,6 @@
- not containerized_deployment | bool
- mgr_group_name in group_names

- name: get cephadm from the container image
when: containerized_deployment | bool
block:
- name: create a cephadm container
command: "{{ container_binary }} create --name cephadm {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
changed_when: false

- name: cp the cephadm cli file
command: "{{ container_binary }} cp cephadm:/usr/sbin/cephadm /usr/sbin/cephadm"
args:
creates: /usr/sbin/cephadm

- name: remove the cephadm container
command: "{{ container_binary }} rm cephadm"
changed_when: false

- name: set_fact ceph_cmd
set_fact:
ceph_cmd: "{{ container_binary + ' run --rm --net=host -v /etc/ceph:/etc/ceph:z -v /var/lib/ceph:/var/lib/ceph:z -v /var/run/ceph:/var/run/ceph:z --entrypoint=ceph ' + ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else 'ceph' }} --cluster {{ cluster }}"
Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,13 @@ commands=
ansible-playbook -vv -i {changedir}/{env:INVENTORY} {toxinidir}/infrastructure-playbooks/cephadm-adopt.yml --extra-vars "\
ireallymeanit=yes \
delegate_facts_host={env:DELEGATE_FACTS_HOST:True} \
ceph_repository=dev \
"
# idempotency test
ansible-playbook -vv -i {changedir}/{env:INVENTORY} {toxinidir}/infrastructure-playbooks/cephadm-adopt.yml --extra-vars "\
ireallymeanit=yes \
delegate_facts_host={env:DELEGATE_FACTS_HOST:True} \
ceph_repository=dev \
"

[testenv]
Expand Down

0 comments on commit 7b19748

Please sign in to comment.