Compare commits

...

2 Commits

Author SHA1 Message Date
425ac598a4 FML
Looks like some versions of neofetch doesn't allow ";" as commet prefix,
like wtf. Guess we'll have to use the "#"!
2022-03-23 02:07:41 +01:00
a70d58f3f7 Ansible god!
Big rework!
Control stuffs with variables!
We still should do some movei'n around of roles before extending
features.
2022-03-23 02:03:04 +01:00
33 changed files with 447 additions and 104 deletions

View File

@ -1,3 +1,9 @@
# Ansible
Ansible playbooks for setting up configs I like.
See group\_vars for a config example.
You may copy that to host\_vars/[somehostname].yml and edit it.
If you have Docker install you may also test the ansible configuration inside a docker container!
The test-docker.sh run uses an alpine container by default.

View File

@ -1,7 +1,8 @@
[defaults]
interpreter_python = python3
ansible_become_exe = doas
interpreter_python = python3
private_key_file = ~/.ssh/id_rsa
inventory = servers.ini
remote_user = siv
[privilege_escalation]
become = yes

View File

@ -1,5 +1,4 @@
[docker]
[alpine]
docker-alpine-test ansible_connection=docker ansible_user=root ansible_host=ansible
[alpine:children]
docker
[apk:children]
alpine

View File

@ -1,10 +1,19 @@
name: siv
group: "{{ name }}"
shell: /bin/zsh
user_groups: [adm,wheel,kvm,libvirt,docker]
packages: neofetch openssh doas git zsh bat lsd
pubkeys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC1O7dXSrkDZ0l2kQMDnUPcALEYrq9l+fCKANb4sKZebRr+CkvO0Yat6f/O1a4OJWKeIpOMNIG60aiQB4Npn1ACosQ5Jgw1GypEr6QWDKdWqTEQ4qQaJk2sAKbUpEHTvtwlRTZy5zxC0TrRSjXcNmPR5O4GGMPLAdWFmD9iIRA+tjGvB6U4NY8KafxzBmje95oVP8erayEZT90IgljLisg29uAofAfAhjP/KV/z1ppmwrL7Et6N2ZcOfFl+KOcefzjt0bdkV0gFXqYKEFK9WEpVXEHE7CpOu/dJZgVvTT+jfHhWhANkl66dDbv80nfHAINASCBCoUi6CFb8TBru4WABeoyKEQnC04IqHXvgOMr5/f9Sx1PHZNxkXNVuSPbkSnA7Qk4OnHG5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0ivNRNxAKxLHXg+i0jQtiDwBOkhQl0VFrqsKdGlEVcghVeogBAdzHFQNQ7ENZMS30qzW1wrcwWbUBF8ZSvwEQgCXH0UHcIWi3Rzd0g0LfvfbOtI1UjuBzT0gd5F1RSHh0XJWK7jcVrNShMVQqmWWLuHVd8T2k7flGQDBeZPKo3GXdnB4cXgkfNJrsyNDLoJXimj8UryNpn3ejV9DkreL985uAmkLPY11bkD6vWgdZgXA3aWpLQm05crOu4GEn1bGhbnIORm4mjxlANJB0QC9FliCAVkLk4OY7UGnx4mgqMyYjb2LCdgGKVVto97UAisJxWikLiM5nCNrCaGBe05d2nVxPXVKwALI3E2AeIYSmjE4N3mBgUIxWuGS6KoOZsnoSYS3+blQV0W/POuFw4NhlWgZUi8GAaGPfWj8pM/u9dH8FKxhK/PabVKtltLkn4ntgewaeNl18n1NFkQtcDD7Kkg/ZIQ9SiNchK0SxR0/Pgwo/A5GacF+nwTgxGwDJbQ0OPaVlbQd/cCaXl1AX9s7R5Xd8D35KFHTJ1IVnZohDGVQvQ== mob]
packages: [neofetch,htop,git,zsh,bat]
package_manager: null
# extra_packages: []
update: true
setup: [zsh,extra,system] # ,bash,emacs
revert: false

2
group_vars/apk.yml Normal file
View File

@ -0,0 +1,2 @@
extra_packages: [openssh,doas,lsd]
package_manager: apk

2
group_vars/apt.yml Normal file
View File

@ -0,0 +1,2 @@
extra_packages: [doas,ssh]
package_manager: apt

