Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

# ansible-test output
/tests/output
/.ansible

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
6 changes: 4 additions & 2 deletions roles/cephadm/tasks/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
cmd: "cephadm shell -- ceph config set mon public_network {{ cephadm_public_network }}"
become: true
changed_when: true
when: cephadm_public_network | length > 0

- name: Set cluster network
command:
Expand All @@ -67,15 +68,16 @@

- name: Get cluster fsid
command:
cmd: "cephadm shell -- ceph fsid"
cmd: "cephadm ls --no-detail"
when: cephadm_fsid | length == 0
become: true
changed_when: false
register: cephadm_fsid_current

- name: Template out cluster.yml
vars:
fsid: "{{ cephadm_fsid if cephadm_fsid | length > 0 else cephadm_fsid_current.stdout }}"
current_fsid: "{{ cephadm_fsid_current.stdout | from_json | selectattr('name', 'search', 'mon') | map(attribute='fsid') | first }}"
fsid: "{{ cephadm_fsid if cephadm_fsid | length > 0 else current_fsid }}"
template:
src: "templates/cluster.yml.j2"
dest: "/var/run/ceph/{{ fsid }}/cephadm_cluster.yml"
Expand Down
15 changes: 15 additions & 0 deletions roles/cephadm/tasks/prechecks.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
---
- name: Assert that required Ansible groups exist
ansible.builtin.assert:
that: "'{{ item }}' in group_names"
msg: "Ansible '{{ item }}' group does not exist - please create one"
loop:
- ceph
- mons
- mgrs
- osds

- name: Assert that cephadm_public_interface is set
ansible.builtin.assert:
that: cephadm_public_interface | length > 0
msg: "Ansible Cephadm interface variable 'cephadm_public_interface' is not set"

- name: Populate service facts
service_facts:

Expand Down
2 changes: 1 addition & 1 deletion roles/cephadm/templates/cluster.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
---
service_type: host
hostname: {{ hostvars[host].ansible_facts.nodename }}
{% set cephadm_admin_interface = hostvars[host]['cephadm_admin_interface'] %}
{% set cephadm_admin_interface = hostvars[host]['cephadm_admin_interface'] | default(cephadm_admin_interface) %}
addr: {{ hostvars[host]['ansible_facts'][cephadm_admin_interface | replace('-', '_')]['ipv4']['address'] }}
labels:
{% if host in groups['mons'] %}
Expand Down
2 changes: 1 addition & 1 deletion test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ansible>=2.9
ansible-lint<7
ansible-lint<26
antsibull-changelog
mock
pytest
Expand Down
Loading