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

Migration to ansible metal collections. #134

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
30 changes: 8 additions & 22 deletions deploy_control_plane.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
49 changes: 10 additions & 39 deletions deploy_partition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,34 @@
- 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
changed_when: false
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
3 changes: 3 additions & 0 deletions inventories/group_vars/all/images.yaml
Original file line number Diff line number Diff line change
@@ -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
##
Expand Down
8 changes: 4 additions & 4 deletions inventories/group_vars/control-plane/metal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 8 additions & 4 deletions obtain_role_requirements.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
# - 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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down