myos
This commit is contained in:
parent
3ffea66ba8
commit
b6f1b8d798
|
@ -1,5 +1,7 @@
|
||||||
# CHANGELOG
|
# CHANGELOG
|
||||||
|
|
||||||
## v1.0-alpha
|
## v1.0-alpha - 2021-07-14
|
||||||
|
|
||||||
First public release. Code is doc.
|
First public release, code is doc
|
||||||
|
|
||||||
|
* Licenses update to GPL, as freedom should not allow evil to move faster than god
|
||||||
|
|
|
@ -8,7 +8,7 @@ aws_secret_access_key: "{{ lookup('env','ANSIBLE_AWS_SECRET_ACCESS_KEY') }}"
|
||||||
disks_packages:
|
disks_packages:
|
||||||
- { "name": "e2fsprogs-extra", "state": "present" }
|
- { "name": "e2fsprogs-extra", "state": "present" }
|
||||||
- { "name": "nfs-utils", "state": "present" }
|
- { "name": "nfs-utils", "state": "present" }
|
||||||
hosts_git_repositories:
|
git_repositories:
|
||||||
- { "repo": "{{ lookup('env','ANSIBLE_GIT_REPOSITORY') }}", "dest": "{{ lookup('env','ANSIBLE_GIT_DIRECTORY') }}", "key_file": "{{ lookup('env','ANSIBLE_GIT_KEY_FILE') or '~/.ssh/id_rsa' }}", "version": "{{ lookup('env','ANSIBLE_GIT_VERSION') }}" }
|
- { "repo": "{{ lookup('env','ANSIBLE_GIT_REPOSITORY') }}", "dest": "{{ lookup('env','ANSIBLE_GIT_DIRECTORY') }}", "key_file": "{{ lookup('env','ANSIBLE_GIT_KEY_FILE') or '~/.ssh/id_rsa' }}", "version": "{{ lookup('env','ANSIBLE_GIT_VERSION') }}" }
|
||||||
hosts_packages:
|
hosts_packages:
|
||||||
- { "name": "ansible", "state": "present" }
|
- { "name": "ansible", "state": "present" }
|
||||||
|
@ -31,6 +31,7 @@ hosts_user_env:
|
||||||
- ANSIBLE_INVENTORY
|
- ANSIBLE_INVENTORY
|
||||||
- ANSIBLE_PLAYBOOK
|
- ANSIBLE_PLAYBOOK
|
||||||
- ENV
|
- ENV
|
||||||
|
- MYOS
|
||||||
hosts_user_rc_enable: true
|
hosts_user_rc_enable: true
|
||||||
hosts_user_rc_functions:
|
hosts_user_rc_functions:
|
||||||
- { "path": "10_prompt_set", "state": "touch" }
|
- { "path": "10_prompt_set", "state": "touch" }
|
||||||
|
|
|
@ -6,7 +6,7 @@ disks_packages:
|
||||||
- { "name": "xfsprogs", "state": "present" }
|
- { "name": "xfsprogs", "state": "present" }
|
||||||
docker_image_tag: "{{ lookup('env','ANSIBLE_DOCKER_IMAGE_TAG') or 'latest' }}"
|
docker_image_tag: "{{ lookup('env','ANSIBLE_DOCKER_IMAGE_TAG') or 'latest' }}"
|
||||||
docker_registry: "{{ lookup('env','ANSIBLE_DOCKER_REGISTRY') }}"
|
docker_registry: "{{ lookup('env','ANSIBLE_DOCKER_REGISTRY') }}"
|
||||||
hosts_git_repositories:
|
git_repositories:
|
||||||
- { "repo": "{{ lookup('env','ANSIBLE_GIT_REPOSITORY') }}", "dest": "{{ lookup('env','ANSIBLE_GIT_DIRECTORY') }}", "key_file": "{{ lookup('env','ANSIBLE_GIT_KEY_FILE') or '~/.ssh/id_rsa' }}", "version": "{{ lookup('env','ANSIBLE_GIT_VERSION') }}" }
|
- { "repo": "{{ lookup('env','ANSIBLE_GIT_REPOSITORY') }}", "dest": "{{ lookup('env','ANSIBLE_GIT_DIRECTORY') }}", "key_file": "{{ lookup('env','ANSIBLE_GIT_KEY_FILE') or '~/.ssh/id_rsa' }}", "version": "{{ lookup('env','ANSIBLE_GIT_VERSION') }}" }
|
||||||
hosts_packages:
|
hosts_packages:
|
||||||
- { "name": "ansible", "state": "present" }
|
- { "name": "ansible", "state": "present" }
|
||||||
|
@ -24,4 +24,5 @@ hosts_user_env:
|
||||||
- ANSIBLE_INVENTORY
|
- ANSIBLE_INVENTORY
|
||||||
- ANSIBLE_PLAYBOOK
|
- ANSIBLE_PLAYBOOK
|
||||||
- ENV
|
- ENV
|
||||||
|
- MYOS
|
||||||
hosts_user_rc_enable: true
|
hosts_user_rc_enable: true
|
||||||
|
|
|
@ -40,7 +40,10 @@ hosts_user_env:
|
||||||
- ANSIBLE_GIT_REPOSITORY
|
- ANSIBLE_GIT_REPOSITORY
|
||||||
- ANSIBLE_INVENTORY
|
- ANSIBLE_INVENTORY
|
||||||
- ANSIBLE_PLAYBOOK
|
- ANSIBLE_PLAYBOOK
|
||||||
|
- COMPOSE_PROJECT_NAME
|
||||||
- ENV
|
- ENV
|
||||||
|
- MYOS
|
||||||
|
- MYOS_TAGS
|
||||||
hosts_user_rc_enable: true
|
hosts_user_rc_enable: true
|
||||||
hosts_user_rc_functions:
|
hosts_user_rc_functions:
|
||||||
- { "path": "10_prompt_set", "state": "touch" }
|
- { "path": "10_prompt_set", "state": "touch" }
|
||||||
|
|
|
@ -23,13 +23,6 @@ hosts_cloudinit_config:
|
||||||
hosts_cloudinit_enable: false
|
hosts_cloudinit_enable: false
|
||||||
```
|
```
|
||||||
|
|
||||||
* `hosts_git_repositories` - Clone git repositories
|
|
||||||
|
|
||||||
``` yaml
|
|
||||||
hosts_git_repositories:
|
|
||||||
- { "repo": "https://github.com/aya/myos", "dest": "/src/com/github/aya/myos", "key_file": "~/.ssh/id_rsa", "version": "master" }
|
|
||||||
```
|
|
||||||
|
|
||||||
* `hosts_packages` - List of packages to install/remove on your hosts, should be overrided for a specific distro
|
* `hosts_packages` - List of packages to install/remove on your hosts, should be overrided for a specific distro
|
||||||
|
|
||||||
``` yaml
|
``` yaml
|
||||||
|
|
|
@ -78,9 +78,6 @@ hosts_cloudinit_config:
|
||||||
# enable cloud-init
|
# enable cloud-init
|
||||||
hosts_cloudinit_enable: false
|
hosts_cloudinit_enable: false
|
||||||
|
|
||||||
# git repositories to clone
|
|
||||||
hosts_git_repositories: []
|
|
||||||
|
|
||||||
# packages to install/remove
|
# packages to install/remove
|
||||||
hosts_packages: []
|
hosts_packages: []
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
#!/bin/sh
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# Provides: myos
|
||||||
|
# Required-Start:
|
||||||
|
# Required-Stop:
|
||||||
|
# Default-Start: 2 3 4 5
|
||||||
|
# Default-Stop: 0 1 6
|
||||||
|
# Description: System calls from https://github.com/aynicos/myos
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# load system configs
|
||||||
|
[ -r /etc/default/myos ] && . /etc/default/myos
|
||||||
|
[ -r /etc/sysconfig/myos ] && . /etc/sysconfig/myos
|
||||||
|
|
||||||
|
# check system config
|
||||||
|
[ -r ~/.env ] && . ~/.env || exit 1
|
||||||
|
type make >/dev/null 2>&1 && [ -d "${MYOS}" ] || exit 2
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
*)
|
||||||
|
IFS=$'\n'; exec env $(cat ~/.env 2>/dev/null) make -C "${MYOS}" $@
|
||||||
|
esac
|
|
@ -0,0 +1,18 @@
|
||||||
|
#!/sbin/openrc-run
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
need localmount swap
|
||||||
|
after bootmisc modules
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
/etc/init.d/myos start
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
/etc/init.d/myos stop
|
||||||
|
}
|
||||||
|
|
||||||
|
status() {
|
||||||
|
/etc/init.d/myos status
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
[Unit]
|
||||||
|
Description=System calls from https://github.com/aynicos/myos
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
RemainAfterExit=yes
|
||||||
|
ExecStart=/etc/init.d/myos start
|
||||||
|
ExecStop=/etc/init.d/myos stop
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=sysinit.target
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
- name: files - copy binary files
|
- name: files - copy binary files
|
||||||
with_items:
|
with_items:
|
||||||
|
- /etc/init.d/myos
|
||||||
- /etc/init.d/zram
|
- /etc/init.d/zram
|
||||||
copy: src=../files/{{item}} dest={{item}} owner=root group=root mode=0755
|
copy: src=../files/{{item}} dest={{item}} owner=root group=root mode=0755
|
||||||
become: yes
|
become: yes
|
||||||
|
@ -18,6 +19,7 @@
|
||||||
- name: files - systemd - copy files
|
- name: files - systemd - copy files
|
||||||
when: ansible_service_mgr|lower == "systemd"
|
when: ansible_service_mgr|lower == "systemd"
|
||||||
with_items:
|
with_items:
|
||||||
|
- /etc/systemd/system/myos.service
|
||||||
- /etc/systemd/system/zram.service
|
- /etc/systemd/system/zram.service
|
||||||
copy: src=../files/{{item}} dest={{item}} owner=root group=root mode=0644
|
copy: src=../files/{{item}} dest={{item}} owner=root group=root mode=0644
|
||||||
become: yes
|
become: yes
|
||||||
|
@ -25,15 +27,8 @@
|
||||||
- name: files - openrc - copy files
|
- name: files - openrc - copy files
|
||||||
when: ansible_service_mgr|lower == "openrc"
|
when: ansible_service_mgr|lower == "openrc"
|
||||||
with_items:
|
with_items:
|
||||||
|
- /etc/init.d/myos-openrc
|
||||||
- /etc/init.d/zram-openrc
|
- /etc/init.d/zram-openrc
|
||||||
- /etc/local.d/ansible.start
|
|
||||||
copy: src=../files/{{item}} dest={{item}} owner=root group=root mode=0755
|
copy: src=../files/{{item}} dest={{item}} owner=root group=root mode=0755
|
||||||
become: yes
|
become: yes
|
||||||
|
|
||||||
- name: files - get remote binary files
|
|
||||||
with_items:
|
|
||||||
- https://raw.githubusercontent.com/dylanaraps/pfetch/master/pfetch
|
|
||||||
get_url: url={{item}} dest=/usr/local/bin owner=root group=root mode=0755
|
|
||||||
ignore_errors: true
|
|
||||||
become: yes
|
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,6 @@
|
||||||
- import_tasks: files.yml
|
- import_tasks: files.yml
|
||||||
tags:
|
tags:
|
||||||
- files
|
- files
|
||||||
- import_tasks: git.yml
|
|
||||||
tags:
|
|
||||||
- git
|
|
||||||
- import_tasks: groups.yml
|
- import_tasks: groups.yml
|
||||||
tags:
|
tags:
|
||||||
- groups
|
- groups
|
||||||
|
|
|
@ -3,13 +3,13 @@ SERVICE ?= cli
|
||||||
-include .env
|
-include .env
|
||||||
|
|
||||||
ansible:
|
ansible:
|
||||||
@make -C $(ANSIBLE_GIT_DIRECTORY) ansible-run-localhost $(foreach var,$(ENV_USER_VARS),$(if $($(var)),$(var)='$($(var))'))
|
@make -C $(ANSIBLE_GIT_DIRECTORY) ansible-run-localhost
|
||||||
|
|
||||||
ansible-%:
|
ansible-%:
|
||||||
@make -C $(ANSIBLE_GIT_DIRECTORY) ansible-run-localhost $(foreach var,$(ENV_USER_VARS),$(if $($(var)),$(var)='$($(var))')) ANSIBLE_TAGS=$*
|
@make -C $(ANSIBLE_GIT_DIRECTORY) ansible-run-localhost ANSIBLE_TAGS=$*
|
||||||
|
|
||||||
ansible-pull:
|
ansible-pull:
|
||||||
@$(foreach var,$(ENV_USER_VARS),$(if $($(var)),$(var)='$($(var))')) $(if $(ANSIBLE_CONFIG),ANSIBLE_CONFIG=$(ANSIBLE_GIT_DIRECTORY)/$(ANSIBLE_CONFIG)) ansible-pull --url $(ANSIBLE_GIT_REPOSITORY) $(if $(ANSIBLE_GIT_KEY_FILE),--key-file $(ANSIBLE_GIT_KEY_FILE)) $(if $(ANSIBLE_GIT_VERSION),--checkout $(ANSIBLE_GIT_VERSION)) $(if $(ANSIBLE_GIT_DIRECTORY),--directory $(ANSIBLE_GIT_DIRECTORY)) $(if $(ANSIBLE_TAGS),--tags $(ANSIBLE_TAGS)) $(if $(ANSIBLE_EXTRA_VARS),--extra-vars '$(ANSIBLE_EXTRA_VARS)') $(if $(findstring true,$(FORCE)),--force) $(if $(findstring true,$(DRYRUN)),--check) --full $(if $(ANSIBLE_INVENTORY),--inventory $(ANSIBLE_INVENTORY)) $(ANSIBLE_VERBOSE) $(ANSIBLE_PLAYBOOK)
|
@$(if $(ANSIBLE_CONFIG),ANSIBLE_CONFIG=$(ANSIBLE_GIT_DIRECTORY)/$(ANSIBLE_CONFIG)) ansible-pull --url $(ANSIBLE_GIT_REPOSITORY) $(if $(ANSIBLE_GIT_KEY_FILE),--key-file $(ANSIBLE_GIT_KEY_FILE)) $(if $(ANSIBLE_GIT_VERSION),--checkout $(ANSIBLE_GIT_VERSION)) $(if $(ANSIBLE_GIT_DIRECTORY),--directory $(ANSIBLE_GIT_DIRECTORY)) $(if $(ANSIBLE_TAGS),--tags $(ANSIBLE_TAGS)) $(if $(ANSIBLE_EXTRA_VARS),--extra-vars '$(ANSIBLE_EXTRA_VARS)') $(if $(findstring true,$(FORCE)),--force) $(if $(findstring true,$(DRYRUN)),--check) --full $(if $(ANSIBLE_INVENTORY),--inventory $(ANSIBLE_INVENTORY)) $(ANSIBLE_VERBOSE) $(ANSIBLE_PLAYBOOK)
|
||||||
|
|
||||||
exec:
|
exec:
|
||||||
@make -C $(ANSIBLE_GIT_DIRECTORY) exec ARGS='$(ARGS)' DOCKER_NAME=$(COMPOSE_PROJECT_NAME)_$(SERVICE) ENV=$(ENV) DOCKER_RUN_WORKDIR=
|
@make -C $(ANSIBLE_GIT_DIRECTORY) exec ARGS='$(ARGS)' DOCKER_NAME=$(COMPOSE_PROJECT_NAME)_$(SERVICE) ENV=$(ENV) DOCKER_RUN_WORKDIR=
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
{% for var in hosts_user_env|default([]) %}
|
{% for var in hosts_user_env|default([]) %}
|
||||||
{{var}}={{ lookup('env',var) }}
|
{{var}}={{ lookup('env',var) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
ENV_USER_VARS={{hosts_user_env |default([]) |join(' ')}}
|
|
||||||
|
|
|
@ -66,6 +66,15 @@ aws_secret_access_key: 'YOUR_SECRET_ACCESS_KEY'
|
||||||
aws_user: 'root'
|
aws_user: 'root'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Git variables
|
||||||
|
|
||||||
|
* `git_repositories` - Clone git repositories
|
||||||
|
|
||||||
|
``` yaml
|
||||||
|
git_repositories:
|
||||||
|
- { "repo": "https://github.com/aynicos/myos", "dest": "/dns/com/github/aynicos/myos", "key_file": "~/.ssh/id_rsa", "version": "master" }
|
||||||
|
```
|
||||||
|
|
||||||
## Example playbook
|
## Example playbook
|
||||||
|
|
||||||
``` yaml
|
``` yaml
|
||||||
|
|
|
@ -19,6 +19,9 @@ aws_user: "{{ ansible_user|default('root') }}"
|
||||||
# aws_secret_access_key to add in ~/.aws/credentials
|
# aws_secret_access_key to add in ~/.aws/credentials
|
||||||
aws_secret_access_key: 'YOUR_SECRET_ACCESS_KEY'
|
aws_secret_access_key: 'YOUR_SECRET_ACCESS_KEY'
|
||||||
|
|
||||||
|
# git repositories to clone
|
||||||
|
git_repositories: []
|
||||||
|
|
||||||
# packages to install/remove
|
# packages to install/remove
|
||||||
remotes_packages: []
|
remotes_packages: []
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
---
|
||||||
|
# file: tasks/files.yml
|
||||||
|
|
||||||
|
- name: files - get remote binary files
|
||||||
|
with_items:
|
||||||
|
- https://raw.githubusercontent.com/dylanaraps/pfetch/master/pfetch
|
||||||
|
get_url: url={{item}} dest=/usr/local/bin owner=root group=root mode=0755
|
||||||
|
ignore_errors: true
|
||||||
|
become: yes
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# file: tasks/git.yml
|
# file: tasks/git.yml
|
||||||
|
|
||||||
- name: git - clone repositories
|
- name: git - clone repositories
|
||||||
with_items: "{{ hosts_git_repositories|default([]) }}"
|
with_items: "{{ git_repositories|default([]) }}"
|
||||||
git:
|
git:
|
||||||
repo: "{{ item.repo }}"
|
repo: "{{ item.repo }}"
|
||||||
dest: "{{ item.dest|default('/src') }}"
|
dest: "{{ item.dest|default('/src') }}"
|
|
@ -4,9 +4,15 @@
|
||||||
- import_tasks: vars.yml
|
- import_tasks: vars.yml
|
||||||
tags:
|
tags:
|
||||||
- vars
|
- vars
|
||||||
|
- import_tasks: files.yml
|
||||||
|
tags:
|
||||||
|
- files
|
||||||
- import_tasks: packages.yml
|
- import_tasks: packages.yml
|
||||||
tags:
|
tags:
|
||||||
- packages
|
- packages
|
||||||
|
- import_tasks: git.yml
|
||||||
|
tags:
|
||||||
|
- git
|
||||||
- import_tasks: pips.yml
|
- import_tasks: pips.yml
|
||||||
tags:
|
tags:
|
||||||
- pips
|
- pips
|
||||||
|
|
Loading…
Reference in New Issue