1
group_vars/kjellern.yml Normal file
View File

@ -0,0 +1 @@
update: false

1
group_vars/linode.yml Normal file
View File

@ -0,0 +1 @@
update: false

2
group_vars/pacman.yml Normal file
View File

@ -0,0 +1,2 @@
extra_packages: [opendoas,openssh,lsd]
package_manager: pacman

9
group_vars/skyid.yml Normal file
View File

@ -0,0 +1,9 @@
user_groups: [sysadmins]
setup: [zsh,bash,extra]
zsh_opt_config: false
extra_packages: []
packages: []
pubkeys: []
update: false
name: sivert
group: "{{ user_groups[0] }}"

1
host_vars/42069.no.yml Normal file
View File

@ -0,0 +1 @@
user_groups: [sudo,adm,kvm,users,docker]

View File

@ -0,0 +1,2 @@
zsh_opt_config: true
user_groups: [wheel,sudo,adm,kvm,users,docker]

View File

@ -0,0 +1,15 @@
# pubkeys: [
# ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC1O7dXSrkDZ0l2kQMDnUPcALEYrq9l+fCKANb4sKZebRr+CkvO0Yat6f/O1a4OJWKeIpOMNIG60aiQB4Npn1ACosQ5Jgw1GypEr6QWDKdWqTEQ4qQaJk2sAKbUpEHTvtwlRTZy5zxC0TrRSjXcNmPR5O4GGMPLAdWFmD9iIRA+tjGvB6U4NY8KafxzBmje95oVP8erayEZT90IgljLisg29uAofAfAhjP/KV/z1ppmwrL7Et6N2ZcOfFl+KOcefzjt0bdkV0gFXqYKEFK9WEpVXEHE7CpOu/dJZgVvTT+jfHhWhANkl66dDbv80nfHAINASCBCoUi6CFb8TBru4WABeoyKEQnC04IqHXvgOMr5/f9Sx1PHZNxkXNVuSPbkSnA7Qk4OnHG5c/rEeZ850eM8j0or29PyNFvZjWjBrIG1iReRTdSDkzdwojLuCKMrN8qxmDMuYW0Ey9DCsC2iKyYzJ+3dhilXkaUtQYHrtCM4DB4rcAWV2hRS1mRZwWmKH4QWvwVbjipKAzHg3i2hMFIC6HbNxbYHrzFCSCZN07ObLsyMYR28I74JfFxpNg0OQAZ5QVvOe+PletFjqbpVnjrGhEkBCyGIOfZ14PlJhN0CW8/9fTy6EzvruD2yGTUMq+pJhhJ3Zj5J+zaFJsz3tPxf+OVcsGFLEtbJvu6C9yCT5Q== siv@msitoo,
# ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDqXa9fIVrQTGV4PMTn7ZyyeTLDVC+H4kV6zJzWBGGZf6DSoumJtbTaD6Ob3Czsf/NZ35iCPy2yrar3/Z7ccDrcfpxlNvj9l3NphEdXIebyQ8VmMWBy4pDPjE1erIEaL+J5RfjidB7xauticUIuNj0vtuvum/f09vGsohys+/llU7T+M42AeCTT5omw0DD8DPIUGxFwsgg0RxtD5ol1i3v0zVqwlbc7gnHws9/JCJZrhdHZWWkqvVQLCbRRCq4ZvRBcMdwJsBOeJpM9tkeJ7peZjAnPh7EIPkWh79+S65m6bsBe9N4lX5Qf2jxMSzgGeHhfJmd5O7UVqxH1a4M10e+CZOsWdTbMFEn+pcA04gehV9mL5gazZTMSjVFRzd/NUWi0Z6kecXW0HvxWzvKs+iZgaqL7qsDQUb23nMyvtiRO7JeTfdlo/dpb3Uz12VfwcHWAw1DpyJk3Sd1xV4sLke34F67e141ed72Piig6UuX2/aXm5Due781zIS8zBKBl4vXORbGjLLBo72RctB3xU9nJmkttdeSSF/yRbY7H3+bsvno/VUSAhnYWlGNrZBc+tTtqjYEQ3k/G8I8nwO4e1GDfo6w5G9dZQQ4YyV4v41NRp0TrtuGBpvGf9anMWUcp63f+fXMOZAnSVg42oZZUYWSPQTnoY1E5I3A6K4wrqEHt4w== siv@craptop]
# extra_packages: [openssh,emacs,doas,lsd]
user_groups: [adm,users]
setup: [bash,zsh,system,extra] # ,emacs
# zsh_opt_config: false
package_manager: apk
# user_groups: [sysadmins]
pubkeys: []
extra_packages: []
packages: []
update: false
# name: sivert
# group: "{{ user_groups[0] }}"

