Skip to content

Commit

Permalink
updates to csp
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaurav Rastogi committed Mar 9, 2018
1 parent 2f8bc1f commit 8cee4c9
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 2 deletions.
2 changes: 2 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ con_csp_mgmt_ip: ~
con_csp_mgmt_mask: ~
con_csp_default_gw: ~
con_csp_disk_size: 64
con_csp_disk_type: virtio
con_csp_service_name: avi-controller
con_csp_metafile_name: avi_meta_{{ con_csp_service_name }}.yml
con_csp_num_cpu: 4
con_csp_memory_gb: 16
con_csp_memory_mb: "{{ con_csp_memory_gb|int * 1024 }}"
con_csp_platform: csp-2100
con_csp_vnics:
- nic: '0'
type: access
Expand Down
64 changes: 62 additions & 2 deletions tasks/service_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,62 @@
- debug: msg="Service {{ con_csp_service_exists_json['vsb:service'].name }} already exists."
when: con_csp_service_exists.status == 200

- name: Avi Controller | CSP | Service deploy | Create the service
- name: Avi Controller | CSP | Service deploy | Get CSP version
uri:
url: "https://{{ inventory_hostname }}/api/running/resources/resource/{{ con_csp_platform }}"
method: GET
user: "{{ con_csp_user }}"
password: "{{ con_csp_password }}"
force_basic_auth: yes
headers:
Accept: '*/*'
validate_certs: false
return_content: true
failed_when: false
register: con_csp_resource_rsp
delegate_to: localhost

- name: Avi Controller | CSP | Service deploy | Set CSP version
set_fact:
con_csp_resource_info: "{{ con_csp_resource_rsp.content|from_json }}"
when: con_csp_resource_rsp.status == 200

- name: Avi Controller | CSP | Service deploy | CSP Info
debug: msg="{{con_csp_resource_info.resource:resource}}"

- name: Avi Controller | CSP < 2.2.4| Service deploy | Create the service
uri:
url: "https://{{ inventory_hostname }}/api/running/services/"
method: POST
user: "{{ con_csp_user }}"
password: "{{ con_csp_password }}"
force_basic_auth: yes
headers:
Accept: '*/*'
validate_certs: false
body_format: json
body:
service:
disk_size: "{{ con_csp_disk_size|int }}"
disk_type: "{{ con_csp_disk_type | default("virtio")}}
name: "{{ con_csp_service_name }}"
power: 'on'
iso_name: "{{ con_csp_qcow_image_name }}"
day0_filename: "{{ con_csp_metafile_name }}"
numcpu: "{{ con_csp_num_cpu|int }}"
memory: "{{ con_csp_memory_mb|int }}"
vnics:
vnic:
"{{ con_csp_vnics }}"
return_content: true
register: con_csp_service
failed_when: con_csp_service.status != 201
delegate_to: localhost
when:
- con_csp_service_exists.status != 200
- con_csp_resource_info.csp_version < "02.02.04"

- name: Avi Controller | CSP >= 2.2.4| Service deploy | Create the service
uri:
url: "https://{{ inventory_hostname }}/api/running/services/"
method: POST
Expand All @@ -34,6 +89,8 @@
body:
service:
disk_size: "{{ con_csp_disk_size|int }}"
disk_type: "{{ con_csp_disk_type | default("virtio")}}
disk-resize: true
name: "{{ con_csp_service_name }}"
power: 'on'
iso_name: "{{ con_csp_qcow_image_name }}"
Expand All @@ -47,4 +104,7 @@
register: con_csp_service
failed_when: con_csp_service.status != 201
delegate_to: localhost
when: con_csp_service_exists.status != 200
when:
- con_csp_service_exists.status != 200
- con_csp_resource_info.csp_version >= "2.2.4"

0 comments on commit 8cee4c9

Please sign in to comment.