1a4895f12fc62df9e4f653366ae57c9173c4add5
[lttng-ci.git] / automation / ansible / roles / common / tasks / main.yml
1 ---
2 # Include variables and define needed variables.
3 - name: Include OS-specific variables.
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"
9
10 # Setup/install tasks.
11 - include: setup-RedHat.yml
12 when: ansible_os_family in ['RedHat', 'Rocky']
13
14 - include: setup-Debian.yml
15 when: ansible_os_family == 'Debian'
16
17 - include: setup-Alpine.yml
18 when: ansible_os_family == 'Alpine'
19
20 - include: setup-Suse.yml
21 when: ansible_os_family == 'Suse'
22
23 - name: Set up authorized_keys for the root user
24 authorized_key:
25 user: 'root'
26 key: "{% for key in query('fileglob', 'public_keys/*.pub') %}{{ lookup('file', key) ~ '\n'}}{% endfor %}"
27 exclusive: true
28
29 - name: Remove ubuntu user
30 user:
31 name: ubuntu
32 state: absent
33 remove: yes
34
35 - name: Remove debian user
36 user:
37 name: debian
38 state: absent
39 remove: yes
40
41 - name: Create jenkins user
42 user:
43 name: 'jenkins'
44
45 - name: Set up authorized_keys for the jenkins user
46 authorized_key:
47 user: 'jenkins'
48 key: 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDA3fwpioVLDoCQsQkYK5bOwPb8N0EXeYm2MleBQTfqxtKaqWWbmUtFXAiyclKHRspjcAiIKwwqLyhPopHBqJzmXnB0GsfGmxXJ6wSBgKJ4kdBVRM+nKlK0wCl1oQkFeV/Xl3jzt1Ey96XiNWlesfkvgcMCpsJzQ7/xRb9IcghskzlQbLOwDNir/156JgAYUYvOLqNCcE+xcgPxJGanfZDXTLkfBYxaeaB8isBPeEU6fhPvu/W055M1uB7E0qhcbFtuKCBu1Fg4jzsW4yDU8+ZB1b5mAXwEAuMbVGMrOf4rjtTpGpQd6XFsXpFT28NU1u5j2cUbtANJalkNDX/UY6XJ jenkins@ci-master-02'
49
50 #- name: Create sudoers.d directory.
51 # file:
52 # path: /etc/sudoers.d
53 # owner: root
54 # group: root
55 # mode: 0755
56 # state: directory
57 #
58 #- name: Set includedir in /etc/sudoers.
59 # lineinfile:
60 # dest: /etc/sudoers
61 # line: "#includedir /etc/sudoers.d"
62 # state: present
63 # validate: "/usr/sbin/visudo -cf %s"
64 #
65 #- name: Create jenkins sudoers file.
66 # copy:
67 # dest: "/etc/sudoers.d/jenkins"
68 # content: "jenkins ALL=NOPASSWD: ALL"
69 # mode: 0440
70 # owner: root
71 # group: root
72 # validate: "/usr/sbin/visudo -cf %s"
73
74 - name: Remove jenkins sudoers file
75 file:
76 path: "/etc/sudoers.d/jenkins"
77 state: absent
This page took 0.030313 seconds and 3 git commands to generate.