View File

@ -1 +1,2 @@
permit nopass siv as root
permit persist :adm
permit persist siv

View File

@ -0,0 +1,104 @@
print_info() {
info title
info underline
info "OS" distro
info "Host" model
info "Kernel" kernel
info "Uptime" uptime
info "Packages" packages
info "Shell" shell
# info "Resolution" resolution
# info "DE" de
# info "WM" wm
# info "WM Theme" wm_theme
# info "Theme" theme
info "Icons" icons
info "Terminal" term
info "Terminal Font" term_font
info "CPU" cpu
info "GPU" gpu
info "Memory" memory
# info "GPU Driver" gpu_driver # Linux/macOS only
# info "CPU Usage" cpu_usage
info "Disk" disk
# info "Battery" battery
info "Font" font
# info "Song" song
# [[ "$player" ]] && prin "Music Player" "$player"
info "Local IP" local_ip
# info "Public IP" public_ip
# info "Users" users
# info "Locale" locale # This only works on glibc systems.
info cols
}
title_fqdn="off"
kernel_shorthand="off"
distro_shorthand="off"
os_arch="off"
uptime_shorthand="on"
memory_percent="on"
memory_unit="gib"
package_managers="on"
shell_path="on"
shell_version="on"
speed_type="bios_limit"
speed_shorthand="on"
cpu_brand="on"
cpu_speed="on"
cpu_cores="logical"
cpu_temp="C"
gpu_brand="on"
gpu_type="all"
refresh_rate="on"
gtk_shorthand="off"
gtk2="on"
gtk3="on"
public_ip_host="https://myip.wtf/text"
public_ip_timeout=2
de_version="on"
disk_show=('/')
disk_subtitle="mount"
disk_percent="on"
music_player="auto"
song_format="%artist% - %album% - %title%"
song_shorthand="off"
mpc_args=()
colors=(distro)
bold="on"
underline_enabled="on"
underline_char="-"
separator=":"
block_range=(0 15)
color_blocks="on"
block_width=2
block_height=1
col_offset="auto"
bar_char_elapsed="="
bar_char_total="-"
bar_border="on"
bar_length=15
bar_color_elapsed="distro"
bar_color_total="distro"
cpu_display="infobar"
memory_display="infobar"
battery_display="infobar"
disk_display="infobar"
image_backend="ascii"
image_source="ascii"
ascii_distro="auto"
ascii_colors=(distro)
ascii_bold="on"
image_loop="off"
thumbnail_dir="${XDG_CACHE_HOME:-${HOME}/.cache}/thumbnails/neofetch"
crop_mode="normal"
crop_offset="center"
image_size="auto"
gap=3
yoffset=1
xoffset=1
background_color=
stdout="off"

View File

@ -1,36 +1,67 @@
- name: Install and configure packages
- name: Install packages
when: update
block:
- name: Install the good stuff (pacman)
pacman: name={{ packages }} state=latest
- name: Install packages (pacman)
when: "'pacman' in group_names"
tags: pacman
- name: Install the good stuff (apk)
apk: name={{ packages }} state=latest
block:
- name: Install the good stuff (pacman)
pacman: name={{ item }} state=latest
ignore_errors: yes
with_items:
- "{{ extra_packages }}"
- "{{ packages }}"
rescue:
- name: Uninstall the good stuff (pacman)
pacman: name={{ item }} state=absent
with_items:
- "{{ extra_packages }}"
- "{{ packages }}"
- name: Install packages (apk)
when: "'apk' in group_names or 'alpine' in group_names"
tags: apk
- name: Install the good stuff (apt)
apt: package={{ packages }} state=latest
block:
- name: Install the good stuff (apk)
apk: name={{ item }} state=latest
ignore_errors: yes
with_items:
- "{{ extra_packages }}"
- "{{ packages }}"
rescue:
- name: Uninstall the good stuff (apk)
apk: name={{ item }} state=absent
with_items:
- "{{ extra_packages }}"
- "{{ packages }}"
- name: Install packages (apt)
when: "'apt' in group_names"
tags: apt
block:
- name: Install the good stuff (apt)
apt: package={{ item }} state=latest
ignore_errors: yes
with_items:
- "{{ extra_packages }}"
- "{{ packages }}"
rescue:
- name: Uninstall the good stuff (apt)
apt: package={{ item }} state=absent
with_items:
- "{{ extra_packages }}"
- "{{ packages }}"
- name: Configure system packages
when: "'system' in setup"
block:
- name: Add /etc/doas.conf
copy: src=doas.conf dest=/etc/doas.conf owner=root group=root mode=0644
tags: system
rescue:
- name: Uninstall the good stuff (pacman)
pacman: name={{ packages }} state=absent
when: "'pacman' in group_names"
tags: pacman
- name: Uninstall the good stuff (apk)
apk: name={{ packages }} state=absent
when: "'apk' in group_names or 'alpine' in group_names"
tags: apk
- name: Uninstall the good stuff (apt)
apt: package={{ packages }} state=absent
when: "'apt' in group_names"
tags: apt
- name: Remove /etc/doas.conf
file: state=absent path=/etc/doas.conf
tags: system
- name: Configure user configs
when: "'user' in setup"
block:
- name: Add ~/.config/neofetch/
copy: src=neofetch dest=/home/{{ name }}/.config/neofetch owner={{ name }} group={{ name }} mode=0755
tags: config

15
roles/shell/files/aliases.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
which lsd>/dev/null
if [ "$?" = "0" ]; then
alias ls="lsd -h --color=auto --group-dirs first"
else
alias ls="ls -h --color=auto --group-directories-first"
fi
# ([ "$?" = "0" ] && \
# alias ls="lsd -h --color=auto --group-dirs first") || \
# alias ls="ls -h --color=auto --group-directories-first"
alias\
ll="ls -l"\
la="ls -a"\
diff="diff --color=auto"\
grep="grep --color=auto -n"

View File

@ -0,0 +1,26 @@
- name: Add .aliases
copy: src=aliases.sh dest=/home/{{ name }}/.aliases owner={{ name }} group={{ group }} mode=0644
- name: Add .bat.conf
copy: src=bat.conf dest=/home/{{ name }}/.bat.conf owner={{ name }} group={{ group }} mode=0644
when: "'bat' in packages or 'bat' in extra_packages"
- name: Install zsh syntax highlighting (~/.zshrc.d folder)
when: not zsh_opt_config
git:
repo: https://github.com/zsh-users/zsh-syntax-highlighting.git
dest: /home/{{ name }}/.zshrc.d/zsh-syntax-highlighting
single_branch: yes
version: master
- name: Install zsh syntax highlighting (/opt/zsh folder)
when: zsh_opt_config
git:
repo: https://github.com/zsh-users/zsh-syntax-highlighting.git
dest: /opt/zsh/zsh-syntax-highlighting
single_branch: yes
version: master
become: true
- name: Add ~/.zshrc.d -> /opt/zsh symbolic link
when: zsh_opt_config
file: state=link dest=/home/{{ name }}/.zshrc.d src=/opt/zsh owner={{ name }} group={{ group }} mode=0755
- name: Set owner ship of zsh syntax highlighting files
file: state=directory recurse=yes dest=/home/{{ name }}/.zshrc.d owner={{ name }} group={{ group }}

View File

@ -0,0 +1,30 @@
- name: Setup user zsh config
when: "'zsh' in setup"
tags: [user,zsh]
block:
- name: Add .zshrc
template: src=zshrc.zsh.j2 dest=/home/{{ name }}/.zshrc owner={{ name }} group={{ group }} mode=0644
- name: Add zsh zstyles config
copy: src=zstyles.zsh dest=/home/{{ name }}/.zstyles owner={{ name }} group={{ group }} mode=0644
- name: Setup user bash config
when: "'bash' in setup"
tags: [user,bash]
block:
- name: Add .bashrc
template: src=bashrc.sh.j2 dest=/home/{{ name }}/.bashrc owner={{ name }} group={{ group }} mode=0644
- name: Setup user extra config
when: "'extra' in setup"
tags: [user,extra]
block:
- import_tasks: extra.yml
- name: Add .env file
when: not revert
copy: src=env.sh dest=/home/{{ name }}/.env owner={{ name }} group={{ group }} mode=0644
- name: Revert ansible shell setup
when: revert
block:
- import_tasks: revert.yml

