Zaktualizuj 'create.py'
This commit is contained in:
parent
e948c581b2
commit
ae57cbf8f1
14
create.py
14
create.py
@ -88,7 +88,7 @@ print(f"Tworzenie serwera db: {db_server.action.complete}")
|
|||||||
db_server = client.servers.get_by_name(f"{PREFIX}-db")
|
db_server = client.servers.get_by_name(f"{PREFIX}-db")
|
||||||
print(f"Serwer: {db_server.data_model.name}\n\tpubliczne IP: {db_server.data_model.public_net.ipv4.ip}\n\tprywatne IP: {db_server.data_model.private_net[0].ip}")
|
print(f"Serwer: {db_server.data_model.name}\n\tpubliczne IP: {db_server.data_model.public_net.ipv4.ip}\n\tprywatne IP: {db_server.data_model.private_net[0].ip}")
|
||||||
|
|
||||||
cloud_init_wp1=r'''
|
cloud_init_git=r'''
|
||||||
packages:
|
packages:
|
||||||
- apt-transport-https
|
- apt-transport-https
|
||||||
- ca-certificates
|
- ca-certificates
|
||||||
@ -130,18 +130,18 @@ runcmd:
|
|||||||
- cd /root/ && docker-compose up -d
|
- cd /root/ && docker-compose up -d
|
||||||
'''
|
'''
|
||||||
|
|
||||||
db_server = client.servers.create(
|
git_server = client.servers.create(
|
||||||
name=f"{PREFIX}-gitea",
|
name=f"{PREFIX}-gitea",
|
||||||
server_type=ServerType("cx11"),
|
server_type=ServerType("cx11"),
|
||||||
image=Image(name="ubuntu-20.04"),
|
image=Image(name="ubuntu-20.04"),
|
||||||
ssh_keys=[ssh_key],
|
ssh_keys=[ssh_key],
|
||||||
networks=[vnet],
|
networks=[vnet],
|
||||||
location=Location("hel1"),
|
location=Location("hel1"),
|
||||||
user_data=cloud_init_wp1
|
user_data=cloud_init_git
|
||||||
)
|
)
|
||||||
|
|
||||||
db_server.action.wait_until_finished()
|
git_server.action.wait_until_finished()
|
||||||
print(f"Tworzenie serwera db: {db_server.action.complete}")
|
print(f"Tworzenie serwera gitea: {gitea_server.action.complete}")
|
||||||
|
|
||||||
db_server = client.servers.get_by_name(f"{PREFIX}-db")
|
gitea_server = client.servers.get_by_name(f"{PREFIX}-gitea")
|
||||||
print(f"Serwer: {db_server.data_model.name}\n\tpubliczne IP: {db_server.data_model.public_net.ipv4.ip}\n\tprywatne IP: {db_server.data_model.private_net[0].ip}")
|
print(f"Serwer: {gitea_server.data_model.name}\n\tpubliczne IP: {gitea_server.data_model.public_net.ipv4.ip}\n\tprywatne IP: {gitea_server.data_model.private_net[0].ip}")
|
||||||
|
Loading…
Reference in New Issue
Block a user