Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- # Copyright 2017 FUJITSU LIMITED
- - name: Create OpenStack instance
- hosts: openstack
- gather_facts: false
- tasks:
- - name: Deploy an instance
- os_server:
- state: present
- auth:
- username: "{{ os_user_name }}"
- password: "{{ os_password }}"
- project_name: "{{ os_project_name }}"
- auth_url: "{{ os_keystone_url }}"
- name: "{{ os_instance_name }}"
- image: "{{ os_image_id }}"
- flavor: "{{ os_instance_flavor }}"
- auto_floating_ip: "{{ os_instance_assign_floating_ip }}"
- security_groups: "{{ os_instance_security_groups }}"
- nics:
- - net-id: "{{ os_network_id }}"
- meta:
- hostname: webserver.localdomain
- register: nova
- - set_fact:
- # All variables are left here, because of the compatibility reasons
- monasca_host: "{{ nova.server.public_v4 }}"
- node_1: "{{ nova.server.public_v4 }}"
- node_1_admin_ip: "{{ nova.server.public_v4 }}"
- node_1_public_ip: "127.0.0.1"
- node_1_internal_ip: "127.0.0.1"
- - set_fact:
- # Both variables are left here, because of the compatibility reasons
- ssh_user_monasca: "{{ os_instance_user }}"
- ssh_user_node_1: "{{ os_instance_user }}"
- - set_fact:
- openstack_host: "{{ nova.server.public_v4 }}"
- - set_fact:
- ssh_user_openstack: "{{ os_instance_user }}"
- - set_fact:
- offline_resources_host: "{{ nova.server.public_v4 }}"
- - set_fact:
- ssh_user_offline_host: "{{ os_instance_user }}"
- - set_fact:
- rabbitmq_host: "{{ nova.server.public_v4 }}"
- - name: Add OpenStack instance to inventory
- add_host:
- name: openstack_vm
- ansible_ssh_host: "{{ nova.server.public_v4 }}"
- ansible_ssh_private_key_file: "{{ os_instance_user_key_path }}"
- ansible_user: "{{ os_instance_user }}"
- - name: Create inventory file for monasca-installer
- template:
- src="{{ monasca_installer_path }}/templates/hosts-single.j2"
- dest="{{ monasca_installer_path }}/hosts"
- delegate_to: localhost
- - name: Update hosts file with keystone and horizon groups
- blockinfile:
- dest: "{{ monasca_installer_path }}/hosts"
- block: |
- [keystone_all]
- keystone-node
- [horizon_all]
- horizon-node
- [rabbitmq_all]
- keystone-node
- [galera_all]
- keystone-node
- delegate_to: localhost
- - name: Insert passwords to credentials.yml
- replace:
- dest: "{{ monasca_installer_path }}/credentials.yml"
- regexp: '(.+_password:)$'
- replace: '\1 admin'
- delegate_to: localhost
- - name: Wait for SSH port on the VM to open
- local_action:
- module: wait_for
- host: "{{ nova.server.public_v4 }}"
- port: 22
- delay: 30
- timeout: 300
- state: started
- - name: Initial VM provisioning
- hosts: openstack_vm
- become: yes
- tasks:
- - name: Install rsync on OpenStack VM
- yum:
- name: rsync
- state: present
- - name: Add VM hostname to /etc/hosts [needed by storm]
- lineinfile:
- dest: /etc/hosts
- regexp: '^127\.0\.0\.1'
- line: "127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 {{ hostvars.openstack.nova.server.name }} {{ hostvars.openstack.nova.server.name }}.novalocal"
- owner: root
- group: root
- mode: 0644
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement