+ sample configs for nginx-proxy lxc instance
+ site_name as general option for different lxc_host and site_name (personally used for vps deployment) + vps deploy script + node version manager install + php version setup vars moved into separate vars-file + ansible.cfg that helps to use local inventory and group_vars files + root account playbook
This commit is contained in:
48
run-lxc-playbook.sh
Executable file
48
run-lxc-playbook.sh
Executable file
@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
SERVER=$1
|
||||
LXC_HOST=$2
|
||||
PLAYBOOK=$3
|
||||
|
||||
usage() {
|
||||
echo "Usage: run-lxc-playbook.sh server lxc_host playbook"
|
||||
echo "server - main proxmox server IP address and lxc_host that the name of lxc container"
|
||||
echo "lxc_host - name of lxc container"
|
||||
echo "playbook - playbook file"
|
||||
}
|
||||
|
||||
if [[ -z "$SERVER" ]]; then
|
||||
echo "You must defined SERVER as first argument"
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "$LXC_HOST" ]]; then
|
||||
echo "You must defined LXC_HOST as second argument"
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "$PLAYBOOK" ]]; then
|
||||
echo "You must defined PLAYBOOK as third argument"
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "$PLAYBOOK" ]]; then
|
||||
echo "Playbook file is not exists: $PLAYBOOK"
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
COMMAND=$(cat <<EOF
|
||||
ansible-playbook -e "lxc_host=$LXC_HOST" --ssh-common-args="-o ProxyCommand='ssh -W %h:%p -q root@$SERVER'" $PLAYBOOK
|
||||
EOF
|
||||
)
|
||||
|
||||
printf 'Launch ansible playbook:\n%s\n' "$COMMAND"
|
||||
read -p "Are you sure? " -n 1 -r
|
||||
echo # (optional) move to a new line
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]
|
||||
then
|
||||
/bin/bash -c "$COMMAND"
|
||||
fi
|
||||
Reference in New Issue
Block a user