Files
ansible/scraps/bootstrap.yml
T

106 lines
2.3 KiB
YAML

---
####
#### WARNING: This playbook should do exactly the same things as the bootstrap shell script.
#### The only exception is the script should run ansible-pull.sh when it's done.
####
#### ! Make sure to keep them in sync. !
####
# Update software repositories here
# Change the following to work with multiple distros
- name: bootstrap
hosts: all
become: yes
tasks:
- name: Install bootstrap packages
ansible.builtin.apt:
state: latest
pkg:
- bash
- curl
- python3
- python3-pip
- python3-venv
- python3-virtualenv
- name: Make sure hpf-sudo group exists
ansible.builtin.group:
name: hpf-sudo
state: present
system: true
gid: 700
- name: Make sure hpf-sudo-np group exists
ansible.builtin.group:
name: hpf-sudo-np
state: present
system: true
gid: 701
- name: Copy over /etc/sudoers.d/hpf
ansible.builtin.copy:
src: etc_sudoers_d_hpf
dest: /etc/sudoers.d/hpf
owner: root
group: root
mode: u=rw,go=
backup: true
validate: /usr/sbin/visudo -csf %s
- name: Make sure hpf-ans group exists
ansible.builtin.group:
name: hpf-ans
state: present
system: true
gid: 800
- name: Make sure hpf-ans user exists
ansible.builtin.user:
name: hpf-ans
state: present
system: true
uid: 800
group: hpf-ans
groups: hpf-sudo-np
append: yes
create_home: true
shell: /bin/bash
- name: Install latest version of pip in .ansible-venv
ansible.builtin.pip:
name: pip
virtualenv: $HOME/.ansible-venv
extra_args: --upgrade
become: no
- name: Install latest version of ansible in .ansible-venv
ansible.builtin.pip:
name: ansible
virtualenv: $HOME/.ansible-venv
extra_args: "--upgrade"
become: no
- name: Make sure bin directory exists
ansible.builtin.file:
path: $HOME/bin
state: directory
owner: hpf-ans
group: hpf-ans
mode: u=rwx,go=
become: no
- name: Copy over bin/ansible-pull.sh
ansible.builtin.copy:
src: home_hpf_ans_bin_ansible_pull_sh
dest: $HOME/bin/ansible-pull.sh
owner: hpf-ans
group: hpf-ans
mode: u=rwx,go=
become: no