Created
February 27, 2018 09:42
-
-
Save echo-devnull/4d13c8f8931d1e62823082a663a6bcc3 to your computer and use it in GitHub Desktop.
Creating a Jenkins User and automatically add the SSH key to github
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Setup Jenkins user | |
user: | |
name: jenkins | |
state: present | |
groups: docker,admin | |
generate_ssh_key: true | |
append: yes | |
comment: "Jenkins Slave User" | |
update_password: on_create | |
password: "$6$rounds=656000$tEpd0QsWMpIusdfgdgdfgdfgdfgdgdfgYWe6qhOxheJwsiDM/" | |
- name: Read SSH public key to authorize | |
shell: cat /home/jenkins/.ssh/id_rsa.pub | |
register: ssh_pub_key | |
- name: Authorize key with GitHub | |
local_action: | |
module: github_key | |
name: Access Key for Elect Jenkins Build Machine | |
token: 'dgdfgdfgfdgdfgdfgdfgdf' | |
pubkey: '{{ ssh_pub_key.stdout }}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment