Commit | Line | Data |
---|---|---|
3ea0152b MJ |
1 | --- |
2 | # Include variables and define needed variables. | |
3 | - name: Include OS-specific variables. | |
4 | include_vars: "{{ ansible_os_family }}.yml" | |
5 | ||
6 | - name: Define common_packages. | |
7 | set_fact: | |
8 | common_packages: "{{ __common_packages | list }}" | |
9 | when: common_packages is not defined | |
10 | ||
11 | # Setup/install tasks. | |
12 | - include: setup-RedHat.yml | |
13 | when: ansible_os_family == 'RedHat' | |
14 | ||
15 | - include: setup-Debian.yml | |
16 | when: ansible_os_family == 'Debian' | |
17 | ||
33436c91 MJ |
18 | - name: Create jenkins user |
19 | user: | |
20 | name: 'jenkins' | |
21 | ||
22 | - name: Set up authorized_keys for the jenkins user | |
23 | authorized_key: | |
24 | user: 'jenkins' | |
25 | key: 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDA3fwpioVLDoCQsQkYK5bOwPb8N0EXeYm2MleBQTfqxtKaqWWbmUtFXAiyclKHRspjcAiIKwwqLyhPopHBqJzmXnB0GsfGmxXJ6wSBgKJ4kdBVRM+nKlK0wCl1oQkFeV/Xl3jzt1Ey96XiNWlesfkvgcMCpsJzQ7/xRb9IcghskzlQbLOwDNir/156JgAYUYvOLqNCcE+xcgPxJGanfZDXTLkfBYxaeaB8isBPeEU6fhPvu/W055M1uB7E0qhcbFtuKCBu1Fg4jzsW4yDU8+ZB1b5mAXwEAuMbVGMrOf4rjtTpGpQd6XFsXpFT28NU1u5j2cUbtANJalkNDX/UY6XJ jenkins@ci-master-02' | |
26 | ||
3ea0152b MJ |
27 | - name: Create sudoers.d directory. |
28 | file: | |
29 | path: /etc/sudoers.d | |
30 | owner: root | |
31 | group: root | |
32 | mode: 0755 | |
33 | state: directory | |
34 | ||
35 | - name: Set includedir in /etc/sudoers. | |
36 | lineinfile: | |
37 | dest: /etc/sudoers | |
38 | line: "#includedir /etc/sudoers.d" | |
39 | state: present | |
40 | validate: "/usr/sbin/visudo -cf %s" | |
41 | ||
42 | - name: Create jenkins sudoers file. | |
43 | copy: | |
44 | dest: "/etc/sudoers.d/jenkins" | |
45 | content: "jenkins ALL=NOPASSWD: ALL" | |
46 | mode: 0440 | |
47 | owner: root | |
48 | group: root | |
49 | validate: "/usr/sbin/visudo -cf %s" |