Commit 43d5494b authored by Daniel Buøy-Vehn's avatar Daniel Buøy-Vehn

Update code for demo

parent f951d732
{
"os_host_name": [
"vm01.example.com",
"vm02.example.com",
"vm03.example.com",
"vm04.example.com",
"vm05.example.com"
]
}
#!/usr/bin/ansible-playbook --ask-vault-pass
---
# Playbook to create hosts in OpenStack
- hosts: all
become: no
gather_facts: no
......@@ -8,22 +10,11 @@
tasks:
- name: RUN ALL COMMANDS AGAINST LOCALHOST
block:
#- name: FETCH HOSTNAME FROM SERVICE
# uri:
# url: "{{ naming_service_url }}"
# method: 'POST'
# register: hostname
# tags: hostname
#- name: DEBUG
# debug:
# msg: "{{ hostname }}"
# tags: hostname
- name: "CREATE MACHINE IN OPENSTACK [ {{ os_host_name }} ]"
os_server:
state: present
auth: "{{ os_auth }}"
name: "{{ os_host_name }}"
name: "{{ item }}"
image: "{{ os_host_image }}"
flavor: "{{ os_host_flavor }}"
security_groups: "{{ os_host_securitygroups | default(omit) }}"
......@@ -37,7 +28,7 @@
sudo: ALL=(ALL) NOPASSWD:ALL
nics:
- net-name: 'rl_conference_demo'
tags: host
loop: "{{ lookup('list', os_host_name) }}"
when: os_host_name is defined
delegate_to: localhost
#!/usr/bin/ansible-playbook --ask-vault-pass
---
# Playbook to remove hosts
- hosts: localhost
become: no
gather_facts: no
vars:
os_auth: "{{ openstack_instance.os_auth }}"
os_host_network: "{{ openstack_instance.network.network_name }}"
tasks:
- name: RUN ALL COMMANDS AGAINST LOCALHOST
block:
- name: "DELETE MACHINE IN OPENSTACK [ {{ os_host_name }} ]"
os_server:
name: "{{ item }}"
state: absent
auth: "{{ os_auth }}"
loop: "{{ lookup('list', os_host_name) }}"
when: os_host_name is defined
delegate_to: localhost
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment