openrc file resource
This commit is contained in:
parent
8ffd6ad5a5
commit
21f7119ebd
@ -74,6 +74,7 @@ def deploy():
|
|||||||
admin_user = vr.create('admin_user', GitProvider(GIT_KEYSTONE_RESOURCE_URL, 'keystone_user'), {'user_name': 'admin', 'user_password': 'admin'})[0]
|
admin_user = vr.create('admin_user', GitProvider(GIT_KEYSTONE_RESOURCE_URL, 'keystone_user'), {'user_name': 'admin', 'user_password': 'admin'})[0]
|
||||||
admin_role = vr.create('admin_role', GitProvider(GIT_KEYSTONE_RESOURCE_URL, 'keystone_role'), {'role_name': 'admin'})[0]
|
admin_role = vr.create('admin_role', GitProvider(GIT_KEYSTONE_RESOURCE_URL, 'keystone_role'), {'role_name': 'admin'})[0]
|
||||||
keystone_service_endpoint = vr.create('keystone_service_endpoint', GitProvider(GIT_KEYSTONE_RESOURCE_URL, 'keystone_service_endpoint'), {'adminurl': 'http://{{ip}}:{{admin_port}}/v2.0', 'internalurl': 'http://{{ip}}:{{port}}/v2.0', 'publicurl': 'http://{{ip}}:{{port}}/v2.0', 'description': 'OpenStack Identity Service', 'type': 'identity'})[0]
|
keystone_service_endpoint = vr.create('keystone_service_endpoint', GitProvider(GIT_KEYSTONE_RESOURCE_URL, 'keystone_service_endpoint'), {'adminurl': 'http://{{ip}}:{{admin_port}}/v2.0', 'internalurl': 'http://{{ip}}:{{port}}/v2.0', 'publicurl': 'http://{{ip}}:{{port}}/v2.0', 'description': 'OpenStack Identity Service', 'type': 'identity'})[0]
|
||||||
|
openrc = vr.create('openrc_file', 'resources/openrc_file', {'ip':'', 'ssh_key' : '', 'ssh_user':'', 'keystone_host':'', 'keystone_port':'', 'user_name':'','password':'', 'tenant': ''})[0]
|
||||||
|
|
||||||
|
|
||||||
####
|
####
|
||||||
@ -177,6 +178,9 @@ def deploy():
|
|||||||
signals.connect(keystone_service1, glance_api_endpoint, {'ip': 'keystone_host', 'admin_port': 'keystone_port'})
|
signals.connect(keystone_service1, glance_api_endpoint, {'ip': 'keystone_host', 'admin_port': 'keystone_port'})
|
||||||
signals.connect(haproxy_glance_api_config, glance_api_endpoint, {'listen_port': 'admin_port'})
|
signals.connect(haproxy_glance_api_config, glance_api_endpoint, {'listen_port': 'admin_port'})
|
||||||
signals.connect(haproxy_glance_api_config, glance_api_endpoint, {'listen_port': 'port'})
|
signals.connect(haproxy_glance_api_config, glance_api_endpoint, {'listen_port': 'port'})
|
||||||
|
signals.connect(node1, openrc)
|
||||||
|
signals.connect(keystone_service1, openrc, {'ip': 'keystone_host', 'admin_port':'keystone_port'})
|
||||||
|
signals.connect(admin_user, openrc, {'user_name': 'user_name','user_password':'password', 'tenant_name': 'tenant'})
|
||||||
|
|
||||||
|
|
||||||
errors = vr.validate_resources()
|
errors = vr.validate_resources()
|
||||||
@ -205,6 +209,7 @@ def deploy():
|
|||||||
actions.resource_action(admin_user, 'run')
|
actions.resource_action(admin_user, 'run')
|
||||||
actions.resource_action(admin_role, 'run')
|
actions.resource_action(admin_role, 'run')
|
||||||
actions.resource_action(keystone_service_endpoint, 'run')
|
actions.resource_action(keystone_service_endpoint, 'run')
|
||||||
|
actions.resource_action(openrc, 'run')
|
||||||
|
|
||||||
actions.resource_action(services_tenant, 'run')
|
actions.resource_action(services_tenant, 'run')
|
||||||
actions.resource_action(glance_keystone_user, 'run')
|
actions.resource_action(glance_keystone_user, 'run')
|
||||||
@ -276,6 +281,7 @@ def undeploy():
|
|||||||
actions.resource_action(resources['glance_keystone_user'], 'remove')
|
actions.resource_action(resources['glance_keystone_user'], 'remove')
|
||||||
actions.resource_action(resources['glance_keystone_tenant'], 'remove')
|
actions.resource_action(resources['glance_keystone_tenant'], 'remove')
|
||||||
|
|
||||||
|
actions.resource_action(resources['openrc_file'], 'remove')
|
||||||
actions.resource_action(resources['keystone_service_endpoint'], 'remove')
|
actions.resource_action(resources['keystone_service_endpoint'], 'remove')
|
||||||
actions.resource_action(resources['admin_role'], 'remove')
|
actions.resource_action(resources['admin_role'], 'remove')
|
||||||
actions.resource_action(resources['admin_user'], 'remove')
|
actions.resource_action(resources['admin_user'], 'remove')
|
||||||
|
5
resources/openrc_file/actions/remove.yaml
Normal file
5
resources/openrc_file/actions/remove.yaml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
- hosts: [ {{ ip }} ]
|
||||||
|
sudo: yes
|
||||||
|
tasks:
|
||||||
|
- file: path=/root/openrc state=absent
|
||||||
|
|
10
resources/openrc_file/actions/run.yaml
Normal file
10
resources/openrc_file/actions/run.yaml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
- hosts: [{{ ip }}]
|
||||||
|
sudo: yes
|
||||||
|
vars:
|
||||||
|
tenant: {{tenant}}
|
||||||
|
user_name: {{user_name}}
|
||||||
|
password: {{password}}
|
||||||
|
keystone_host: {{keystone_host}}
|
||||||
|
keystone_port: {{keystone_port}}
|
||||||
|
tasks:
|
||||||
|
- template: src={{resource_dir}}/templates/openrc.template dest=/root/openrc
|
29
resources/openrc_file/meta.yaml
Normal file
29
resources/openrc_file/meta.yaml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
id: nova_config
|
||||||
|
handler: ansible
|
||||||
|
version: 1.0.0
|
||||||
|
|
||||||
|
input:
|
||||||
|
keystone_host:
|
||||||
|
schema: str!
|
||||||
|
value:
|
||||||
|
keystone_port:
|
||||||
|
schema: int!
|
||||||
|
value:
|
||||||
|
tenant:
|
||||||
|
schema: str!
|
||||||
|
value:
|
||||||
|
user_name:
|
||||||
|
schema: str!
|
||||||
|
value:
|
||||||
|
password:
|
||||||
|
schema: str!
|
||||||
|
value:
|
||||||
|
ip:
|
||||||
|
schema: str!
|
||||||
|
value:
|
||||||
|
ssh_key:
|
||||||
|
schema: str!
|
||||||
|
value:
|
||||||
|
ssh_user:
|
||||||
|
schema: str!
|
||||||
|
value:
|
9
resources/openrc_file/templates/openrc.template
Normal file
9
resources/openrc_file/templates/openrc.template
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
export LC_ALL=C
|
||||||
|
export OS_NO_CACHE="true"
|
||||||
|
export OS_TENANT_NAME={{tenant}}
|
||||||
|
export OS_USERNAME={{user_name}}
|
||||||
|
export OS_PASSWORD={{password}}
|
||||||
|
export OS_AUTH_URL=http://{{keystone_host}}:{{keystone_port}}/v2.0
|
||||||
|
export OS_AUTH_STRATEGY=keystone
|
||||||
|
export OS_REGION_NAME='RegionOne'
|
Loading…
Reference in New Issue
Block a user