We can use this new playbook to create the ansible user on nodes that
haven't been reimaged with our new cobbler kickstarts yet.
Signed-off-by: Andrew Schoen <aschoen@redhat.com>
--- /dev/null
+---
+# a playbook to create the necessary users, groups and
+# sudoer settings needed for ansible to manage a node.
+- hosts: all
+ # assuming the nodes we run this on will most likely
+ # have an ubuntu user already created.
+ vars:
+ ansible_ssh_user: ubuntu
+ roles:
+ - ansible-managed
--- /dev/null
+---
+- name: Create the sudo group.
+ group:
+ name: sudo
+ state: present
+
+- name: Create the ansible user.
+ user:
+ name: "{{ ansible_user }}"
+ group: sudo
+
+- name: Create the cephlab_sudo sudoers.d file.
+ template:
+ src: cephlab_sudo
+ dest: /etc/sudoers.d/cephlab_sudo
+ owner: root
+ group: root
+ mode: 0440
+ validate: visudo -cf %s
+
+- name: Add authorized keys for the ansible user.
+ authorized_key:
+ user: "{{ ansible_user }}"
+ key: "{{ item }}"
+ with_items: ssh_keys
--- /dev/null
+# {{ ansible_managed }}
+%sudo ALL=(ALL) NOPASSWD: ALL
+# For ansible pipelining
+Defaults !requiretty
+Defaults visiblepw
---
-# cobbler sets up the user that ansible will use
-ansible_user: cm
-
kickstarts:
- cephlab_trusty.preseed
- cephlab_rhel.ks