From f03ad77ccf4fdc10af0e3cffc7d08aa4a0116769 Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Wed, 4 May 2022 11:46:00 +0200 Subject: Minor fixups for bashtard --- content/posts/2022/2022-04-25-bashtard-introduction.md | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/content/posts/2022/2022-04-25-bashtard-introduction.md b/content/posts/2022/2022-04-25-bashtard-introduction.md index bdc0010..f76ed4e 100644 --- a/content/posts/2022/2022-04-25-bashtard-introduction.md +++ b/content/posts/2022/2022-04-25-bashtard-introduction.md @@ -76,19 +76,19 @@ by the `bashtard` subcommand `add`, `sync`, and `del` respectively. I generally start with the `playbook_sync()` function first, since this is the function that'll ensure all the configurations are kept in sync with my desires. I want to have my own `sshd_config`, which needs some templating for the -`Subsystem sftp` line. There's a `template` function provided by bashtard, +`Subsystem sftp` line. There's a `file_template` function provided by bashtard, which does some very simple templating. I'll pass it the `sftp` variable to use. ```bash playbook_sync() { - template sshd_config \ + file_template sshd_config \ "sftp=$(config "ssh.sftp")" \ > /etc/ssh/sshd_config } ``` -Now to create the actual template. The `template` function looks for templates -in the `share` directory inside the playbook directory. +Now to create the actual template. The `file_template` function looks for +templates in the `share` directory inside the playbook directory. ```txt mkdir share @@ -167,7 +167,7 @@ My `sshd_config` template also specifies the use of a `Motd`, so that needs to be created as well. This can again be done using the `template` function. ```bash -template "motd" \ +file_template "motd" \ "fqdn=${BASHTARD_PLATFORM[fqdn]}" \ "time=$(date -u "+%FT%T")" \ > /etc/motd @@ -224,6 +224,13 @@ this, I'll add an `if` statement to skip reloading if `bashtard` is running the `add` command. ```bash +playbook_add() { + svc enable "sshd" + svc start "sshd" + + playbook_sync +} + playbook_sync() { ... -- cgit v1.1