Commit bc19f017 authored by nimrod's avatar nimrod
Browse files

Bootstrapping.

Roles for bootstrapping Debian, OpenBSD and OpenWRT hosts. Meaning,
being able to run Ansible tasks on them as targets.
parent 5abb2281
Loading
Loading
Loading
Loading
Loading

bootstrap.yaml

0 → 100644
+40 −0
Original line number Diff line number Diff line
---
- name: Group hosts by package manager
  hosts:
    - all
  tasks:
    - name: Group hosts by package manager
      group_by:
        key: pkg_mgr_{{ ansible_pkg_mgr }}
      tags:
        - always

- name: Bootstrap Debian hosts
  hosts:
    - pkg_mgr_apt
  tags:
    - debian
    - update
  gather_facts: false
  roles:
    - debian_bootstrap

- name: Bootstrap OpenWRT hosts
  hosts:
    - pkg_mgr_opkg
  tags:
    - openwrt
    - update
  gather_facts: false
  roles:
    - openwrt_bootstrap

- name: Bootstrap OpenBSD hosts
  hosts:
    - pkg_mgr_openbsd_pkg
  tags:
    - openbsd
    - update
  gather_facts: false
  roles:
    - openbsd_bootstrap
+21 −0
Original line number Diff line number Diff line
---
- name: Update APT sources
  raw: apt-get update
  changed_when: False

- name: APT install Python
  raw: DEBIAN_FRONTEND=noninteractive apt-get install -qy python3
  register: debian_bootstrap_install_python3
  changed_when: "'Unpacking' in debian_bootstrap_install_python3.stdout"

- name: Install requirements for more complete facts
  apt:
      name:
          - iproute
          - lsb-release
      state: present
      update_cache: yes
      cache_valid_time: 3600

- name: Gather facts
  setup:
+2 −0
Original line number Diff line number Diff line
---
openbsd_pkg_mirror: https://cdn.openbsd.org/pub/OpenBSD
+1 −0
Original line number Diff line number Diff line
---
+18 −0
Original line number Diff line number Diff line
---
- name: Install Python3
  raw: pkg_add -Iz py3-pip
  register: openbsd_pkg_add_python
  failed_when: "'error' in openbsd_pkg_add_python.stdout|lower"
  changed_when: "'extracting' in openbsd_pkg_add_python.stdout"

- name: Gather facts
  setup:

- name: Configure doas
  copy:
    content: |
      permit nopass keepenv root
      permit nopass keepenv nimrod
    dest: /etc/doas.conf
    mode: 0o0600
    validate: doas -C %s
Loading