|
| 1 | +--- |
| 2 | +- name: Setup repos, CA and networks on ceph nodes |
| 3 | + hosts: "{{ cifmw_ceph_target | default('ceph') }}" |
| 4 | + gather_facts: true |
| 5 | + become: true |
| 6 | + vars: |
| 7 | + cifmw_adoption_osp_deploy_ntp_server: "pool.ntp.org" |
| 8 | + cifmw_adoption_osp_deploy_repos: |
| 9 | + - rhel-9-for-x86_64-baseos-eus-rpms |
| 10 | + - rhel-9-for-x86_64-appstream-eus-rpms |
| 11 | + - rhel-9-for-x86_64-highavailability-eus-rpms |
| 12 | + - openstack-17.1-for-rhel-9-x86_64-rpms |
| 13 | + - fast-datapath-for-rhel-9-x86_64-rpms |
| 14 | + - rhceph-7-tools-for-rhel-9-x86_64-rpms |
| 15 | + common_dns: ["2620:cf:cf:aaaa::1"] |
| 16 | + base_config: "/etc/os-net-config" |
| 17 | + tasks: |
| 18 | + - name: Setup repositories via rhos-release if needed |
| 19 | + ansible.builtin.import_role: |
| 20 | + name: repo_setup |
| 21 | + tasks_from: rhos_release.yml |
| 22 | + |
| 23 | + - name: Install custom CA if needed |
| 24 | + ansible.builtin.import_role: |
| 25 | + name: install_ca |
| 26 | + - name: Ensure needed logins |
| 27 | + ansible.builtin.import_role: |
| 28 | + name: adoption_osp_deploy |
| 29 | + tasks_from: login_registries.yml |
| 30 | + |
| 31 | + - name: Ensure repos are setup |
| 32 | + become: true |
| 33 | + community.general.rhsm_repository: |
| 34 | + name: "{{ cifmw_adoption_osp_deploy_repos }}" |
| 35 | + state: enabled |
| 36 | + |
| 37 | + - name: Ensure os-net-config folder exists in ceph nodes |
| 38 | + become: true |
| 39 | + ansible.builtin.file: |
| 40 | + path: "/etc/os-net-config" |
| 41 | + state: directory |
| 42 | + mode: '0755' |
| 43 | + |
| 44 | + - name: Ensure os-net-config and openvswitch is installed in ceph nodes |
| 45 | + become: true |
| 46 | + ansible.builtin.dnf: |
| 47 | + name: |
| 48 | + - os-net-config |
| 49 | + - openvswitch |
| 50 | + state: present |
| 51 | + |
| 52 | + - name: Generate os-net-config YAML |
| 53 | + ansible.builtin.copy: |
| 54 | + dest: "{{ base_config }}/network-os-net-config.yaml" |
| 55 | + mode: '0644' |
| 56 | + content: | |
| 57 | + network_config: |
| 58 | + - type: ovs_bridge |
| 59 | + name: br-ex |
| 60 | + mtu: 1500 |
| 61 | + use_dhcp: false |
| 62 | + dns_servers: {{ common_dns }} |
| 63 | + addresses: |
| 64 | + - ip_netmask: "{{ hostvars[inventory_hostname]['bridge_ip'] }}" |
| 65 | + routes: [] |
| 66 | + members: |
| 67 | + - type: interface |
| 68 | + name: nic2 |
| 69 | + mtu: 1500 |
| 70 | + primary: true |
| 71 | + addresses: |
| 72 | + - ip_netmask: "{{ hostvars[inventory_hostname]['external_ip'] }}" |
| 73 | + routes: [] |
| 74 | + - type: vlan |
| 75 | + vlan_id: 20 |
| 76 | + addresses: |
| 77 | + - ip_netmask: "{{ hostvars[inventory_hostname]['internalapi_ip'] }}" |
| 78 | + routes: [] |
| 79 | + - type: vlan |
| 80 | + vlan_id: 21 |
| 81 | + addresses: |
| 82 | + - ip_netmask: "{{ hostvars[inventory_hostname]['storage_ip'] }}" |
| 83 | + routes: [] |
| 84 | + - type: vlan |
| 85 | + vlan_id: 23 |
| 86 | + addresses: |
| 87 | + - ip_netmask: "{{ hostvars[inventory_hostname]['storagemgmt_ip'] }}" |
| 88 | + routes: [] |
| 89 | + - type: vlan |
| 90 | + vlan_id: 22 |
| 91 | + addresses: |
| 92 | + - ip_netmask: "{{ hostvars[inventory_hostname]['tenant_ip'] }}" |
| 93 | + routes: [] |
| 94 | +
|
| 95 | + - name: Apply network configuration |
| 96 | + ansible.builtin.command: > |
| 97 | + os-net-config -c {{ base_config }}/network-os-net-config.yaml -v |
| 98 | + changed_when: true |
| 99 | + |
| 100 | + - name: Set net.ipv6.ip_nonlocal_bind |
| 101 | + ansible.posix.sysctl: |
| 102 | + name: net.ipv6.ip_nonlocal_bind |
| 103 | + value: '1' |
| 104 | + state: present |
0 commit comments