Syncing current state.
This commit is contained in:
		
							
								
								
									
										16
									
								
								roles/basics/bin/find-mirrors
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										16
									
								
								roles/basics/bin/find-mirrors
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,16 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
# File: find-mirrors
 | 
			
		||||
# 
 | 
			
		||||
# Description: This file generates a pacman mirrorlist to ensure hosts use the right mirrors for performance.
 | 
			
		||||
# 
 | 
			
		||||
# Package: AniNIX::Foundation/HelloWorld
 | 
			
		||||
# Copyright: WTFPL
 | 
			
		||||
#
 | 
			
		||||
# Author: DarkFeather <ircs://aninix.net:6697/DarkFeather>
 | 
			
		||||
 | 
			
		||||
country="United States"
 | 
			
		||||
 | 
			
		||||
curl -s https://raw.githubusercontent.com/archlinux/svntogit-packages/packages/pacman-mirrorlist/trunk/mirrorlist | awk '/^## '"$country"'$/{f=1; next}f==0{next}/^$/{exit}{print substr($0, 1);}' | sed 's/^#Server/Server/' > /tmp/mirrorlist 
 | 
			
		||||
rankmirrors -n 6 /tmp/mirrorlist > files/mirrorlist
 | 
			
		||||
rm /tmp/mirrorlist
 | 
			
		||||
@@ -1,29 +1,13 @@
 | 
			
		||||
--- 
 | 
			
		||||
###
 | 
			
		||||
# This role installs the basic package and host setup for AniNIX operations.
 | 
			
		||||
#
 | 
			
		||||
#
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
 - name: Set up AniNIX-specific repository
 | 
			
		||||
   become: yes
 | 
			
		||||
   file:
 | 
			
		||||
     path: /opt/aninix
 | 
			
		||||
     state: directory
 | 
			
		||||
 | 
			
		||||
 - name: Verify GPG keys
 | 
			
		||||
   ignore_errors: yes
 | 
			
		||||
   become: yes
 | 
			
		||||
   command: 
 | 
			
		||||
     cmd: gpg --homedir /etc/pacman.d/gnupg --list-key 1CC1E3F4ED06F296
 | 
			
		||||
   register: gpg_verify
 | 
			
		||||
   when: ansible_os_family == "Archlinux"
 | 
			
		||||
 | 
			
		||||
 - name: Install GPG keys
 | 
			
		||||
   become: yes
 | 
			
		||||
   command:
 | 
			
		||||
     cmd: /bin/bash -l -c 'pacman-key --recv-key 1CC1E3F4ED06F296; pacman-key --finger 1CC1E3F4ED06F296; pacman-key --lsign-key 1CC1E3F4ED06F296;'
 | 
			
		||||
   when: ansible_os_family == "Archlinux" and gpg_verify.rc != 0
 | 
			
		||||
 | 
			
		||||
 - name: Set up pacman.conf
 | 
			
		||||
   become: yes
 | 
			
		||||
   blockinfile:
 | 
			
		||||
@@ -88,13 +72,14 @@
 | 
			
		||||
   become: yes
 | 
			
		||||
   copy:
 | 
			
		||||
     dest: /etc/sudoers.d/basics
 | 
			
		||||
     content: "{{ lookup('env','USER') }} ALL=(ALL) NOPASSWD: ALL\n"
 | 
			
		||||
     content: "{{ ansible_user_id }} ALL=(ALL) NOPASSWD: ALL\n"
 | 
			
		||||
 | 
			
		||||
   # Remove unneeded file
 | 
			
		||||
 - file:
 | 
			
		||||
     path: /etc/sudoers.d/1001
 | 
			
		||||
     state: absent
 | 
			
		||||
 - name: Ensure we include /etc/sudoers.d
 | 
			
		||||
   become: yes
 | 
			
		||||
   lineinfile:
 | 
			
		||||
     path: /etc/sudoers
 | 
			
		||||
     regexp: "includedir /etc/sudoers.d"
 | 
			
		||||
     line: "includedir /etc/sudoers.d"
 | 
			
		||||
 | 
			
		||||
 - name: Test root password
 | 
			
		||||
   ignore_errors: yes
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user