4bae42cf7681a11ffdfe409f4b3ab804c549bc78
[releng.git] / prototypes / puppet-infracloud / modules / opnfv / manifests / controller.pp
1 # SPDX-license-identifier: Apache-2.0
2 ##############################################################################
3 # Copyright (c) 2016 RedHat and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9 class opnfv::controller (
10   $keystone_rabbit_password,
11   $neutron_rabbit_password,
12   $nova_rabbit_password,
13   $root_mysql_password,
14   $keystone_mysql_password,
15   $glance_mysql_password,
16   $neutron_mysql_password,
17   $nova_mysql_password,
18   $glance_admin_password,
19   $keystone_admin_password,
20   $neutron_admin_password,
21   $nova_admin_password,
22   $keystone_admin_token,
23   $ssl_key_file_contents,
24   $ssl_cert_file_contents,
25   $br_name,
26   $controller_public_address = $::fqdn,
27   $neutron_subnet_cidr,
28   $neutron_subnet_gateway,
29   $neutron_subnet_allocation_pools,
30   $opnfv_password,
31   $opnfv_email = 'opnfvuser@gmail.com',
32 ) {
33   # disable selinux if needed
34   if $::osfamily == 'RedHat' {
35     class { 'selinux':
36       mode   => 'permissive',
37       before => Class['::infracloud::controller'],
38     }
39   }
40
41   class { '::infracloud::controller':
42     keystone_rabbit_password         => $keystone_rabbit_password,
43     neutron_rabbit_password          => $neutron_rabbit_password,
44     nova_rabbit_password             => $nova_rabbit_password,
45     root_mysql_password              => $root_mysql_password,
46     keystone_mysql_password          => $keystone_mysql_password,
47     glance_mysql_password            => $glance_mysql_password,
48     neutron_mysql_password           => $neutron_mysql_password,
49     nova_mysql_password              => $nova_mysql_password,
50     keystone_admin_password          => $keystone_admin_password,
51     glance_admin_password            => $glance_admin_password,
52     neutron_admin_password           => $neutron_admin_password,
53     nova_admin_password              => $nova_admin_password,
54     keystone_admin_token             => $keystone_admin_token,
55     ssl_key_file_contents            => $ssl_key_file_contents,
56     ssl_cert_file_contents           => $ssl_cert_file_contents,
57     br_name                          => $br_name,
58     controller_public_address        => $controller_public_address,
59     neutron_subnet_cidr              => $neutron_subnet_cidr,
60     neutron_subnet_gateway           => $neutron_subnet_gateway,
61     neutron_subnet_allocation_pools  => $neutron_subnet_allocation_pools,
62   }
63
64   # create keystone creds
65   keystone_domain { 'opnfv':
66     ensure  => present,
67     enabled => true,
68   }
69
70   keystone_tenant { 'opnfv':
71     ensure      => present,
72     enabled     => true,
73     description => 'OPNFV cloud',
74     domain      => 'opnfv',
75     require     => Keystone_domain['opnfv'],
76   }
77
78   keystone_user { 'opnfv':
79     ensure   => present,
80     enabled  => true,
81     domain   => 'opnfv',
82     email    => $opnfv_email,
83     password => $opnfv_password,
84     require  => Keystone_tenant['opnfv'],
85   }
86
87   keystone_role { 'user': ensure => present }
88
89   keystone_user_role { 'opnfv::opnfv@opnfv::opnfv':
90     roles => [ 'user', 'admin', ],
91   }
92 }
93