192 | | |
| 192 | ---- |
| 193 | Now to chop out the current emulab account creationg code and replace it with chef. |
| 194 | |
| 195 | 1. edit {{{/usr/local/etc/emulab/rc/rc.accounts}}} to just call {{{sudo chef-client}}} |
| 196 | * The {{{rc.accounts}}} script also creates groups and removes unspecified groups and accounts, so I need to update the recipe to do the same. |
| 197 | * {{{rc.accounts}}} supports boot, shutdown, reconfig, and reset modes. Just doing boot mode now. |
| 198 | * command line: argv[0] [boot|shutdown|reconfig|reset]. We're supporting "boot" only. |
| 199 | * It appeared to work after a re-boot. I set log level to debug and got a lot of warnings and errors, but it's hard to tell if those are "normal" chef errors or not. Everything at INFO level looked fine and the accounts were created. (Well they already existed, but chef confirmed that and would've created them if they had not existed. |
| 200 | * Here is the whole of rc.accounts now: |
| 201 | {{{ |
| 202 | #!/usr/bin/env bash |
| 203 | |
| 204 | action=${1:-boot} |
| 205 | |
| 206 | if [[ $action != boot && $action != shutdown && $action != reconfig && $action != reset ]]; then |
| 207 | echo Unsupported argument: $action |
| 208 | exit 1 |
| 209 | fi |
| 210 | |
| 211 | if [[ $action != boot ]]; then |
| 212 | echo Supported but unimplmented argument: $action |
| 213 | exit 2 |
| 214 | fi |
| 215 | |
| 216 | # do it. |
| 217 | echo Invoking chef-client to configure accounts and groups. |
| 218 | sudo chef-client -l debug |
| 219 | }}} |
| 220 | |
| 221 | ---- |