Skip to content

Commit bc58b35

Browse files
authored
Merge pull request #181 from stackhpc/mnasiadkas_fixes
Apply various fixes
2 parents 0c1c718 + 38b9e02 commit bc58b35

File tree

5 files changed

+22
-4
lines changed

5 files changed

+22
-4
lines changed

.gitignore

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

44
# ansible-test output
55
/tests/output
6+
/.ansible
67

78
# Byte-compiled / optimized / DLL files
89
__pycache__/

roles/cephadm/tasks/bootstrap.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
cmd: "cephadm shell -- ceph config set mon public_network {{ cephadm_public_network }}"
4444
become: true
4545
changed_when: true
46+
when: cephadm_public_network | length > 0
4647

4748
- name: Set cluster network
4849
command:
@@ -67,15 +68,16 @@
6768

6869
- name: Get cluster fsid
6970
command:
70-
cmd: "cephadm shell -- ceph fsid"
71+
cmd: "cephadm ls --no-detail"
7172
when: cephadm_fsid | length == 0
7273
become: true
7374
changed_when: false
7475
register: cephadm_fsid_current
7576

7677
- name: Template out cluster.yml
7778
vars:
78-
fsid: "{{ cephadm_fsid if cephadm_fsid | length > 0 else cephadm_fsid_current.stdout }}"
79+
current_fsid: "{{ cephadm_fsid_current.stdout | from_json | selectattr('name', 'search', 'mon') | map(attribute='fsid') | first }}"
80+
fsid: "{{ cephadm_fsid if cephadm_fsid | length > 0 else current_fsid }}"
7981
template:
8082
src: "templates/cluster.yml.j2"
8183
dest: "/var/run/ceph/{{ fsid }}/cephadm_cluster.yml"

roles/cephadm/tasks/prechecks.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
---
2+
- name: Assert that required Ansible groups exist
3+
ansible.builtin.assert:
4+
that: "'{{ item }}' in group_names"
5+
msg: "Ansible '{{ item }}' group does not exist - please create one"
6+
loop:
7+
- ceph
8+
- mons
9+
- mgrs
10+
- osds
11+
12+
- name: Assert that cephadm_public_interface is set
13+
ansible.builtin.assert:
14+
that: cephadm_public_interface | length > 0
15+
msg: "Ansible Cephadm interface variable 'cephadm_public_interface' is not set"
16+
217
- name: Populate service facts
318
service_facts:
419

roles/cephadm/templates/cluster.yml.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
---
33
service_type: host
44
hostname: {{ hostvars[host].ansible_facts.nodename }}
5-
{% set cephadm_admin_interface = hostvars[host]['cephadm_admin_interface'] %}
5+
{% set cephadm_admin_interface = hostvars[host].cephadm_admin_interface | default(cephadm_admin_interface) %}
66
addr: {{ hostvars[host]['ansible_facts'][cephadm_admin_interface | replace('-', '_')]['ipv4']['address'] }}
77
labels:
88
{% if host in groups['mons'] %}

test-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ansible>=2.9
2-
ansible-lint<7
2+
ansible-lint<26
33
antsibull-changelog
44
mock
55
pytest

0 commit comments

Comments
 (0)