Skip to content

Instantly share code, notes, and snippets.

@base10
Created October 2, 2013 21:55
Show Gist options
  • Save base10/6801059 to your computer and use it in GitHub Desktop.
Save base10/6801059 to your computer and use it in GitHub Desktop.
Testing out users and user creation with ansible. Goal: Determine if running the user module regenerates ssh keys across multiple ansible runs. Context: Behavior seen by cheboygan in Ansible 1.2 series, reported in #ansible on October 2, 2013. Setup: - Ansible devel (as of bff47df) - Python 2.7.5 - Three Amazon EC2 instances, same AMI (spun up o…
- name: deploy test files
hosts: tag_Name_usertest
user: '{{ user }}'
sudo: true
gather_facts: True
vars:
new_user: nathan
tasks:
- name: generate ssh keys
user: >
name={{ new_user }}
generate_ssh_key=yes
ssh_key_type=rsa
ssh_key_bits=2048
ssh_key_comment="{{ new_user }}@{{ ansible_hostname }}[ansible-generated]"
tags: [ cluster-ssh ]
[~/Desktop/ansible-bug] ansible-playbook -i $ANSIBLE_HOME/plugins/inventory/ec2.py add-users.yml
PLAY [deploy test files] ******************************************************
GATHERING FACTS ***************************************************************
ok: [redacted1.example.com]
ok: [redacted2.example.com]
ok: [redacted3.example.com]
TASK: [generate ssh keys] *****************************************************
ok: [redacted2.example.com]
ok: [redacted1.example.com]
ok: [redacted3.example.com]
PLAY RECAP ********************************************************************
redacted3.example.com : ok=2 changed=0 unreachable=0 failed=0
redacted1.example.com : ok=2 changed=0 unreachable=0 failed=0
redacted2.example.com : ok=2 changed=0 unreachable=0 failed=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment