Commit | Line | Data |
---|---|---|
3ea0152b MJ |
1 | --- |
2 | # Include variables and define needed variables. | |
3 | - name: Include OS-specific variables. | |
9e2e4e6b MJ |
4 | include_vars: "{{ item }}" |
5 | with_first_found: | |
6 | - "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml" | |
7 | - "{{ ansible_distribution }}.yml" | |
8 | - "{{ ansible_os_family }}.yml" | |
3ea0152b MJ |
9 | |
10 | # Setup/install tasks. | |
11 | - include: setup-RedHat.yml | |
9e2e4e6b | 12 | when: ansible_os_family in ['RedHat', 'Rocky'] |
3ea0152b MJ |
13 | |
14 | - include: setup-Debian.yml | |
15 | when: ansible_os_family == 'Debian' | |
16 | ||
1be0d012 MJ |
17 | - include: setup-Alpine.yml |
18 | when: ansible_os_family == 'Alpine' | |
19 | ||
599b56d0 MJ |
20 | - include: setup-Suse.yml |
21 | when: ansible_os_family == 'Suse' | |
22 | ||
5e186c3f MJ |
23 | - name: Set up authorized_keys for the root user |
24 | authorized_key: | |
25 | user: 'root' | |
26 | key: '{{ item }}' | |
27 | with_file: | |
28 | - public_keys/mjeanson.pub | |
29 | - public_keys/joraj.pub | |
30 | - public_keys/jgalar.pub | |
31 | - public_keys/frdeso.pub | |
32 | - public_keys/mdesnoyers.pub | |
33 | - public_keys/smarchi.pub | |
34 | - public_keys/pproulx.pub | |
35 | ||
a517d31d MJ |
36 | - name: Remove ubuntu user |
37 | user: | |
38 | name: ubuntu | |
39 | state: absent | |
40 | remove: yes | |
41 | ||
422aaa6e MJ |
42 | - name: Remove debian user |
43 | user: | |
44 | name: debian | |
45 | state: absent | |
46 | remove: yes | |
47 | ||
33436c91 MJ |
48 | - name: Create jenkins user |
49 | user: | |
50 | name: 'jenkins' | |
51 | ||
52 | - name: Set up authorized_keys for the jenkins user | |
53 | authorized_key: | |
54 | user: 'jenkins' | |
55 | key: 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDA3fwpioVLDoCQsQkYK5bOwPb8N0EXeYm2MleBQTfqxtKaqWWbmUtFXAiyclKHRspjcAiIKwwqLyhPopHBqJzmXnB0GsfGmxXJ6wSBgKJ4kdBVRM+nKlK0wCl1oQkFeV/Xl3jzt1Ey96XiNWlesfkvgcMCpsJzQ7/xRb9IcghskzlQbLOwDNir/156JgAYUYvOLqNCcE+xcgPxJGanfZDXTLkfBYxaeaB8isBPeEU6fhPvu/W055M1uB7E0qhcbFtuKCBu1Fg4jzsW4yDU8+ZB1b5mAXwEAuMbVGMrOf4rjtTpGpQd6XFsXpFT28NU1u5j2cUbtANJalkNDX/UY6XJ jenkins@ci-master-02' | |
56 | ||
a517d31d MJ |
57 | #- name: Create sudoers.d directory. |
58 | # file: | |
59 | # path: /etc/sudoers.d | |
60 | # owner: root | |
61 | # group: root | |
62 | # mode: 0755 | |
63 | # state: directory | |
64 | # | |
65 | #- name: Set includedir in /etc/sudoers. | |
66 | # lineinfile: | |
67 | # dest: /etc/sudoers | |
68 | # line: "#includedir /etc/sudoers.d" | |
69 | # state: present | |
70 | # validate: "/usr/sbin/visudo -cf %s" | |
71 | # | |
72 | #- name: Create jenkins sudoers file. | |
73 | # copy: | |
74 | # dest: "/etc/sudoers.d/jenkins" | |
75 | # content: "jenkins ALL=NOPASSWD: ALL" | |
76 | # mode: 0440 | |
77 | # owner: root | |
78 | # group: root | |
79 | # validate: "/usr/sbin/visudo -cf %s" | |
80 | ||
81 | - name: Remove jenkins sudoers file | |
3ea0152b | 82 | file: |
a517d31d MJ |
83 | path: "/etc/sudoers.d/jenkins" |
84 | state: absent |