Compare commits

...

3 Commits

2 changed files with 34 additions and 24 deletions

View File

@ -1,11 +1,16 @@
#!/usr/bin/env bash
set -xe
#=======================================================================================================
# Import Cadoles seed
#=======================================================================================================
cucchiaiata-cli v1.setting.source.create --source_name Cadoles --source_directory /usr/share/risotto/seed/cadoles
function get_id() {
S=$($1)
V=$(echo $S|jq -r .session_id)
if [ $? = 0 ]; then
echo $V
else
echo $S
exit 1
fi
}
#=======================================================================================================
# Infrastructure
@ -28,12 +33,12 @@ cucchiaiata-cli v1.user.role.create --user_login gnunux \
# +~~~~~~~~~~+
cucchiaiata-cli v1.infra.zone.create --zone_name internet
# zone configuration
S=$(cucchiaiata-cli v1.setting.session.zone.start --zone_name internet | jq -r .session_id)
cucchiaiata-cli v1.setting.session.configure --session_id "$S" --configuration.network.network "192.168.1.0/24" \
--configuration.network.host_start "192.168.1.10" \
--configuration.network.host_end "192.168.1.100" \
--configuration.network.dns 192.168.1.2 \
--configuration.network.gateway 192.168.1.254
S=$(get_id "cucchiaiata-cli v1.setting.session.zone.start --zone_name internet")
cucchiaiata-cli v1.setting.session.configure --session_id "$S" --configuration.network "192.168.1.0/24" \
--configuration.host_start "192.168.1.10" \
--configuration.host_stop "192.168.1.100" \
--configuration.dns 192.168.1.2 \
--configuration.gateway 192.168.1.254
cucchiaiata-cli v1.setting.session.validate --session_id $S
cucchiaiata-cli v1.setting.session.stop --session_id "$S" --save
@ -47,11 +52,12 @@ cucchiaiata-cli v1.setting.session.stop --session_id "$S" --save
# +---------------------------+
cucchiaiata-cli v1.infra.cluster.create --cluster_name cluster.cadoles.com \
--zone_name internet
cucchiaiata-cli v1.infra.cluster.node.create --server_name node1.cadoles.com \
cucchiaiata-cli v1.infra.cluster.node.create --node_name node1.cadoles.com \
--cluster_name cluster.cadoles.com \
--zones_name internet
# configuration
S=$(cucchiaiata-cli v1.setting.session.cluster.start --cluster_name cluster.cadoles.com | jq -r .session_id)
S=$(get_id "cucchiaiata-cli v1.setting.session.cluster.start --cluster_name cluster.cadoles.com")
cucchiaiata-cli v1.setting.session.configure --session_id "$S" --configuration.network.virtual_ip "192.168.1.1"
cucchiaiata-cli v1.setting.session.validate --session_id $S
cucchiaiata-cli v1.setting.session.stop --session_id "$S" --save
@ -93,14 +99,14 @@ cucchiaiata-cli v1.setting.servermodel.create --servermodel_name unbound_etab1 -
# configuration
# Servermodel ACA
S=$(cucchiaiata-cli v1.setting.session.servermodel.start --servermodel_name aca| jq -r .session_id)
S=$(get_id "cucchiaiata-cli v1.setting.session.servermodel.start --servermodel_name aca")
cucchiaiata-cli v1.setting.session.configure --session_id "$S" --configuration.serveur_ssh.ssh_allow_networks admin.cadoles.com
cucchiaiata-cli v1.setting.session.stop --session_id "$S" --save
# Servermodel unbound
S=$(cucchiaiata-cli v1.setting.session.servermodel.start --servermodel_name unbound| jq -r .session_id)
S=$(get_id "cucchiaiata-cli v1.setting.session.servermodel.start --servermodel_name unbound")
cucchiaiata-cli v1.setting.session.configure --session_id "$S" --configuration.serveur_dns.unbound_local_zones cadoles.com \
--configuration.reseau.unbound_route_address 192.168.1.2 \
--configuration.reseau.unbound_route_address 192.168.1.254 \
--configuration.serveur_dns.unbound_allowed_client_cidr 192.168.1.0/24
cucchiaiata-cli v1.setting.session.filter --session_id "$S" --namespace unbound
cucchiaiata-cli v1.setting.session.configure --session_id "$S" --unbound.unbound_zone_cadoles_com.hostname_cadoles_com.hostname_cadoles_com toto titi \
@ -110,7 +116,7 @@ cucchiaiata-cli v1.setting.session.configure --session_id "$S" --unbound.unbound
cucchiaiata-cli v1.setting.session.stop --session_id "$S" --save
# Servermodel unbound_etab1
S=$(cucchiaiata-cli v1.setting.session.servermodel.start --servermodel_name unbound_etab1 | jq -r .session_id)
S=$(get_id "cucchiaiata-cli v1.setting.session.servermodel.start --servermodel_name unbound_etab1")
cucchiaiata-cli v1.setting.session.configure --session_id "$S" --configuration.reseau.unbound_domain_name dns.cadoles.com
cucchiaiata-cli v1.setting.session.stop --session_id "$S" --save
@ -129,12 +135,13 @@ cucchiaiata-cli v1.infra.server.create --server_name dns.cadoles.com \
--zones_name internet \
--servermodel_name unbound_etab1
# configuration
S=$(cucchiaiata-cli v1.setting.session.server.start --server dns.cadoles.com | jq -r .session_id)
sleep 1
S=$(get_id "cucchiaiata-cli v1.setting.session.server.start --server dns.cadoles.com")
cucchiaiata-cli v1.setting.session.configure --session_id "$S" --configuration.reseau.unbound_ip_address_cidr 192.168.1.2/24
cucchiaiata-cli v1.setting.session.filter --session_id "$S" --namespace opennebula
cucchiaiata-cli v1.setting.session.configure --session_id "$S" --opennebula.configuration.cpu 0.2 \
--opennebula.configuration.vcpu 2 \
--opennebula.configuration.memory 2
cucchiaiata-cli v1.setting.session.configure --session_id "$S" --opennebula.cpu 0.2 \
--opennebula.vcpu 2 \
--opennebula.memory 2
cucchiaiata-cli v1.setting.session.validate --session_id $S
cucchiaiata-cli v1.setting.session.stop --session_id "$S" --save

View File

@ -65,8 +65,11 @@ class Configuration(Common):
def get(self):
parameters = self.get_parameters()
tiramisu_config = self.configure_server()
option = next(tiramisu_config.option.list('all'))
namespace = option.option.path().split('.', 1)[0]
parser = TiramisuCmdlineParser(tiramisu_config,
self.prog,
root=namespace,
unrestraint=True,
fullpath=True)
parser.parse_args(parameters,