gitea runs on port 22, ssh on port 2222
ci/woodpecker/pr/woodpecker Pipeline failed
Details
ci/woodpecker/pr/woodpecker Pipeline failed
Details
parent
947479fc31
commit
1eaa22b330
|
@ -0,0 +1,4 @@
|
||||||
|
gitea-service-group:
|
||||||
|
hosts:
|
||||||
|
{{ subdomain }}-host:
|
||||||
|
ansible_port: 2222
|
|
@ -90,6 +90,13 @@ class Infra:
|
||||||
|
|
||||||
return self.repo_path.joinpath(f"inventory/{subdomain}-backup.yml")
|
return self.repo_path.joinpath(f"inventory/{subdomain}-backup.yml")
|
||||||
|
|
||||||
|
def _service_path(self, subdomain: str) -> Path:
|
||||||
|
"""
|
||||||
|
utility method: get service file for a subdomain
|
||||||
|
"""
|
||||||
|
|
||||||
|
return self.repo_path.joinpath(f"inventory/{subdomain}-service.yml")
|
||||||
|
|
||||||
def _hostscript_path(self, subdomain: str) -> Path:
|
def _hostscript_path(self, subdomain: str) -> Path:
|
||||||
"""
|
"""
|
||||||
utility method: hostscript file for a subdomain
|
utility method: hostscript file for a subdomain
|
||||||
|
@ -114,6 +121,7 @@ class Infra:
|
||||||
"""
|
"""
|
||||||
self.repo.git.add(str(self._host_vars_dir(subdomain=subdomain)))
|
self.repo.git.add(str(self._host_vars_dir(subdomain=subdomain)))
|
||||||
self.repo.git.add(str(self._backup_path(subdomain=subdomain)))
|
self.repo.git.add(str(self._backup_path(subdomain=subdomain)))
|
||||||
|
self.repo.git.add(str(self._service_path(subdomain=subdomain)))
|
||||||
self.repo.git.add(str(self._hostscript_path(subdomain=subdomain)))
|
self.repo.git.add(str(self._hostscript_path(subdomain=subdomain)))
|
||||||
|
|
||||||
def _commit(self, action: str, subdomain: str):
|
def _commit(self, action: str, subdomain: str):
|
||||||
|
@ -204,6 +212,14 @@ class Infra:
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
service = self._service_path(subdomain)
|
||||||
|
with open(backup, "w", encoding="utf-8") as f:
|
||||||
|
f.write(
|
||||||
|
render_to_string(
|
||||||
|
"infrastructure/yml/service.yml", context={"subdomain": subdomain}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
# hostscript = self.repo_path.join("inventory/hosts-scripts/{instance.name}-host.sh")
|
# hostscript = self.repo_path.join("inventory/hosts-scripts/{instance.name}-host.sh")
|
||||||
|
|
||||||
self.write_hostscript(
|
self.write_hostscript(
|
||||||
|
@ -231,6 +247,9 @@ class Infra:
|
||||||
backup = self._backup_path(subdomain)
|
backup = self._backup_path(subdomain)
|
||||||
os.remove(backup)
|
os.remove(backup)
|
||||||
|
|
||||||
|
service = self._service_path(subdomain)
|
||||||
|
os.remove(service)
|
||||||
|
|
||||||
self.write_hostscript(
|
self.write_hostscript(
|
||||||
subdomain=subdomain,
|
subdomain=subdomain,
|
||||||
content=render_to_string(
|
content=render_to_string(
|
||||||
|
|
Loading…
Reference in New Issue