homelab/roles/jenkins/tasks/agent.yml

32 lines
614 B
YAML
Raw Permalink Normal View History

- 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 }}"
- name: Give Jenkins user passwordless sudo
template:
src: jenkins_sudoers.j2
dest: /etc/sudoers.d/{{ jenkins_user }}
validate: "visudo -cf %s"
mode: 0440
- name: Install Ansible
apt:
name: ansible
state: present
- name: Install Java
apt:
name: default-jre
state: present