Restructure states, add podman package install workaround
This commit is contained in:
parent
552908f0b9
commit
b0ac9dc850
20 changed files with 167 additions and 154 deletions
|
@ -1,4 +0,0 @@
|
||||||
include:
|
|
||||||
- .mysql
|
|
||||||
- .podman
|
|
||||||
- .ssh
|
|
|
@ -1,35 +0,0 @@
|
||||||
applications_mysql_pkgs:
|
|
||||||
pkg.installed:
|
|
||||||
- pkgs:
|
|
||||||
- mariadb
|
|
||||||
- mariadb-client
|
|
||||||
- mariadb-openrc
|
|
||||||
|
|
||||||
applications_mysql_directory:
|
|
||||||
file.directory:
|
|
||||||
- name: /var/lib/mysql
|
|
||||||
- create: False
|
|
||||||
- replace: False
|
|
||||||
- user: mysql
|
|
||||||
- group: mysql
|
|
||||||
- recurse:
|
|
||||||
- user
|
|
||||||
- group
|
|
||||||
- require:
|
|
||||||
- applications_mysql_pkgs
|
|
||||||
|
|
||||||
{% if not salt['file.directory_exists']('/var/lib/mysql/mysql') %}
|
|
||||||
applications_mysql_setup:
|
|
||||||
cmd.run:
|
|
||||||
- name: /etc/init.d/mariadb setup
|
|
||||||
- runas: root
|
|
||||||
- shell: /bin/ash
|
|
||||||
- require:
|
|
||||||
- applications_mysql_directory
|
|
||||||
|
|
||||||
applications_mysql_service:
|
|
||||||
service.enabled:
|
|
||||||
- name: mariadb
|
|
||||||
- require:
|
|
||||||
- applications_mysql_setup
|
|
||||||
{% endif %}
|
|
|
@ -1,84 +0,0 @@
|
||||||
applications_podman_pkgs:
|
|
||||||
pkg.installed:
|
|
||||||
- pkgs:
|
|
||||||
- podman
|
|
||||||
- podman-openrc
|
|
||||||
|
|
||||||
application_podman_compose_pkg:
|
|
||||||
pkg.installed:
|
|
||||||
- sources:
|
|
||||||
- podman-compose: https://dl-cdn.alpinelinux.org/alpine/edge/testing
|
|
||||||
|
|
||||||
applications_podman_rootless_confd:
|
|
||||||
file.keyvalue:
|
|
||||||
- name: /etc/conf.d/podman
|
|
||||||
- key_values:
|
|
||||||
podman_user: '"puser"'
|
|
||||||
- separator: '='
|
|
||||||
- uncomment: '#'
|
|
||||||
- key_ignore_case: false
|
|
||||||
- value_ignore_case: false
|
|
||||||
- append_if_not_found: true
|
|
||||||
- require:
|
|
||||||
- applications_podman_pkgs
|
|
||||||
|
|
||||||
applications_podman_service:
|
|
||||||
service.running:
|
|
||||||
- name: podman
|
|
||||||
- enable: True
|
|
||||||
- watch:
|
|
||||||
- file: /etc/conf.d/podman
|
|
||||||
- require:
|
|
||||||
- applications_podman_rootless_confd
|
|
||||||
|
|
||||||
applications_podman_rootless_cgroup_mode:
|
|
||||||
file.keyvalue:
|
|
||||||
- name: /etc/rc.conf
|
|
||||||
- key_values:
|
|
||||||
rc_cgroup_mode: '"unified"'
|
|
||||||
- separator: '='
|
|
||||||
- uncomment: '#'
|
|
||||||
- key_ignore_case: false
|
|
||||||
- value_ignore_case: false
|
|
||||||
- append_if_not_found: true
|
|
||||||
- require:
|
|
||||||
- applications_podman_pkgs
|
|
||||||
|
|
||||||
applications_podman_rootless_cgroups:
|
|
||||||
service.running:
|
|
||||||
- name: cgroups
|
|
||||||
- enable: True
|
|
||||||
- watch:
|
|
||||||
- applications_podman_rootless_cgroup_mode
|
|
||||||
|
|
||||||
applications_podman_user:
|
|
||||||
user.present:
|
|
||||||
- name: puser
|
|
||||||
- uid: 2000
|
|
||||||
- shell: /bin/zsh
|
|
||||||
- home: /home/puser
|
|
||||||
- usergroup: True
|
|
||||||
- createhome: True
|
|
||||||
- require:
|
|
||||||
- applications_podman_pkgs
|
|
||||||
|
|
||||||
applications_podman_rootless_modules:
|
|
||||||
file.append:
|
|
||||||
- name: /etc/modules
|
|
||||||
- text:
|
|
||||||
- tun
|
|
||||||
- fuse
|
|
||||||
|
|
||||||
applications_podman_rootless_subgid:
|
|
||||||
file.append:
|
|
||||||
- name: /etc/subgid
|
|
||||||
- text: puser:100000:65536
|
|
||||||
- require:
|
|
||||||
- applications_podman_user
|
|
||||||
|
|
||||||
applications_podman_rootless_subuid:
|
|
||||||
file.append:
|
|
||||||
- name: /etc/subuid
|
|
||||||
- text: puser:100000:65536
|
|
||||||
- require:
|
|
||||||
- applications_podman_user
|
|
|
@ -1,30 +0,0 @@
|
||||||
applications_ssh_pkgs:
|
|
||||||
pkg.installed:
|
|
||||||
- pkgs:
|
|
||||||
- openssh-server
|
|
||||||
|
|
||||||
applications_ssh_add_keys:
|
|
||||||
file.managed:
|
|
||||||
- name: /root/.ssh/authorized_keys
|
|
||||||
- source: salt://{{ tpldir }}/files/ssh_authorized_keys
|
|
||||||
- makedirs: True
|
|
||||||
- user: root
|
|
||||||
- group: root
|
|
||||||
- require:
|
|
||||||
- applications_ssh_pkgs
|
|
||||||
|
|
||||||
applications_ssh_configuration:
|
|
||||||
file.managed:
|
|
||||||
- name: /etc/ssh/sshd_config
|
|
||||||
- source: salt://{{ tpldir }}/files/ssh_sshd_config
|
|
||||||
|
|
||||||
applications_ssh_enable:
|
|
||||||
service.running:
|
|
||||||
- name: sshd
|
|
||||||
- enable: True
|
|
||||||
- watch:
|
|
||||||
- applications_ssh_configuration
|
|
||||||
- applications_ssh_add_keys
|
|
||||||
- require:
|
|
||||||
- applications_ssh_configuration
|
|
||||||
- applications_ssh_add_keys
|
|
12
mysql/directory.sls
Normal file
12
mysql/directory.sls
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
mysql_directory:
|
||||||
|
file.directory:
|
||||||
|
- name: /var/lib/mysql
|
||||||
|
- create: False
|
||||||
|
- replace: False
|
||||||
|
- user: mysql
|
||||||
|
- group: mysql
|
||||||
|
- recurse:
|
||||||
|
- user
|
||||||
|
- group
|
||||||
|
- require:
|
||||||
|
- applications_mysql_pkgs
|
4
mysql/init.sls
Normal file
4
mysql/init.sls
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
include:
|
||||||
|
- .pkg
|
||||||
|
- .directory
|
||||||
|
- .service
|
6
mysql/pkg.sls
Normal file
6
mysql/pkg.sls
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
mysql_pkg:
|
||||||
|
pkg.installed:
|
||||||
|
- pkgs:
|
||||||
|
- mariadb
|
||||||
|
- mariadb-client
|
||||||
|
- mariadb-openrc
|
15
mysql/service.sls
Normal file
15
mysql/service.sls
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
{% if not salt['file.directory_exists']('/var/lib/mysql/mysql') %}
|
||||||
|
mysql_service_setup:
|
||||||
|
cmd.run:
|
||||||
|
- name: /etc/init.d/mariadb setup
|
||||||
|
- runas: root
|
||||||
|
- shell: /bin/ash
|
||||||
|
- require:
|
||||||
|
- applications_mysql_directory
|
||||||
|
|
||||||
|
mysql_service_enable:
|
||||||
|
service.enabled:
|
||||||
|
- name: mariadb
|
||||||
|
- require:
|
||||||
|
- mysql_service_setup
|
||||||
|
{% endif %}
|
17
openssh/config.sls
Normal file
17
openssh/config.sls
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
include:
|
||||||
|
- .pkg
|
||||||
|
|
||||||
|
openssh_config_configuration:
|
||||||
|
file.managed:
|
||||||
|
- name: /etc/ssh/sshd_config
|
||||||
|
- source: salt://{{ tpldir }}/files/openssh_sshd_config
|
||||||
|
|
||||||
|
openssh_config_keys:
|
||||||
|
file.managed:
|
||||||
|
- name: /root/.ssh/authorized_keys
|
||||||
|
- source: salt://{{ tpldir }}/files/openssh_authorized_keys
|
||||||
|
- makedirs: True
|
||||||
|
- user: root
|
||||||
|
- group: root
|
||||||
|
- require:
|
||||||
|
- openssh_pkg
|
4
openssh/init.sls
Normal file
4
openssh/init.sls
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
include:
|
||||||
|
- .pkg
|
||||||
|
- .config
|
||||||
|
- .service
|
4
openssh/pkg.sls
Normal file
4
openssh/pkg.sls
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
openssh_pkg:
|
||||||
|
pkg.installed:
|
||||||
|
- pkgs:
|
||||||
|
- openssh-server
|
13
openssh/service.sls
Normal file
13
openssh/service.sls
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
include:
|
||||||
|
- .config
|
||||||
|
|
||||||
|
openssh_service_enable:
|
||||||
|
service.running:
|
||||||
|
- name: sshd
|
||||||
|
- enable: True
|
||||||
|
- watch:
|
||||||
|
- openssh_config_configuration
|
||||||
|
- openssh_config_keys
|
||||||
|
- require:
|
||||||
|
- openssh_config_configuration
|
||||||
|
- openssh_config_keys
|
5
podman/init.sls
Normal file
5
podman/init.sls
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
include:
|
||||||
|
- .pkg
|
||||||
|
- .rootless
|
||||||
|
- .user
|
||||||
|
- .service
|
3
podman/pkg.sls
Normal file
3
podman/pkg.sls
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
podman_pkg:
|
||||||
|
cmd.run:
|
||||||
|
- name: "apk add podman podman-openrc podman-compose@testing"
|
57
podman/rootless.sls
Normal file
57
podman/rootless.sls
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
include:
|
||||||
|
- .pkg
|
||||||
|
- .user
|
||||||
|
|
||||||
|
podman_rootless_confd:
|
||||||
|
file.keyvalue:
|
||||||
|
- name: /etc/conf.d/podman
|
||||||
|
- key_values:
|
||||||
|
podman_user: '"puser"'
|
||||||
|
- separator: '='
|
||||||
|
- uncomment: '#'
|
||||||
|
- key_ignore_case: false
|
||||||
|
- value_ignore_case: false
|
||||||
|
- append_if_not_found: true
|
||||||
|
- require:
|
||||||
|
- podman_pkg
|
||||||
|
|
||||||
|
podman_rootless_cgroup_mode:
|
||||||
|
file.keyvalue:
|
||||||
|
- name: /etc/rc.conf
|
||||||
|
- key_values:
|
||||||
|
rc_cgroup_mode: '"unified"'
|
||||||
|
- separator: '='
|
||||||
|
- uncomment: '#'
|
||||||
|
- key_ignore_case: false
|
||||||
|
- value_ignore_case: false
|
||||||
|
- append_if_not_found: true
|
||||||
|
- require:
|
||||||
|
- podman_pkg
|
||||||
|
|
||||||
|
podman_rootless_cgroups:
|
||||||
|
service.running:
|
||||||
|
- name: cgroups
|
||||||
|
- enable: True
|
||||||
|
- watch:
|
||||||
|
- podman_rootless_cgroup_mode
|
||||||
|
|
||||||
|
podman_rootless_modules:
|
||||||
|
file.append:
|
||||||
|
- name: /etc/modules
|
||||||
|
- text:
|
||||||
|
- tun
|
||||||
|
- fuse
|
||||||
|
|
||||||
|
podman_rootless_subgid:
|
||||||
|
file.append:
|
||||||
|
- name: /etc/subgid
|
||||||
|
- text: puser:100000:65536
|
||||||
|
- require:
|
||||||
|
- podman_user
|
||||||
|
|
||||||
|
podman_rootless_subuid:
|
||||||
|
file.append:
|
||||||
|
- name: /etc/subuid
|
||||||
|
- text: puser:100000:65536
|
||||||
|
- require:
|
||||||
|
- podman_user
|
11
podman/service.sls
Normal file
11
podman/service.sls
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
include:
|
||||||
|
- .rootless
|
||||||
|
|
||||||
|
applications_podman_service:
|
||||||
|
service.running:
|
||||||
|
- name: podman
|
||||||
|
- enable: True
|
||||||
|
- watch:
|
||||||
|
- file: /etc/conf.d/podman
|
||||||
|
- require:
|
||||||
|
- podman_rootless_confd
|
13
podman/user.sls
Normal file
13
podman/user.sls
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
include:
|
||||||
|
- .pkg
|
||||||
|
|
||||||
|
podman_user:
|
||||||
|
user.present:
|
||||||
|
- name: puser
|
||||||
|
- uid: 2000
|
||||||
|
- shell: /bin/zsh
|
||||||
|
- home: /home/puser
|
||||||
|
- usergroup: True
|
||||||
|
- createhome: True
|
||||||
|
- require:
|
||||||
|
- podman_pkg
|
4
top.sls
4
top.sls
|
@ -2,5 +2,7 @@ base:
|
||||||
'*':
|
'*':
|
||||||
- system
|
- system
|
||||||
- network
|
- network
|
||||||
- applications
|
|
||||||
- util
|
- util
|
||||||
|
- podman
|
||||||
|
- mysql
|
||||||
|
- openssh
|
||||||
|
|
Loading…
Reference in a new issue