 
		
		
		
		
		
	
			
		
		
			
					
		Hello folks,
within the 3rd task of this guided exercise the public key of 4 users will be deployed with the following playbook:
- name: Third task
  hosts: servera.lab.example.com
  gather_facts: false
  become: true
  tasks:
    - name: Set up authorized keys
      ansible.posix.authorized_key:
        user: developer
        state: present
        key: "{{ lookup('ansible.builtin.file', item) }}" loop: "{{ public_key_lists | map(attribute='public_keys') | flatten }}"This works like a charm.
But when adding a ssh key, you should also be able to remove it.
But when I try to remove a key from one of the users e.g. lisa ( adding exclusive: true to the module), the playbook isn't working. All the 4 keys will be removed in this case. Does anyone knows how to modify the playbook to be able to remove a key ?
Thanks a lot in advance.
regards Hendrik
 carlos_arias
		
			carlos_arias
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi Hendrik,
Now I can only think of an alternative such creating another group_vars file to remove a particular key, with the same structure as the ~/data-loops/group_vars/all/my_vars.yml file, but only including the names of the users to remove the key.
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.