ansible/roles/s6-rc/tasks/main.yml
2020-09-14 00:38:41 +02:00

119 lines
2.2 KiB
YAML

---
- name: Install packages
package:
name: s6-rc
- name: Create s6-rc directories
file:
path: '{{ item }}'
state: directory
owner: root
group: wheel
mode: 0755
with_items:
- /etc/s6-rc
- /etc/s6-rc/service
- /etc/s6-rc/service/enabled
- name: Define enabled services bundle
copy:
dest: /etc/s6-rc/service/enabled/type
content: bundle
owner: root
group: wheel
mode: 0444
- name: Default to an empty set of enabled servics
file:
path: /etc/s6-rc/service/enabled/contents
state: touch
owner: root
group: wheel
mode: 0644
changed_when: false
- name: Pick a UUID
command: uuidgen
register: uuidgen
changed_when: false
- name: Expose the UUID as fact
set_fact:
s6_uuid: '{{ uuidgen.stdout }}'
changed_when: false
- name: Compile the s6 service definitions
command: >
s6-rc-compile -v 2 .compiled.{{ s6_uuid }} service
args:
creates: /etc/s6-rc/compiled
chdir: /etc/s6-rc
- name: Link to the latest service database
command: >
env ln -shf .compiled.{{ s6_uuid }} compiled
args:
creates: /etc/s6-rc/compiled
chdir: /etc/s6-rc
- name: Make sure that tmpfs support is loaded early
lineinfile:
path: /boot/loader.conf
regexp: '^tmpfs_load='
line: 'tmpfs_load="YES"'
- name: Add /run to fstab
mount:
path: /run
src: tmpfs
fstype: tmpfs
opts: rw,size=128m,mode=755
state: mounted
- name: Generate s6-svscan startup script
template:
dest: /etc/s6-rc/scan
src: scan.j2
owner: root
group: wheel
mode: 0555
- name: Start s6-svscan from /etc/ttys
lineinfile:
path: /etc/ttys
regexp: '^null'
line: 'null "/etc/s6-rc/scan" vt100 on secure'
notify:
- Reload /etc/ttys
- name: Install s6-rc rc.d script
template:
dest: /usr/local/etc/rc.d/s6-rc
src: s6-rc.j2
owner: root
group: wheel
mode: 0555
- name: Flush handlers
meta: flush_handlers
- name: Starting s6-rc
service:
name: s6-rc
state: started
enabled: yes
- name: Create s6-log group
group:
name: s6-log
gid: 20000
- name: Create s6-log user
user:
name: s6-log
uid: 20000
group: s6-log
create_home: no
home: /var/empty
shell: /bin/sh