View File

@ -0,0 +1,27 @@
- name: Remove user zsh config
tags: [zsh]
block:
- name: Remove .zshrc
file: state=absent path=/home/{{ name }}/.zshrc
- name: Remove zsh zstyles config
file: state=absent path=/home/{{ name }}/.zstyles
- name: Remove .zshrc.d folder/link
file: state=absent path=/home/{{ name }}/.zshrc.d
- name: Remove zsh syntax highlighting
file: state=absent path=/home/{{ name }}/.zshrc.d/zsh-syntax-highlighting
when: not zsh_opt_config
- name: Remove zsh syntax highlighting (/opt/zsh)
file: state=absent path=/opt/zsh/zsh-syntax-highlighting
when: zsh_opt_config
- name: Remove extra user config
when: "'extra' in setup"
tags: [extra]
block:
- name: Remove .aliases
file: state=absent path=/home/{{ name }}/.aliases
- name: Remove .bat.conf
file: state=absent path=/home/{{ name }}/.bat.conf
- name: Remove .env file
file: state=absent path=/home/{{ name }}/.env

View File

@ -0,0 +1,25 @@
case $- in
*i*) ;;
*) return;;
esac
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
shopt -s histappend checkwinsize globstar
HISTFILESIZE=42069
HISTSIZE=42069
#PS1='${debian_chroot:+($debian_chroot)}{{ bash_prompt }} '
PS1='{{ bash_prompt }} '
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
[ -f ~/.bash_aliases ] && . ~/.bash_aliases
[ -f ~/.aliases ] && . ~/.aliases
[ -f ~/.env ] && . ~/.env
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi

View File

@ -1,6 +1,6 @@
[[ $- != *i* ]] && return
PROMPT="%F{yellow}% %n%F{green}% @%F{blue}% %m %F{#bb33bb}% %1~%f > "
PROMPT="{{ zsh_prompt }} "
setopt autocd extendedglob nomatch notify prompt_subst
autoload -Uz compinit && compinit
unsetopt beep

View File

@ -1,30 +1,42 @@
# - name: Install yay (AUR helper)
# - name: Update and upgrade pacman packages
# become: yes
# pacman:
# executable: yay
# update_cache: yes
# upgrade: yes
# when: 'pacman'
# tags: pacman
- name: Update and upgrade pacman packages
pacman:
update_cache: yes
upgrade: yes
when: "'pacman' in group_names"
tags: pacman
become: yes
shell: pacman -Syu --noconfirm
when: package_manager == 'pacman' or 'pacman' in group_names
tags: update
- name: Add some repos (alpine)
become: yes
shell: |
grep -R 'testing' /etc/apk/repositories
[ $? == 1 ] && echo 'https://dl-cdn.alpinelinux.org/alpine/edge/testing'>>/etc/apk/repositories
if [ $? == 1 ]; then
echo 'https://dl-cdn.alpinelinux.org/alpine/edge/testing'>>/etc/apk/repositories
fi
when: "'alpine' in group_names"
tags: alpine
tags: update alpine
- name: Update and upgrade apk packages
become: true
become: yes
apk:
update_cache: yes
upgrade: yes
when: "'apk' in group_names or 'alpine' in group_names"
tags: apk
when: package_manager == 'apk' or 'apk' in group_names
tags: update
- name: Update and upgrade apt packages
become: true
become: yes
apt:
update_cache: yes
upgrade: yes
when: "'apt' in group_names"
tags: apt
when: package_manager == 'apt' or 'apt' in group_names
tags: update

View File

@ -0,0 +1,21 @@
- name: Setup doom emacs
when: "'emacs' in setup"
tags: [doom,emacs]
block:
- name: Remove old emacs config
file: state=absent path=/home/{{ name }}/.emacs.d
- name: Git clone doom emacs
git:
repo: https://github.com/hlissner/doom-emacs
dest: /home/{{ name }}/.emacs.d
accept_newhostkey: yes
single_branch: yes
version: master
depth: 1
- name: Install doom emacs
shell: |
chown -R {{ name }} /home/{{ name }}/.emacs.d
echo "y\ny"|su {{ name }} /home/{{ name }}/.emacs.d/bin/doom install
#* ^ Above we answer terminal prompts
# - name: Add doom emacs config
# - name: Run doom sync

