# The control node: ansible-core and greg's project, with no inventory yet # (task 1). pkg_installed ansible-core || { echo ansible-core >>"$LAB_STATE/missing"; pkg_install ansible-core; } user_add greg install -d -m 700 -o greg -g greg /home/greg/.ssh runuser -u greg -- ssh-keygen -q -t ed25519 -N '' -f /home/greg/.ssh/id_ed25519 install -d -m 755 -o greg -g greg /home/greg/ansible cat >/home/greg/ansible/ansible.cfg <<'EOF' [defaults] inventory = inventory remote_user = ansible host_key_checking = false EOF chown greg: /home/greg/ansible/ansible.cfg # The managed nodes. nodes_up 3 # greg's key goes to ansible on every node, and ansible may use sudo without # a password. for n in $(nodes_names); do in_node -i "$n" 'install -d -m 700 -o ansible -g ansible /home/ansible/.ssh && install -m 600 -o ansible -g ansible /dev/stdin /home/ansible/.ssh/authorized_keys && echo "ansible ALL=(ALL) NOPASSWD: ALL" >/etc/sudoers.d/ansible && chmod 440 /etc/sudoers.d/ansible'