forked from openstack-ansible/ansible-role-nova-controller
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.yml
63 lines (54 loc) · 1.83 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
---
- hosts: all
sudo: False
vars_files:
- defaults/main.yml
vars:
openstack_identity_demo_password: password
tasks:
- name: update admin.openrc from template
template:
src: templates/admin.openrc
dest: "{{ ansible_env.PWD }}/admin.openrc"
owner: "{{ ansible_ssh_user }}"
- name: create demo tenant
keystone_user:
endpoint: "{{ openstack_identity_admin_url }}"
token: "{{ openstack_identity_admin_token }}"
tenant: demo
tenant_description: "Demo Tenant"
- name: create demo user
keystone_user:
endpoint: "{{ openstack_identity_admin_url }}"
token: "{{ openstack_identity_admin_token }}"
tenant: demo
user: demo
password: "{{ openstack_identity_demo_password }}"
- name: associate _member_ role with demo user
keystone_user:
endpoint: "{{ openstack_identity_admin_url }}"
token: "{{ openstack_identity_admin_token }}"
tenant: demo
user: demo
role: _member_
- name: update demo.openrc from template
template:
src: templates/demo.openrc
dest: "{{ ansible_env.PWD }}/demo.openrc"
owner: "{{ ansible_ssh_user }}"
- name: create ssh keypair
command: ssh-keygen -q -f {{ ansible_env.PWD }}/.ssh/id_rsa -P ""
creates={{ ansible_env.PWD }}/.ssh/id_rsa
- name: capture public key in variable
command: cat {{ ansible_env.PWD }}/.ssh/id_rsa.pub
register: pubkey
changed_when: false
- name: add ssh keypair to nova
nova_keypair:
auth_url: "{{ openstack_identity_public_url }}"
login_tenant_name: demo
login_username: demo
login_password: "{{ openstack_identity_demo_password }}"
name: default
public_key: "{{ pubkey.stdout }}"
state: present