Hello community,
I'm at very beginning of ansible understanding for now. And main goal is to
get proper keys for set of users on a new server. And work in normal mode
after.
Given: some server which have password ssh access for root (or sudoer like
azureuser for Microsoft Azure).
Goal: setup ~/.ssh/authorized_keys  for set of users e.g. root, azureuser,
deploy.
Problem: How to run particular task with prompted user and prompted
password.

Now I have a file with just one plain task:

---
- name: Set up authorized_keys for the deploy user
  authorized_key:
    user: "{{ item }}"
    key: "{{ lookup('file', 'configs/authorized_keys') }}"
    state: present
    exclusive: yes
    manage_dir: yes
  with_items: "{{ users_to_setup }}"

And a playbook file:

---
- hosts: all
  vars:
    users_to_setup:
      - root
      - deploy
      - azureuser
  tasks:
  - include: "common/server_setup.yml"

I run playbook file and I want interactively ask bootstrap_user and
bootstrap_password and then provide proper variables to the task in
server_setup to run this scenario using this bootstrap user. All other
tasks in playbook I want to run from root or deploy but with keys set up.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAC2xN8vKFMx%2B58sLTnyWNnQ4tHj7V--i%3DC3Dosxh-pV%3D1jJEPQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to