+ yadm initialization for non priveleged and existing users

#861m7vaer Шаблон операционной системы на Debian 10
This commit is contained in:
2024-03-22 18:47:05 +03:00
parent 958e39bce7
commit fb93943ba5
7 changed files with 21 additions and 11 deletions

6
playbooks/own/yadm.yml Normal file
View File

@ -0,0 +1,6 @@
---
- hosts: [ 'debian10' ]
tasks:
- name: Clone dotfiles repo
shell: yadm clone --bootstrap https://vcs.wpstudio.ru/gitea/dotfiles.git
# TODO: убрать sudo для автовключения тмукса из .bashrc

2
playbooks/yadm.yml Normal file
View File

@ -0,0 +1,2 @@
---
- import_playbook: own/yadm.yml

View File

@ -42,7 +42,7 @@ if [[ ! -f "$PLAYBOOK" ]]; then
fi fi
COMMAND=$(cat <<EOF COMMAND=$(cat <<EOF
ansible-playbook -e "lxc_host=$LXC_HOST" -e runner=lxc --ssh-common-args="-o ProxyCommand='ssh -W %h:%p -q root@$SERVER'" $PLAYBOOK ansible-playbook -e "lxc_host=$LXC_HOST" -e="domain_name=$LXC_HOST" -e runner=lxc --ssh-common-args="-o ProxyCommand='ssh -W %h:%p -q root@$SERVER'" $PLAYBOOK
EOF EOF
) )

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
SERVER=$1 SERVER=$1
PLAYBOOK=$2 PLAYBOOK=$2
SITE_NAME=$3 USER=$3
while [[ "$#" -gt 0 ]]; do while [[ "$#" -gt 0 ]]; do
case $1 in case $1 in
@ -28,8 +28,12 @@ if [[ -z "$PLAYBOOK" ]]; then
exit 1 exit 1
fi fi
if [[ -z "$USER" ]]; then
USER=root
fi
COMMAND=$(cat <<EOF COMMAND=$(cat <<EOF
ansible-playbook -e "lxc_host=${SERVER} -e runner=normal" ansible-playbook -e "lxc_host=${SERVER}" -e "runner=normal" -e "ansible_user=${USER}"
EOF EOF
) )

View File

@ -43,6 +43,12 @@ if [[ -z "$DOMAIN_NAME" ]]; then
exit 1 exit 1
fi fi
if [[ ! -f "$PLAYBOOK" ]]; then
echo "Playbook file is not exists: $PLAYBOOK"
usage
exit 1
fi
COMMAND=$(cat <<EOF COMMAND=$(cat <<EOF
ansible-playbook -e "lxc_host=${SERVER}" -e "initial_site_name=${SITE_NAME}" -e "domain_name=${DOMAIN_NAME}" -e runner=site ansible-playbook -e "lxc_host=${SERVER}" -e "initial_site_name=${SITE_NAME}" -e "domain_name=${DOMAIN_NAME}" -e runner=site
EOF EOF

View File

@ -1,8 +0,0 @@
---
- import_playbook: debops/yadm.yml
- import_playbook: debops/users.yml
- import_playbook: debops/sudo.yml
# Import all other group playbooks in this file...
...