feat: add basic setup playbook
This commit is contained in:
parent
a25d5884ce
commit
5ca07cf48d
4 changed files with 71 additions and 49 deletions
|
|
@ -1,8 +1,55 @@
|
|||
# yaml-language-server: $schema=https://raw.githubusercontent.com/ansible/ansible-lint/refs/heads/main/src/ansiblelint/schemas/playbook.json
|
||||
---
|
||||
- hosts: localhost
|
||||
- name: Initial setup for VM's in homelab
|
||||
hosts: proxmox_all
|
||||
user: root
|
||||
vars:
|
||||
secret: "{{ lookup('rbw', 'Work Laptop') }}"
|
||||
tasks:
|
||||
- name: Create motd.d dir
|
||||
file:
|
||||
path: /etc/motd.d
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
- name: Change login message
|
||||
template:
|
||||
src: ../files/alpine/motd.j2
|
||||
dest: /etc/motd.d/00-homelab
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
force: true
|
||||
|
||||
- debug:
|
||||
msg: the value of the secret is {{ secret.data.public_key }}
|
||||
- name: Setup alpine machines
|
||||
hosts: distro_alpine
|
||||
user: root
|
||||
vars:
|
||||
alpine_version: latest-stable
|
||||
tasks:
|
||||
- name: Update repositories
|
||||
template:
|
||||
src: ../files/alpine/repositories.j2
|
||||
dest: /etc/apk/repositories
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
backup: true
|
||||
notify:
|
||||
Update Apk Packages
|
||||
|
||||
- name: Be sure python is installed
|
||||
command: /sbin/apk add python3
|
||||
args:
|
||||
creates: /usr/bin/python3
|
||||
|
||||
- name: Allow users of the weel group to use doas command
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/doas.conf
|
||||
regexp: '^#\s*permit persist :wheel'
|
||||
line: 'permit persist :wheel'
|
||||
state: present
|
||||
|
||||
handlers:
|
||||
- name: Update Apk Packages
|
||||
command: /sbin/apk upgrade -U -a
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue