From 4729249a766a668ca63069f5fcf16c224580efcf Mon Sep 17 00:00:00 2001 From: Gerrit Date: Wed, 1 Mar 2023 14:39:16 +0100 Subject: [PATCH] Migration to ansible metal collections. --- deploy_control_plane.yaml | 30 +++--------- deploy_partition.yaml | 49 ++++--------------- inventories/group_vars/all/images.yaml | 3 ++ .../group_vars/control-plane/metal.yml | 8 +-- obtain_role_requirements.yaml | 12 +++-- .../defaults/main.yaml | 0 .../meta/main.yml | 0 .../tasks/main.yaml | 2 +- .../templates/values.yaml | 0 9 files changed, 34 insertions(+), 70 deletions(-) rename roles/{ingress-controller => ingress_controller}/defaults/main.yaml (100%) rename roles/{ingress-controller => ingress_controller}/meta/main.yml (100%) rename roles/{ingress-controller => ingress_controller}/tasks/main.yaml (91%) rename roles/{ingress-controller => ingress_controller}/templates/values.yaml (100%) diff --git a/deploy_control_plane.yaml b/deploy_control_plane.yaml index a9141db2..721bd42a 100644 --- a/deploy_control_plane.yaml +++ b/deploy_control_plane.yaml @@ -3,26 +3,12 @@ hosts: control-plane connection: local gather_facts: false - vars: - setup_yaml: - - url: https://raw.githubusercontent.com/metal-stack/releases/{{ metal_stack_release_version }}/release.yaml - meta_var: metal_stack_release roles: - - name: ansible-common - tags: always - - name: ingress-controller - tags: ingress-controller - - name: metal-roles/control-plane/roles/prepare - tags: prepare - - name: metal-roles/control-plane/roles/nsq - tags: nsq - - name: metal-roles/control-plane/roles/metal-db - tags: metal-db - - name: metal-roles/control-plane/roles/ipam-db - tags: ipam-db - - name: metal-roles/control-plane/roles/masterdata-db - tags: masterdata-db - - name: metal-roles/control-plane/roles/auditing-meili - tags: auditing - - name: metal-roles/control-plane/roles/metal - tags: metal + - ingress_controller + - metalstack.controlplane.prepare + - metalstack.controlplane.nsq + - metalstack.controlplane.metal_db + - metalstack.controlplane.ipam_db + - metalstack.controlplane.masterdata_db + - metalstack.controlplane.auditing_meili + - metalstack.controlplane.metal diff --git a/deploy_partition.yaml b/deploy_partition.yaml index d7ba57eb..6fe0882d 100644 --- a/deploy_partition.yaml +++ b/deploy_partition.yaml @@ -2,56 +2,27 @@ - name: deploy leaves and docker hosts: leaves roles: - - name: metal-roles/partition/roles/leaf - tags: leaf - - name: metal-roles/partition/roles/docker-on-cumulus - tags: docker-on-cumulus + - metalstack.partition.leaf + - metalstack.partition.docker_on_cumulus - name: deploy dhcp server and pixiecore hosts: leaf01 - vars: - setup_yaml: - - url: https://raw.githubusercontent.com/metal-stack/releases/{{ metal_stack_release_version }}/release.yaml - meta_var: metal_stack_release roles: - - name: ansible-common - tags: always - - name: metal-roles/partition/roles/dhcp - tags: dhcp - - name: metal-roles/partition/roles/pixiecore - tags: pixiecore + - metalstack.partition.dhcp + - metalstack.partition.pixiecore - name: deploy metal-core hosts: leaves - vars: - setup_yaml: - - url: https://raw.githubusercontent.com/metal-stack/releases/{{ metal_stack_release_version }}/release.yaml - meta_var: metal_stack_release roles: - - name: ansible-common - tags: always - - name: internet - tags: internet - - name: metal-roles/partition/roles/metal-core - tags: metal-core + - internet + - metalstack.partition.metal_core - name: wait for switches hosts: localhost connection: local gather_facts: no - vars: - setup_yaml: - - url: https://raw.githubusercontent.com/metal-stack/releases/{{ metal_stack_release_version }}/release.yaml - meta_var: metal_stack_release roles: - - name: ansible-common - tags: always - - name: metal-roles - tags: always - - name: metal-ansible-modules - tags: always - - name: metal-roles/control-plane/roles/metal-python - tags: metal-python + - metalstack.controlplane.metal_python post_tasks: - name: Wait for switches to register command: echo @@ -59,6 +30,6 @@ retries: 60 delay: 3 until: - - lookup('metal', 'search', 'switch', api_url=metal_partition_metal_api_protocol+'://'+metal_partition_metal_api_addr+':'+metal_partition_metal_api_port|string+metal_partition_metal_api_basepath, api_hmac=metal_partition_metal_api_hmac_edit_key) | length == 2 - - lookup('metal', 'search', 'switch', api_url=metal_partition_metal_api_protocol+'://'+metal_partition_metal_api_addr+':'+metal_partition_metal_api_port|string+metal_partition_metal_api_basepath, api_hmac=metal_partition_metal_api_hmac_edit_key)[0]["last_sync"] != None - - lookup('metal', 'search', 'switch', api_url=metal_partition_metal_api_protocol+'://'+metal_partition_metal_api_addr+':'+metal_partition_metal_api_port|string+metal_partition_metal_api_basepath, api_hmac=metal_partition_metal_api_hmac_edit_key)[1]["last_sync"] != None + - lookup('metalstack.common.metal', 'search', 'switch', api_url=metal_partition_metal_api_protocol+'://'+metal_partition_metal_api_addr+':'+metal_partition_metal_api_port|string+metal_partition_metal_api_basepath, api_hmac=metal_partition_metal_api_hmac_edit_key) | length == 2 + - lookup('metalstack.common.metal', 'search', 'switch', api_url=metal_partition_metal_api_protocol+'://'+metal_partition_metal_api_addr+':'+metal_partition_metal_api_port|string+metal_partition_metal_api_basepath, api_hmac=metal_partition_metal_api_hmac_edit_key)[0]["last_sync"] != None + - lookup('metalstack.common.metal', 'search', 'switch', api_url=metal_partition_metal_api_protocol+'://'+metal_partition_metal_api_addr+':'+metal_partition_metal_api_port|string+metal_partition_metal_api_basepath, api_hmac=metal_partition_metal_api_hmac_edit_key)[1]["last_sync"] != None diff --git a/inventories/group_vars/all/images.yaml b/inventories/group_vars/all/images.yaml index 86b83341..c27b2729 100644 --- a/inventories/group_vars/all/images.yaml +++ b/inventories/group_vars/all/images.yaml @@ -1,6 +1,9 @@ --- metal_stack_release_version: develop +setup_yaml: + - url: https://raw.githubusercontent.com/metal-stack/releases/{{ metal_stack_release_version }}/release.yaml + meta_var: metal_stack_release ## ## for development purposes, you can override releases from our image vector here ## diff --git a/inventories/group_vars/control-plane/metal.yml b/inventories/group_vars/control-plane/metal.yml index ef503744..db3fd7da 100644 --- a/inventories/group_vars/control-plane/metal.yml +++ b/inventories/group_vars/control-plane/metal.yml @@ -34,11 +34,11 @@ metal_api_sizes: min: 1 max: 4 - type: memory - min: "{{ '500MB' | humanfriendly }}" - max: "{{ '4GB' | humanfriendly }}" + min: "{{ '500MB' | metalstack.common.humanfriendly }}" + max: "{{ '4GB' | metalstack.common.humanfriendly }}" - type: storage - min: "{{ '1GB' | humanfriendly }}" - max: "{{ '10GB' | humanfriendly }}" + min: "{{ '1GB' | metalstack.common.humanfriendly }}" + max: "{{ '10GB' | metalstack.common.humanfriendly }}" metal_api_partitions: - id: mini-lab diff --git a/obtain_role_requirements.yaml b/obtain_role_requirements.yaml index e1da31d4..90663597 100644 --- a/obtain_role_requirements.yaml +++ b/obtain_role_requirements.yaml @@ -17,7 +17,11 @@ dest: "{{ playbook_dir }}/requirements.yaml" content: | {% for role_name, role_params in (release_vector.content | from_yaml).get('ansible-roles').items() %} - - src: {{ role_params.get('repository') }} - name: {{ role_name }} - version: {{ hostvars[inventory_hostname][role_name | lower | replace('-', '_') + '_version'] | default(role_params.get('version'), true) }} - {% endfor %} \ No newline at end of file + # - src: {{ role_params.get('repository') }} + # name: {{ role_name }} + # version: {{ hostvars[inventory_hostname][role_name | lower | replace('-', '_') + '_version'] | default(role_params.get('version'), true) }} + {% endfor %} + collections: + - name: https://github.com/metal-stack/metal-ansible-collections + version: main # use release versions if you want to have stable deployment! + type: git diff --git a/roles/ingress-controller/defaults/main.yaml b/roles/ingress_controller/defaults/main.yaml similarity index 100% rename from roles/ingress-controller/defaults/main.yaml rename to roles/ingress_controller/defaults/main.yaml diff --git a/roles/ingress-controller/meta/main.yml b/roles/ingress_controller/meta/main.yml similarity index 100% rename from roles/ingress-controller/meta/main.yml rename to roles/ingress_controller/meta/main.yml diff --git a/roles/ingress-controller/tasks/main.yaml b/roles/ingress_controller/tasks/main.yaml similarity index 91% rename from roles/ingress-controller/tasks/main.yaml rename to roles/ingress_controller/tasks/main.yaml index 37a57a59..7ffb45c1 100644 --- a/roles/ingress-controller/tasks/main.yaml +++ b/roles/ingress_controller/tasks/main.yaml @@ -11,7 +11,7 @@ - name: Deploy nginx-ingress include_role: - name: ansible-common/roles/helm-chart + name: metalstack.common.helm_chart vars: helm_repo: "https://kubernetes.github.io/ingress-nginx" helm_chart: ingress-nginx diff --git a/roles/ingress-controller/templates/values.yaml b/roles/ingress_controller/templates/values.yaml similarity index 100% rename from roles/ingress-controller/templates/values.yaml rename to roles/ingress_controller/templates/values.yaml