init
This commit is contained in:
		
							
								
								
									
										39
									
								
								roles/motd/tasks/main.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								roles/motd/tasks/main.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,39 @@
 | 
			
		||||
- name: Find unwanted motd scripts
 | 
			
		||||
  ansible.builtin.find:
 | 
			
		||||
    paths: /etc/update-motd.d/
 | 
			
		||||
    file_type: any
 | 
			
		||||
  register: collected_files
 | 
			
		||||
 | 
			
		||||
- name: Delete unwanted motd scripts
 | 
			
		||||
  ansible.builtin.file:
 | 
			
		||||
    path: "{{ item.path }}"
 | 
			
		||||
    state: absent
 | 
			
		||||
  with_items: "{{ collected_files.files }}"
 | 
			
		||||
 | 
			
		||||
- name: Remove Debian legal notice (/etc/motd)
 | 
			
		||||
  ansible.builtin.file:
 | 
			
		||||
    path: /etc/motd
 | 
			
		||||
    state: absent
 | 
			
		||||
 | 
			
		||||
- name: Detect Armbian
 | 
			
		||||
  ansible.builtin.stat:
 | 
			
		||||
    path: /etc/armbian-release
 | 
			
		||||
  register: armbian
 | 
			
		||||
 | 
			
		||||
- name: Add custom /etc/motd for Armbian
 | 
			
		||||
  ansible.builtin.copy:
 | 
			
		||||
    src: motd.orangepi
 | 
			
		||||
    dest: /etc/motd
 | 
			
		||||
    owner: root
 | 
			
		||||
    group: root
 | 
			
		||||
    mode: 0755
 | 
			
		||||
  when: armbian.stat.exists == True
 | 
			
		||||
 | 
			
		||||
- name: Add common custom /etc/motd
 | 
			
		||||
  ansible.builtin.copy:
 | 
			
		||||
    src: motd.cube
 | 
			
		||||
    dest: /etc/motd
 | 
			
		||||
    owner: root
 | 
			
		||||
    group: root
 | 
			
		||||
    mode: 0755
 | 
			
		||||
  when: armbian.stat.exists == False
 | 
			
		||||
		Reference in New Issue
	
	Block a user