Skip to content
Closed
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
38 changes: 38 additions & 0 deletions etc/kayobe/ansible/blazar-host-create.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
- name: Create Blazar hosts
hosts: blazar-compute
gather_facts: false
vars:
venv: "{{ virtualenv_path }}/blazar"
venv_python: "{{ 'python' ~ ansible_facts.python.version.major ~ '.' ~ ansible_facts.python.version.minor }}"
tasks:
- name: Set up openstack cli virtualenv
ansible.builtin.pip:
virtualenv: "{{ venv }}"
virtualenv_command: "{{ venv_python }} -m venv"
name:
- python-openstackclient
- python-blazarclient
state: latest
extra_args: "{% if pip_upper_constraints_file %}-c {{ pip_upper_constraints_file }}{% endif %}"
run_once: true
delegate_to: localhost
become: true

- name: List Blazar compute hosts
ansible.builtin.shell:
cmd: |
{{ venv }}/bin/openstack reservation host show \
{{ inventory_hostname }} \
register: host_show
failed_when: false
changed_when: false
delegate_to: localhost

- name: Ensure Blazar compute hosts are created
ansible.builtin.shell:
cmd: |
{{ venv }}/bin/openstack reservation host create \
{{ inventory_hostname }} \
delegate_to: localhost
when: '"Unable to find resource" in host_show.stderr'