Skip to content

Commit

Permalink
Add md output of runbook(s)
Browse files Browse the repository at this point in the history
  • Loading branch information
fwolfst committed Nov 8, 2019
1 parent 93de968 commit 6c2dd14
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ run `bundle` to install `runbook` (you need to have ruby installed for all that)

## Updating runbooks

## Creating doc/*md from runbooks


## Tests

## Contributing
Expand Down
45 changes: 45 additions & 0 deletions doc/it/add_ldap_user.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# IT/Add LDAP User

This is a runbook that describes how to set up a user in our LDAP

## 1. Generate LDIF file

1. [] gather info

E-Mail-Address of user: into email

First Name of user: into first_name

Last Name of user: into last_name

Last UID/GID in LDAP: into last_gid

2. [] generate password

within: /home/felix/projects/self/glueckskeks/

capture: `bundle exec exe/glueckskeks` into passphrase

run:
```ruby
Unable to retrieve source code
```

3. [] output ldif file

run:
```ruby
Unable to retrieve source code
```

4. [] save as ldif file

run:
```ruby
Unable to retrieve source code
```

5. [] import ldif file in ldap

6. [] print or write down password (with phrase) for user

16 changes: 16 additions & 0 deletions runbooks_to_md.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env ruby

require 'runbook'

books = ["it/add_ldap_user.rb"]

# Runbooks register themselves to Runbook.books when they are defined
# (Or alternatively `runbook = eval(File.read("my_runbook.rb"))`)
books.each do |book|
filename = File.join("doc", book.sub('.rb', '.md'))

md = Runbook::Viewer.new(eval(File.read book)).generate(view: :markdown)

FileUtils.mkdir_p(File.dirname filename)
File.write(filename, md)
end

0 comments on commit 6c2dd14

Please sign in to comment.