eezhova

resources.yml

Jan 25th, 2018
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.80 KB | None | 0 0
  1. - import_playbook: render_configs.yml
  2.  
  3. - hosts: localhost
  4.   connection: local
  5.   roles:
  6.     - role: avinetworks.avisdk
  7.   tasks:
  8.     - set_fact:
  9.         default_output_path: "/var/lib/agent_output"
  10.     - name: Including auth vars
  11.       include_vars: "{{ playbook_dir }}/creds.yml"
  12.     - name: Avi Cloud | Setup AVI resources
  13.       include_role:
  14.         name: avinetworks.aviconfig
  15.       vars:
  16.         avi_config_file: "{{ playbook_dir }}/res_config_{{ test_name }}.yml"
  17.         avi_creds_file: "{{ playbook_dir }}/creds.yml"
  18.     - name: Get the created Virtual Service
  19.       avi_api_session:
  20.         api_version: "{{ avi_api_version }}"
  21.         controller: "{{ avi_controller }}"
  22.         username: "{{ avi_username }}"
  23.         password: "{{ avi_password }}"
  24.         http_method: get
  25.         path: "virtualservice?name=test-vs&cloud_ref.name=openstack"
  26.       register: vs
  27.     - set_fact:
  28.         avi_vs_uuid: "{{ vs.obj.results[0].uuid }}"
  29.         avi_vs_floating_vip: "{{ vs.obj.results[0].vip[0].floating_ip.addr }}"
  30.     - name: Check the VS operation state
  31.       avi_api_session:
  32.         api_version: "{{ avi_api_version }}"
  33.         controller: "{{ avi_controller }}"
  34.         username: "{{ avi_username }}"
  35.         password: "{{ avi_password }}"
  36.         http_method: get
  37.         path: "virtualservice/{{ avi_vs_uuid }}/runtime/"
  38.       register: vs_runtime
  39.       until: vs_runtime.obj.oper_status.state == "OPER_UP"
  40.       retries: 60
  41.       delay: 10
  42.     - name: Make sure the output path exists
  43.       file:
  44.         path: "{{ output_path|default(default_output_path) }}"
  45.         state: directory
  46.         mode: 0775
  47.         recurse: yes
  48.     - name: Save output to yaml
  49.       template:
  50.         src: output.yml.j2
  51.         dest: "{{ output_path|default(default_output_path) }}/attributes.yaml"
Advertisement
Add Comment
Please, Sign In to add comment