2020-09-22 01:58:42 +00:00
|
|
|
- name: Create Jenkins user
|
2023-05-04 03:42:55 +00:00
|
|
|
ansible.builtin.user:
|
2020-09-22 01:58:42 +00:00
|
|
|
name: "{{ jenkins_user }}"
|
|
|
|
state: present
|
|
|
|
shell: /bin/bash
|
|
|
|
skeleton: /etc/skel
|
|
|
|
generate_ssh_key: true
|
|
|
|
|
|
|
|
- name: Set Jenkins authorized key
|
2023-05-04 03:42:55 +00:00
|
|
|
ansible.posix.authorized_key:
|
2020-09-22 01:58:42 +00:00
|
|
|
user: jenkins
|
|
|
|
state: present
|
|
|
|
exclusive: true
|
|
|
|
key: "{{ jenkins_sshkey }}"
|
|
|
|
|
|
|
|
- name: Give Jenkins user passwordless sudo
|
2023-05-04 03:42:55 +00:00
|
|
|
ansible.builtin.template:
|
2020-09-22 01:58:42 +00:00
|
|
|
src: jenkins_sudoers.j2
|
|
|
|
dest: /etc/sudoers.d/{{ jenkins_user }}
|
|
|
|
validate: "visudo -cf %s"
|
|
|
|
mode: 0440
|
|
|
|
|
|
|
|
- name: Install Ansible
|
2023-05-04 03:42:55 +00:00
|
|
|
ansible.builtin.apt:
|
2020-09-22 01:58:42 +00:00
|
|
|
name: ansible
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Install Java
|
2023-05-04 03:42:55 +00:00
|
|
|
ansible.builtin.apt:
|
2020-09-22 01:58:42 +00:00
|
|
|
name: default-jre
|
|
|
|
state: present
|