Add an initial sudo role.
This commit is contained in:
parent
cd83e4756a
commit
ade7fd30f4
2
ansible/ansible.cfg
Normal file
2
ansible/ansible.cfg
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[defaults]
|
||||||
|
pipelining = True
|
1
ansible/environments/home/host_vars/homeserver
Normal file
1
ansible/environments/home/host_vars/homeserver
Normal file
@ -0,0 +1 @@
|
|||||||
|
os_flavor: "FreeBSD"
|
2
ansible/environments/home/hosts
Normal file
2
ansible/environments/home/hosts
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[headless]
|
||||||
|
homeserver ansible_user=talexander ansible_host=192.168.1.215
|
5
ansible/playbook.yaml
Normal file
5
ansible/playbook.yaml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
- hosts: all
|
||||||
|
vars:
|
||||||
|
ansible_become: True
|
||||||
|
roles:
|
||||||
|
- sudo
|
5
ansible/roles/sudo/tasks/main.yaml
Normal file
5
ansible/roles/sudo/tasks/main.yaml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
- name: Install packages
|
||||||
|
package:
|
||||||
|
name:
|
||||||
|
- sudo
|
||||||
|
state: present
|
25
ansible/run.bash
Executable file
25
ansible/run.bash
Executable file
@ -0,0 +1,25 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Run ansible
|
||||||
|
set -euo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
cd "$DIR"
|
||||||
|
|
||||||
|
function die {
|
||||||
|
code="$1"
|
||||||
|
shift 1
|
||||||
|
(>&2 echo "${@}")
|
||||||
|
exit "$code"
|
||||||
|
}
|
||||||
|
|
||||||
|
target="$1"
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
if [ "$target" = "homeserver" ]; then
|
||||||
|
ansible-playbook -v -i environments/home playbook.yaml --diff --limit homeserver "${@}"
|
||||||
|
elif [ "$target" = "dummy" ]; then
|
||||||
|
echo "dummy"
|
||||||
|
else
|
||||||
|
die 1 "Unrecognized target"
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user