View File

@ -1,4 +1,5 @@
- name: Create user
when: "'system' in setup"
user:
name="{{ name }}"
groups="{{ item }}"
@ -12,4 +13,5 @@
user="{{ name }}"
key="{{ item }}"
with_items:
- "{{ pubkeys }}"
- "{{ pubkeys }}"
- import_tasks: doom-emacs.yml

View File

@ -1,7 +0,0 @@
#!/bin/sh
alias\
ls="lsd -h --color=auto --group-dirs first"\
ll="ls -l"\
la="ls -a"\
diff="diff --color=auto"\
grep="grep --color=auto -n"

View File

@ -1,33 +0,0 @@
- name: Setup user zsh config
block:
- name: Add .zshrc
copy: src=zshrc.zsh dest=/home/{{ name }}/.zshrc owner={{ name }} group={{ name }} mode=0755
- name: Add zsh zstyles config
copy: src=zstyles.zsh dest=/home/{{ name }}/.zstyles owner={{ name }} group={{ name }} mode=0755
- name: Add .env file
copy: src=env.sh dest=/home/{{ name }}/.env owner={{ name }} group={{ name }} mode=0755
- name: Add .aliases
copy: src=aliases.sh dest=/home/{{ name }}/.aliases owner={{ name }} group={{ name }} mode=0755
- name: Add .bat.conf
copy: src=bat.conf dest=/home/{{ name }}/.bat.conf owner={{ name }} group={{ name }} mode=0755
- name: Install zsh syntax highlighting
git:
repo: https://github.com/zsh-users/zsh-syntax-highlighting.git
dest: /home/{{ name }}/.zshrc.d/zsh-syntax-highlighting
update: yes
clone: yes
rescue:
- name: Remove .zshrc
file: state=absent path=/home/{{ name }}/.zshrc
- name: Remove zsh zstyles config
file: state=absent path=/home/{{ name }}/.zstyles
- name: Remove .env file
file: state=absent path=/home/{{ name }}/.env
- name: Remove .aliases
file: state=absent path=/home/{{ name }}/.aliases
- name: Remove .bat.conf
file: state=absent path=/home/{{ name }}/.bat.conf
# - name: Remove zsh syntax highlighting
# file: state=absent path=/home/{{ name }}/.zshrc.d/zsh-syntax-highlighting

View File

@ -1,11 +1,18 @@
[linode]
[archy]
archy.42069.no
[kjellern]
[liten]
42069.no
[store]
stor
[apt:children]
42069.no
[linode:children]
archy
[kjellern:children]
liten
store
[pacman:children]
archy.42069.no
stor
archy
store
[apt:children]
liten

View File

@ -1,2 +1,8 @@
- hosts: all
roles: [update, common, user, zsh]
roles:
- role: update
when: update
tags: update
- common
- user
- shell

View File

@ -1,5 +1,31 @@
#!/bin/sh
[ "$1" == "stop" ] && docker kill ansible && exit 0
docker run --rm --name ansible -id alpine
[ $? == 0 ] && docker exec ansible /bin/sh -c "apk update && apk add python3"
ansible -i docker.ini all -m ping
user="siv"
function playbook() {
book="${1:-"site.yml"}"
opts=""
[ ! -z "$2" ] && opts="-t $2"
ansible-playbook "$book" "$opts" -i docker.ini
}
case "$1" in
play)
book="${2:-"site.yml"}"
# opts=""
# [ ! -z "$3" ] && opts="-t $3"
ansible-playbook "$book" -i docker.ini;;
# playbook "$2" "$3";;
kill)
docker kill ansible;;
run)
docker run --rm --name ansible -id alpine
[ "$?" == "0" ] && docker exec ansible /bin/sh -c "apk update && apk add python3"
ansible -i docker.ini all -m ping;;
zsh)
docker exec -itu "$user" ansible zsh;;
sh)
docker exec -it ansible sh;;
"")echo "Usage: $0 [run|kill|play|sh|{container cmd}]";;
*)
docker exec -itu "$user" ansible "$@";;
esac