Delete previously added authorized keys and add new ones

0 votes
I have a few authorized keys already set, I wish to delete them and add a fresh authorized_key. How do I do that? Can I get a playbook that works?
Feb 11 in Ansible by Emily

recategorized Feb 11 54 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Hey @Emily, hope this works

- name: Set authorized key, removing all the authorized keys already set
  authorized_key:
    user: root
    key: '{{ item }}'
    state: present
    exclusive: True
  with_file:
    - public_keys/doe-jane
answered Feb 11 by John

Related Questions In Ansible

0 votes
1 answer

How do I add ssh authorized keys in ansible playbook?

Hey @kailash use the authorized_key plugin that ...READ MORE

answered Feb 11 in Ansible by Kyra
46 views
0 votes
1 answer

How do i set multiple authorized keys to my ansible playbook?

Try this: - name: Set up multiple authorized ...READ MORE

answered Feb 11 in Ansible by John
27 views
0 votes
1 answer

How can I create a new user using ansible ploybook?

You're switching from the root user. Root ...READ MORE

answered Mar 29, 2018 in Ansible by DareDev
• 6,520 points
69 views
0 votes
1 answer

How do I execute a shell script and then use the result in ansible

This can work out for you: - name: ...READ MORE

answered Apr 11, 2018 in Ansible by shubham
• 6,480 points
223 views
+13 votes
2 answers
0 votes
1 answer
0 votes
1 answer

Add authorized key taken from a URL - Ansible

Hey @Lopez, you can use the authorized_key ...READ MORE

answered Feb 11 in Ansible by Charlie
19 views
0 votes
1 answer

Add a node in Ansible

Follow these steps @Ruth: Generate ssh key ssh-keygen Check the ...READ MORE

answered Jan 8 in Ansible by Haider
8 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.