@@ -48,10 +48,11 @@ public function getUsername(): string
4848 }
4949
5050 /**
51- * @param string $hostname
52- * @param array $roles
53- * @param array $options Extra host options
54- * @param array $sshOptions
51+ * @param string $hostname Hostname of the server
52+ * @param array|null $roles Roles for the server to be applied
53+ * @param array $options Extra host options
54+ * @param array $sshOptions
55+ * @see ServerRole
5556 * @return Server
5657 */
5758 public function addServer (
@@ -66,6 +67,28 @@ public function addServer(
6667 return $ server ;
6768 }
6869
70+ /**
71+ * Create a temporary (ephemeral) Hypernode instance based on given Hypernode.
72+ * The hostname will be defined during the deployment.
73+ *
74+ * @param string $appName Name of the Hypernode to base the ephemeral server on
75+ * @param array|null $roles Roles for the server to be applied
76+ * @param array $options Extra host options for Deployer
77+ * @see ServerRole
78+ * @return Server
79+ */
80+ public function addEphemeralServer (string $ appName , array $ roles = null , array $ options = []): Server
81+ {
82+ $ ephemeralOptions = [
83+ Server::OPTION_HN_EPHEMERAL => true ,
84+ Server::OPTION_HN_PARENT_APP => $ appName ,
85+ ];
86+ $ options = array_merge ($ ephemeralOptions , $ options );
87+ $ server = new Server ('' , $ roles , $ options );
88+ $ this ->servers [] = $ server ;
89+ return $ server ;
90+ }
91+
6992 /**
7093 * @return Server[]
7194 */
0 commit comments