]> git.madduck.net Git - code/vinst.git/blob - preseed/jessie/commands/late_commands.d/ansible_user

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

10adacdbd70fc84e7d1b7f47d36d5bf5ec008206
[code/vinst.git] / preseed / jessie / commands / late_commands.d / ansible_user
1 #!/bin/sh
2
3 export DEBCONF_FRONTEND=noninteractive
4 apt-get install -y sudo
5
6 USER=ansible
7 echo "Adding $USER user and installing SSH key"
8
9 HOME=/var/lib/$USER
10 adduser --home $HOME --shell /bin/sh \
11   --uid 999 --gid 65534 --disabled-password \
12   --gecos 'Remote control with ansible' $USER
13
14 install -d -m 700 -o $USER -g nogroup $HOME/.ssh
15 cat <<_eof > $HOME/.ssh/authorized_keys
16 no-agent-forwarding,no-port-forwarding,no-user-rc,no-X11-forwarding ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDGUrO3VGYap3uyphcExiA4VXjXzwyiqXA4kD3o3uLi45Lw9TFCefwa815R4JkRhaGs/4pqy4Bqcmb6kbEOEaTS6xidedQOcuHIxk6nZfDAhGm95rmx1kSxgLIBYJn0RPFvdRiFuoGC07tn4FRQ/seiTVbbTtgy7Wrb3XqFMPhBp1EFfe0ASZdEUJ/EfZl/a72y/57DTflL6RzPIWF6t0z5URURSm3caC4Uxpvx3FK37xzXOd0il7ikv1UeC5pMopwR74zb9SfFiPVEcOK64jq8xnS7ugTOrlb+H5JwchOO88eUTD1pd72+4a7XkeHzneXT8mNROQJZUU1vxoJpZXFziL0uCtnR9QVt+/mE4q3MiYjq5YYOXYCJ0vKIDKVAkxv3U71N8WpnasLmC5mal7juuj8tHXqQJc8bNt7ZxoSRESwRjhIXmoIxdkso862KTM7FL5SKPGDwE8ifog4OU3PcI8C5dfTY1vMa7mZszsO3sK1+gpiJBUlWu0nv9Q2qB3KDPoKA/VnPGBitQSIMbFgDfUs/JXJ35q4ynxO/h0NqCPGXx1bECc6meepND99qo301kYPxYLY4FVeFMVJbcdS/kn0YxbMikaRmr3SqxaRUb4vl1NDKdtoIcIyS0Gh4AvTYtxlLZwShf8ImtRzLerLwqx73WWSIeNai+pHJJNTMvw== madduck@fishbowl
17 _eof
18 chmod -R u=rwX,og= $HOME
19 chown -R ${USER}.nogroup $HOME
20
21 SUDOFILE=/etc/sudoers.d/local-ansible-user
22 cat <<_eof > $SUDOFILE
23 Defaults>ansible !requiretty
24 $USER $(hostname --fqdn)=(root) NOPASSWD: ALL
25 _eof
26 chmod 440 $SUDOFILE