diff --git a/roles/standalone/tasks/ceph-install.yml b/roles/standalone/tasks/ceph-install.yml new file mode 100644 index 000000000..c1cf13024 --- /dev/null +++ b/roles/standalone/tasks/ceph-install.yml @@ -0,0 +1,129 @@ +--- +- block: + - name: Set facts for Ceph + set_fact: + stack: standalone + mon_ip: "{{ rfc1918c ~ subnet | string ~ '.1' }}" + ceph_network: "{{ rfc1918c ~ subnet | string ~ '.0/' ~ cidr | string }}" + network_data: "{{ working_dir }}/network_data.yaml" + deployed_network: "{{ working_dir }}/deployed_network.yaml" + osd_spec: "{{ working_dir }}/osd_spec.yaml" + initial_ceph_conf: "{{ working_dir }}/initial_ceph.conf" + ceph_spec: "{{ working_dir }}/ceph_spec.yaml" + containers_prep: "{{ working_dir }}/containers-prepare-parameters.yaml" + deployed_ceph: "{{ working_dir }}/deployed_ceph.yaml" + - name: Configure Storage Network + include_tasks: storage-network.yml + vars: + interface: ceph-dummy0 + dummy_ip_cidr: "{{ mon_ip ~ '/' ~ cidr | string }}" + dummy_vip: "{{ rfc1918c ~ subnet | string ~ '.2' }}" + start: "{{ rfc1918c ~ subnet | string ~ '.4' }}" + end: "{{ rfc1918c ~ subnet | string ~ '.250' }}" + vars: + rfc1918c: '192.168.' + subnet: 42 + cidr: 24 + +- name: Update registries.conf to trust docker_registry_host with Ceph container + become: true + block: + - name: Add docker_registry_host location to registries.conf + ini_file: + path: /etc/containers/registries.conf + create: false + backup: false + section: '[registry]' + option: location + value: "'{{ docker_registry_host }}'" + - name: Set docker_registry_host as insecure in registries.conf + ini_file: + path: /etc/containers/registries.conf + create: false + backup: false + section: '[registry]' + option: insecure + value: 'true' + +- name: Create OSD spec file + copy: + dest: "{{ osd_spec }}" + content: | + data_devices: + paths: + - /dev/ceph_vg/ceph_lv_data + +- name: Create initial ceph.conf file + copy: + dest: "{{ initial_ceph_conf }}" + content: | + [global] + osd pool default size = 1 + [mon] + mon_warn_on_pool_no_redundancy = false + [mgr] + mgr/cephadm/log_to_cluster_level = debug + +- name: Create Ceph Spec file via tripleo-operator-ansible + collections: + - tripleo.operator + include_role: + name: tripleo_ceph_spec + vars: + tripleo_ceph_spec_standalone: true + tripleo_ceph_spec_overwrite: true + tripleo_ceph_spec_mon_ip: "{{ mon_ip }}" + tripleo_ceph_spec_stack: "{{ stack }}" + tripleo_ceph_spec_file: "{{ ceph_spec }}" + tripleo_ceph_spec_osd_spec: "{{ osd_spec }}" + tripleo_ceph_spec_debug: true + tripleo_ceph_spec_generate_scripts: true + +- name: Create ceph-admin user via tripleo-operator-ansible + collections: + - tripleo.operator + include_role: + name: tripleo_ceph_user + vars: + tripleo_ceph_user_spec: "{{ ceph_spec }}" + tripleo_ceph_user_enable: true + tripleo_ceph_user_stack: "{{ stack }}" + tripleo_ceph_user_standalone: true + tripleo_ceph_user_debug: true + tripleo_ceph_user_generate_scripts: true + +- name: Confirm ceph-admin user can SSH to mon_ip before deploying Ceph + shell: "ssh -i {{ ssh_key }} {{ ssh_opt }} ceph-admin@{{ mon_ip }} 'echo good'" + register: result + until: result.stdout.find("good") != -1 + retries: 12 + delay: 10 + vars: + ssh_key: /home/zuul/.ssh/ceph-admin-id_rsa + ssh_opt: "-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" + +- name: Deploy Ceph via tripleo-operator-ansible + collections: + - tripleo.operator + include_role: + name: tripleo_ceph_deploy + vars: + tripleo_ceph_deploy_standalone: true + tripleo_ceph_deploy_single_host_defaults: true + tripleo_ceph_deploy_skip_user_create: true + tripleo_ceph_deploy_skip_hosts_config: true + tripleo_ceph_deploy_skip_container_registry_config: true + tripleo_ceph_deploy_mon_ip: "{{ mon_ip }}" + tripleo_ceph_deploy_spec: "{{ ceph_spec }}" + tripleo_ceph_deploy_stack: "{{ stack }}" + tripleo_ceph_deploy_config: "{{ initial_ceph_conf }}" + tripleo_ceph_deploy_output: "{{ deployed_ceph }}" + tripleo_ceph_deploy_container_image_prepare: "{{ containers_prep }}" + tripleo_ceph_deploy_cephadm_extra_args: "--log-to-file --skip-mon-network" + tripleo_ceph_deploy_force: true + tripleo_ceph_deploy_become: true + tripleo_ceph_deploy_overwrite: true + tripleo_ceph_deploy_debug: true + tripleo_ceph_deploy_generate_scripts: true + tripleo_ceph_deploy_network_data: "{{ network_data }}" + tripleo_ceph_deploy_cluster_network_name: storage diff --git a/roles/standalone/tasks/main.yml b/roles/standalone/tasks/main.yml index 0c5e8fde8..ce9ac43c5 100644 --- a/roles/standalone/tasks/main.yml +++ b/roles/standalone/tasks/main.yml @@ -1,3 +1,7 @@ --- - include_tasks: containers.yml +- include_tasks: ceph-install.yml + when: # TODO(fultonj) use ['master', 'wallaby'] after backport + - job.standalone_ceph | default(false) + - zuul.branch is defined and zuul.branch in ['master'] - include_tasks: standalone-install.yml diff --git a/roles/standalone/tasks/standalone-install.yml b/roles/standalone/tasks/standalone-install.yml index c78ade5ee..a07014cf6 100644 --- a/roles/standalone/tasks/standalone-install.yml +++ b/roles/standalone/tasks/standalone-install.yml @@ -21,6 +21,7 @@ {%- endif -%} tripleo_deploy_roles_file: "{{ overcloud_templates_path }}/roles/{{ standalone_role }}" tripleo_deploy_output_dir: "{{ working_dir }}/tripleo-deploy" + tripleo_deploy_networks_file: "{{ network_data|default() }}" tripleo_deploy_environment_files: |- {% set env_files = [overcloud_templates_path + '/environments/standalone/standalone-tripleo.yaml', working_dir + '/containers-prepare-parameters.yaml', @@ -28,6 +29,13 @@ {% if standalone_custom_env_files %} {% set env_files = env_files + standalone_custom_env_files %} {% endif %} + {% if deployed_ceph is defined %} + {% set env_files = env_files + [deployed_ceph] %} + {% endif %} + {% if deployed_network is defined %} + {% set env_files = env_files + [overcloud_templates_path + '/environments/deployed-network-environment.yaml'] %} + {% set env_files = env_files + [deployed_network] %} + {% endif %} {{ env_files }} # NOTE(mwhahaha): option no longer required as of V. tripleo_deploy_standalone: "{{ release in ['stein', 'train', 'ussuri'] }}" diff --git a/roles/standalone/tasks/storage-network.yml b/roles/standalone/tasks/storage-network.yml new file mode 100644 index 000000000..3819e585e --- /dev/null +++ b/roles/standalone/tasks/storage-network.yml @@ -0,0 +1,104 @@ +--- +- name: Look for dummy interface + become: true + command: ip link show "{{ interface }}" + register: ip_link_show + ignore_errors: true + +- name: Create dummy interface + become: true + command: ip link add "{{ interface }}" type dummy + when: + - ip_link_show.stdout_lines == [] + +- name: Assign IP to dummy interface + become: true + command: ip addr add "{{ dummy_ip_cidr }}" dev "{{ interface }}" + when: + - ip_link_show.stdout_lines == [] + +- name: Assign VIP to dummy interface + become: true + command: ip addr add "{{ dummy_vip }}/32" dev "{{ interface }}" + when: + - ip_link_show.stdout_lines == [] + +- name: Bring up dummy interface + become: true + command: ip link set "{{ interface }}" up + when: + - ip_link_show.stdout_lines == [] + +- name: Create network_data file + copy: + dest: "{{ network_data }}" + content: | + - name: Storage + mtu: 1350 + vip: true + name_lower: storage + dns_domain: storage.mydomain.tld. + service_net_map_replace: storage + subnets: + storage_subnet: + ip_subnet: '{{ ceph_network }}' + allocation_pools: [{'start': '{{ start }}', 'end': '{{ end }}'}] + +- name: Create deployed_network environment file (with VIPs) + copy: + dest: "{{ deployed_network }}" + content: | + resource_registry: + OS::TripleO::Network::Ports::ControlPlaneVipPort: /usr/share/openstack-tripleo-heat-templates/network/ports/deployed_vip_ctlplane.yaml + OS::TripleO::Network::Ports::StorageVipPort: network/ports/deployed_vip_storage.yaml + OS::TripleO::Network: /usr/share/openstack-tripleo-heat-templates/network/deployed_networks.yaml + parameter_defaults: + NodePortMap: + standalone: + ctlplane: + ip_address: {{ standalone_ip | default('192.168.24.1') }} + ip_subnet: {{ standalone_ip | default('192.168.24.1') }}/{{ standalone_network_prefix | default('24') }} + ip_address_uri: {{ standalone_ip | default('192.168.24.1') }} + storage: + ip_address: {{ mon_ip }} + ip_subnet: {{ dummy_ip_cidr }} + ip_address_uri: {{ mon_ip }} + ControlPlaneVipData: + fixed_ips: + - ip_address: {{ standalone_ha_control_virtual_ip | default('192.168.24.3') }} + name: control_virtual_ip + network: + tags: + - {{ standalone_network | default('192.168.24') ~ '.0/' ~ standalone_network_prefix | default('24') | string }} + subnets: + - ip_version: 4 + VipPortMap: + storage: + ip_address: {{ dummy_vip }} + ip_address_uri: {{ dummy_vip }} + ip_subnet: {{ dummy_vip ~ '/' ~ cidr | string }} + DeployedNetworkEnvironment: + net_attributes_map: + storage: + network: + dns_domain: storage.mydomain.tld. + mtu: 1350 + name: storage + tags: + - tripleo_network_name=Storage + - tripleo_net_idx=0 + - tripleo_service_net_map_replace=storage + - tripleo_vip=true + subnets: + storage_subnet: + cidr: {{ ceph_network }} + dns_nameservers: [] + gateway_ip: null + host_routes: [] + ip_version: 4 + name: storage_subnet + net_cidr_map: + storage: + - {{ ceph_network }} + net_ip_version_map: + storage: 4