Ian Wienand a6a4e5dfe5 vos-release: fix sudo
If you read the man page

 # This will cause sudo to read and parse any files in the /etc/sudoers.d
 # directory that do not end in '~' or contain a '.' character.

I don't know why sudo doesn't like files with a ".", but remove it

Fix the syntax in this file which has too many spaces

The theory that specifying a command means you can have nologin as
shell is debunked; change the shell to /bin/bash

 root@mirror-update01:~# ssh -i ~/.ssh/id_vos_release vos_release@afs01.dfw.openstack.org vos
 This account is currently not available.

Don't use shortcuts for positional parameters, suggested by jaltmann
in If70b27cb974eb8c1bafec2b7ef86d4f5cba3c4c5.

After hand applying these fixes, I can log in and run the script as
expected.

Change-Id: I058aadaa5ca5c7b8e94b275c4b8d26e1e0688ce8
2019-11-21 17:51:18 +11:00

35 lines
912 B
YAML

- name: Install vos release script
copy:
src: vos_release.sh
dest: '/usr/local/bin/'
owner: root
group: root
mode: 0755
- name: Install sudo permissions
copy:
src: vos_release.sudo
dest: '/etc/sudoers.d/vos_release'
owner: root
group: root
mode: 0440
- name: Create the vos_release user
user:
name: vos_release
comment: Remote user for "vos release"
shell: /bin/bash
- name: Ensure update key exists
assert:
that:
- hostvars[item]['vos_release_keypair'] is defined
with_inventory_hostnames: mirror-update
- name: Install vos_release remote key
authorized_key:
user: vos_release
state: present
key: '{{ hostvars[item]["vos_release_keypair"]["public_key"] }}'
key_options: 'command="/usr/local/bin/vos_release.sh",no-port-forwarding,no-agent-forwarding,no-X11-forwarding,no-pty'
with_inventory_hostnames: mirror-update