Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ and this project adheres to
- Report cluster settings in `firehpc status`.
- Introduce `firehpc update` command to change cluster settings.
- Introduce `firehpc bootstrap` command to create deployment environments.
- Add `firehpc {conf,deploy} --ansible-opts` option to append additional options
to `ansible-playbook` command (#44).
- Integrated management of virtual environment to multiple versions of Ansible
depending on targeted OS (#24).
- Add PIP requirements files to populate _ansible-latest_ and _ansible-2.16_
Expand Down Expand Up @@ -84,6 +86,7 @@ and this project adheres to
- Mention `firehpc bootstrap` command in manpage.
- Mention cluster settings and `firehpc update` command in manpage.
- Update README.md to mention bootstrap step in usage guide.
- Mention `--ansible-opts` option in manpage.
- pkgs: Introduce tests extra package with dependencies required to run tests.

### Changed
Expand Down
8 changes: 8 additions & 0 deletions docs/man/firehpc.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ This command accepts the following options:
container and with a specific version of Slurm compiled to support emulation
of arbitrary large number of fakes nodes. By default, value from cluster
settings is used.

[.cli-opt]#*--ansible-opts*# [.cli-optval]##_OPT …_##::
Additional option to add to ansible-playbook command. Multiple options can be
given.
--

[.cli-opt]#*deploy*#::
Expand Down Expand Up @@ -162,6 +166,10 @@ This command accepts the following options:
Instead of randomly generating a new users directory, extract users directory
from another existing cluster. This is useful to create the have the same user
accounts on several clusters.

[.cli-opt]#*--ansible-opts*# [.cli-optval]##_OPT …_##::
Additional option to add to ansible-playbook command. Multiple options can be
given.
--
+
This command saves values of [.cli-opt]#*--db*#, [.cli-opt]#*--schema*#,
Expand Down
4 changes: 4 additions & 0 deletions firehpc/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def conf(
tags: Optional[list[str]] = None,
skip_tags: Optional[list[str]] = None,
users_directory: Optional[UsersDirectory] = None,
ansible_opts: Optional[list[str]] = None,
) -> conf:
if reinit:
self.state.conf_clean()
Expand Down Expand Up @@ -232,6 +233,9 @@ def insert_in_node_type():
f"{self.runtime_settings.ansible.args} --extra-vars @{self.state.extravars}"
)

if ansible_opts is not None and len(ansible_opts):
cmdline += f" {' '.join(ansible_opts)}"

if tags is not None and len(tags):
cmdline += f" --tags {','.join(tags)}"

Expand Down
12 changes: 12 additions & 0 deletions firehpc/exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ def __init__(self):
"--users",
help="Extract users directory from another emulated cluster",
)
parser_deploy.add_argument(
"--ansible-opts",
help="Additional ansible-playbook options",
nargs="*",
)
parser_deploy.set_defaults(func=self._execute_deploy)

# conf command
Expand Down Expand Up @@ -149,6 +154,11 @@ def __init__(self):
help="Enable Slurm emulator mode",
action="store_true",
)
parser_conf.add_argument(
"--ansible-opts",
help="Additional ansible-playbook options",
nargs="*",
)
parser_conf.set_defaults(func=self._execute_conf)

# restore command
Expand Down Expand Up @@ -377,6 +387,7 @@ def _execute_deploy(self):
db,
playbooks=["bootstrap", "site"],
users_directory=users_directory,
ansible_opts=self.args.ansible_opts,
)

def _execute_conf(self):
Expand All @@ -398,6 +409,7 @@ def _execute_conf(self):
playbooks=playbooks,
reinit=False,
tags=self.args.tags,
ansible_opts=self.args.ansible_opts,
)

def _execute_restore(self):
Expand Down
4 changes: 2 additions & 2 deletions lib/bash-completion/firehpc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ _firehpc_conf() {
[CLUSTER]='--cluster'
[DIR]='-c --custom'
[FILE]='--db --schema'
[ARG]='--tags'
[ARG]='--tags --ansible-opts'
)
if __contains_word "$prev" ${OPTS[CLUSTER]}; then
comps=$( __firehpc_clusters_list )
Expand Down Expand Up @@ -104,7 +104,7 @@ _firehpc_deploy() {
[OS]='--os'
[DIR]='-c --custom'
[FILE]='--db --schema'
[ARG]='--tags'
[ARG]='--ansible-opts'
)
if __contains_word "$prev" ${OPTS[CLUSTER]}; then
comps=$( __firehpc_clusters_list )
Expand Down