Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use inventory_hostname in ceph related roles and play #2164

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion ci/playbooks/multinode-customizations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -346,5 +346,5 @@
- name: Inject hostname in configuration file
become: true
ansible.builtin.hostname:
name: "{{ inventory_hostname }}.ci-rdo.local"
name: "{{ inventory_hostname }}"
use: "systemd"
1 change: 0 additions & 1 deletion playbooks/06-deploy-edpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@
(cifmw_edpm_deploy_hci | default('false') | bool) and
cifmw_architecture_scenario is undefined
}}
ceph_spec_fqdn: true
storage_network_range: 172.18.0.0/24
storage_mgmt_network_range: 172.20.0.0/24
ansible.builtin.import_playbook: ceph.yml
Expand Down
21 changes: 1 addition & 20 deletions playbooks/ceph.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,6 @@
- not _deploy_ceph | default(true)
ansible.builtin.meta: end_play

- name: Use ansible_fqdn when ceph_spec_fqdn parameter is true
when: ceph_spec_fqdn | default(false)
ansible.builtin.set_fact:
ceph_hostname_var: 'ansible_fqdn'

- name: Use ansible_hostname when ceph_spec_fqdn parameter is false
when: not (ceph_spec_fqdn | default(false))
ansible.builtin.set_fact:
ceph_hostname_var: 'ansible_hostname'

- name: Set IPv4 facts
when: ansible_all_ipv4_addresses | length > 0
ansible.builtin.set_fact:
Expand All @@ -173,27 +163,18 @@
ms_bind_ipv4: false
ms_bind_ipv6: true

- name: Handle IPv6 job configuration
when:
- ansible_all_ipv4_addresses | length == 0
- not (cifmw_cephadm_ceph_spec_fqdn | default(false) | bool)
ansible.builtin.set_fact:
ceph_hostname_var: 'ansible_hostname'

- name: Build a dict mapping hostname to its IP which is in management network range
ansible.builtin.set_fact:
host_to_ip:
"{{ host_to_ip | default({}) |
combine(
{
hostvars[item][ceph_hostname_var] :
item :
hostvars[item][all_addresses] | ansible.utils.ipaddr(ssh_network_range) | first
}
)
}}"
delegate_to: "{{ item }}"
when:
- hostvars[item][ceph_hostname_var] is defined
loop: "{{ groups[cifmw_ceph_target | default('computes')] | default([]) }}"

- name: Load network ranges from Networking Environment Definition if not provided
Expand Down
4 changes: 0 additions & 4 deletions roles/cifmw_cephadm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,6 @@ need to be changed for a typical EDPM deployment.
used as entry point to reach the `ganesha backends` through an `haproxy`
instance where proxy-protocol is enabled.

* `cifmw_cephadm_ceph_spec_fqdn`: When true, the Ceph spec should use
a fully qualified domain name (e.g. server1.bar.com). When false, the
Ceph spec should use a short hostname (e.g. server1).

* `cifmw_cephadm_ns`: Name of the OpenStack controlplane namespace
used in configuring swift objects.

Expand Down
1 change: 0 additions & 1 deletion roles/cifmw_cephadm/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ cifmw_ceph_rgw_config:
rgw_max_attrs_num_in_req: 90
rgw_max_attr_size: 1024
cifmw_cephadm_cephfs_name: "cephfs"
cifmw_cephadm_ceph_spec_fqdn: "{{ ceph_spec_fqdn | default(false) | bool }}"
cifmw_ceph_dashboard_spec_path: /tmp/ceph_dashboard.yml
cifmw_cephadm_certificate: ""
cifmw_cephadm_key: ""
Expand Down
12 changes: 1 addition & 11 deletions roles/cifmw_cephadm/tasks/cephfs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,11 @@
# License for the specific language governing permissions and limitations
# under the License.

- name: Use ansible_fqdn when ceph_spec_fqdn parameter is true
when: cifmw_cephadm_ceph_spec_fqdn | bool
ansible.builtin.set_fact:
ceph_hostname_var: 'ansible_fqdn'

- name: Use ansible_hostname when ceph_spec_fqdn parameter is false
when: not cifmw_cephadm_ceph_spec_fqdn | bool
ansible.builtin.set_fact:
ceph_hostname_var: 'ansible_hostname'

- name: Build placement string
block:
- name: Collect the host and build the resulting host list
ansible.builtin.set_fact:
_hosts: "{{ _hosts|default([]) + [ hostvars[item][ceph_hostname_var] ] }}"
_hosts: "{{ _hosts|default([]) + [ item ] }}"
with_items: "{{ groups[cifmw_ceph_target | default('computes')] | default([]) }}"

- name: Collect the target hosts
Expand Down
12 changes: 1 addition & 11 deletions roles/cifmw_cephadm/tasks/rgw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,9 @@
# License for the specific language governing permissions and limitations
# under the License.

- name: Use ansible_fqdn when ceph_spec_fqdn parameter is true
when: cifmw_cephadm_ceph_spec_fqdn | bool
ansible.builtin.set_fact:
ceph_hostname_var: 'ansible_fqdn'

- name: Use ansible_hostname when ceph_spec_fqdn parameter is false
when: not cifmw_cephadm_ceph_spec_fqdn | bool
ansible.builtin.set_fact:
ceph_hostname_var: 'ansible_hostname'

- name: Collect the host and build the resulting host list
ansible.builtin.set_fact:
_hosts: "{{ _hosts|default([]) + [ hostvars[item][ceph_hostname_var] ] }}"
_hosts: "{{ _hosts|default([]) + [ item ] }}"
loop: "{{ groups[cifmw_ceph_target | default('computes')] | default([]) }}"

- name: Create certificate and DNS for RGW if certificate paths are set
Expand Down