Create and use Jenkins user

This commit is contained in:
Kris Lamoureux 2020-09-15 21:52:08 -04:00
parent 5daeae54cd
commit bf49f3c648
Signed by: kris
GPG Key ID: 3EDA9C3441EDA925
2 changed files with 17 additions and 0 deletions

View File

@ -1,2 +1,3 @@
jenkins_name: jenkins
jenkins_user: jenkins
jenkins_root: "/opt/{{ jenkins_name }}/jenkins_home"

View File

@ -1,3 +1,19 @@
- name: Create Jenkins user
user:
name: "{{ jenkins_user }}"
state: present
shell: /bin/bash
skeleton: /etc/skel
generate_ssh_key: true
- name: Set Jenkins authorized key
authorized_key:
user: jenkins
state: present
exclusive: true
key: "{{ jenkins_sshkey }}"
when: jenkins_sshkey is defined
- name: Install Ansible source
template:
src: ansible.list