-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustomscripts.yml
46 lines (41 loc) · 1.26 KB
/
customscripts.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
---
# Check if files exists before copying them
- name: (CUSTOMSCRIPTS) Check if files already exist
stat:
path: /opt/bin
register: customscripts
- name: (DEBUG) Allow RSYNC for new super user without SUDO password
lineinfile:
path: /etc/sudoers
state: present
insertafter: '^%sudo'
line: "{{ ansible_user }} ALL=NOPASSWD: /usr/bin/rsync"
changed_when: false
when: not customscripts.stat.exists
- name: (CUSTOMSCRIPTS) Install custom scripts & executables
synchronize:
src: custom/
dest: "{{ customscripts_location }}"
links: yes
recursive: yes
when: not customscripts.stat.exists
- name: (DEBUG) Disallow RSYNC for new super user without SUDO password
lineinfile:
path: /etc/sudoers
state: absent
line: "{{ ansible_user }} ALL=NOPASSWD: /usr/bin/rsync"
changed_when: false
when: not customscripts.stat.exists
- name: (CUSTOMSCRIPTS) Include the custom scripts to the PATH environment variable
lineinfile:
path: /home/{{ user }}/.bashrc
line: PATH="$PATH:{{ customscripts_location }}"
when: not customscripts.stat.exists
- name: (CUSTOMSCRIPTS) Define the proper rights and owner
file:
path: /opt/bin
recurse: yes
owner: root
group: root
mode: 0755
when: not customscripts.stat.exists