ansible-debops-infrastructure

DebOps and Ansible scripts to manage my infrastructure
git clone git://git.erethon.com/ansible-debops-infrastructure
Log | Files | Refs

main.yml (896B)


      1 ---
      2 
      3 - name: Install packages
      4   openbsd_pkg:
      5     name: "{{ openbsd__packages }}"
      6     state: present
      7 
      8 - name: Create groups
      9   group:
     10     name: "{{ item.group | d(item.name) }}"
     11   with_flattened:
     12   - "{{ users__accounts }}"
     13 
     14 - name: Create management user
     15   user:
     16     name: "{{ item.name }}"
     17     group: "{{ item.group }}"
     18     state: "{{ item.state }}"
     19     append: "{{ item.append }}"
     20     shell: "{{ item.openbsdshell }}"
     21   with_items:
     22   - "{{ users__accounts }}"
     23 
     24 - name: Copy public ssh keys
     25   authorized_key:
     26     user: "{{ item.name }}"
     27     state: present
     28     key: "{{ item.sshkeys[0] }}"
     29   with_items:
     30   - "{{ users__accounts }}"
     31 
     32 - name: Add management user to doas.conf
     33   lineinfile:
     34     path: /etc/doas.conf
     35     state: present
     36     line: "permit nopass keepenv setenv { HOME } {{ item.name }} as root"
     37     create: yes
     38     mode: 0644
     39   with_items:
     40   - "{{ users__accounts }}"
     41   when: item.doas