We can now access this value directly in the config dictionary. Signed-off-by: Erik Skultety <eskultet@xxxxxxxxxx> --- guests/lcitool | 19 +------------------ guests/playbooks/update/tasks/users.yml | 2 +- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/guests/lcitool b/guests/lcitool index a385c15..6c905c2 100755 --- a/guests/lcitool +++ b/guests/lcitool @@ -227,22 +227,6 @@ class Config: return vault_pass_file - def get_root_password_file(self): - root_pass_file = self._get_config_file("root-password") - - try: - with open(root_pass_file, "r") as infile: - if not infile.readline().strip(): - raise ValueError - except Exception as ex: - raise Exception( - "Missing or invalid root password file ({}): {}".format( - root_pass_file, ex - ) - ) - - return root_pass_file - def get_gitlab_runner_token_file(self): if self.get_flavor() != "gitlab": return None @@ -511,7 +495,6 @@ class Application: base = Util.get_base() vault_pass_file = self._config.get_vault_password_file() - root_pass_file = self._config.get_root_password_file() gitlab_url_file = self._config.get_gitlab_url_file() gitlab_runner_token_file = self._config.get_gitlab_runner_token_file() @@ -541,7 +524,7 @@ class Application: extra_vars = { "base": base, "playbook_base": playbook_base, - "root_password_file": root_pass_file, + "root_password": self._config.dict["install"]["root_password"], "flavor": self._config.dict["install"]["flavor"], "selected_projects": selected_projects, "git_remote": git_remote, diff --git a/guests/playbooks/update/tasks/users.yml b/guests/playbooks/update/tasks/users.yml index 28ee96a..8744290 100644 --- a/guests/playbooks/update/tasks/users.yml +++ b/guests/playbooks/update/tasks/users.yml @@ -2,7 +2,7 @@ - name: 'root: Set password' user: name: root - password: '{{ lookup("file", root_password_file)|password_hash("sha512") }}' + password: '{{ root_password|password_hash("sha512") }}' - name: 'root: Configure ssh access' authorized_key: -- 2.25.3