Code Update
This commit is contained in:
parent
e0e25ef1ac
commit
b236fdb65b
14
init.sh
14
init.sh
@ -86,20 +86,12 @@ wi-init(){
|
|||||||
|
|
||||||
if [ ! -f ~/.ansible/vars.yml ]
|
if [ ! -f ~/.ansible/vars.yml ]
|
||||||
then
|
then
|
||||||
openssl rand -base64 64 | tr -d '\n' | head -c 64 > ~/.ansible/vault.yml
|
|
||||||
|
|
||||||
ANSIBLE_VAULT_SECRET=$(<~/.ansible/vault.yml)
|
|
||||||
|
|
||||||
echo "---" > ~/.ansible/vars.yml
|
echo "---" > ~/.ansible/vars.yml
|
||||||
echo "hostname: $HOSTNAME" >> ~/.ansible/vars.yml
|
echo "hostname: $HOSTNAME" >> ~/.ansible/vars.yml
|
||||||
echo "folder: /$FOLDER/" >> ~/.ansible/vars.yml
|
echo "config:" >> ~/.ansible/vars.yml
|
||||||
|
echo " identity:" >> ~/.ansible/vars.yml
|
||||||
echo " vault:" >> ~/.ansible/vars.yml
|
echo " vault:" >> ~/.ansible/vars.yml
|
||||||
echo " ansible:" >> ~/.ansible/vars.yml
|
|
||||||
echo " secret: $ANSIBLE_VAULT_SECRET" >> ~/.ansible/vars.yml
|
|
||||||
echo " hashicorp:" >> ~/.ansible/vars.yml
|
|
||||||
echo " domain: $VAULT_DOMAIN" >> ~/.ansible/vars.yml
|
echo " domain: $VAULT_DOMAIN" >> ~/.ansible/vars.yml
|
||||||
|
|
||||||
/opt/ansible/bin/ansible-vault encrypt --vault-password-file ~/.ansible/vault.yml ~/.ansible/vars.yml > /dev/null
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
GIT_DOMAIN="git.cwinfo.net"
|
GIT_DOMAIN="git.cwinfo.net"
|
||||||
@ -110,7 +102,7 @@ wi-init(){
|
|||||||
|
|
||||||
/opt/ansible/bin/ansible-galaxy collection install ansible.posix ansible.utils community.crypto community.dns community.docker community.general community.hashi_vault community.libvirt community.mongodb community.mysql community.postgresql containers.podman --upgrade &> /dev/null
|
/opt/ansible/bin/ansible-galaxy collection install ansible.posix ansible.utils community.crypto community.dns community.docker community.general community.hashi_vault community.libvirt community.mongodb community.mysql community.postgresql containers.podman --upgrade &> /dev/null
|
||||||
|
|
||||||
/opt/ansible/bin/ansible-pull -U ssh://git@$GIT_DOMAIN:$GIT_PORT/$GIT_REPOSITORY --accept-host-key --vault-password-file ~/.ansible/vault.yml --private-key ~/.ssh/keys/init playbooks/init.yml -t init
|
/opt/ansible/bin/ansible-pull -U ssh://git@$GIT_DOMAIN:$GIT_PORT/$GIT_REPOSITORY --accept-host-key --private-key ~/.ssh/keys/init playbooks/init.yml -t init
|
||||||
|
|
||||||
unset HVT
|
unset HVT
|
||||||
}
|
}
|
||||||
|
@ -20,20 +20,12 @@ wi-init(){
|
|||||||
|
|
||||||
if [ ! -f ~/.ansible/vars.yml ]
|
if [ ! -f ~/.ansible/vars.yml ]
|
||||||
then
|
then
|
||||||
openssl rand -base64 64 | tr -d '\n' | head -c 64 > ~/.ansible/vault.yml
|
|
||||||
|
|
||||||
ANSIBLE_VAULT_SECRET=$(<~/.ansible/vault.yml)
|
|
||||||
|
|
||||||
echo "---" > ~/.ansible/vars.yml
|
echo "---" > ~/.ansible/vars.yml
|
||||||
echo "hostname: $HOSTNAME" >> ~/.ansible/vars.yml
|
echo "hostname: $HOSTNAME" >> ~/.ansible/vars.yml
|
||||||
echo "folder: /$FOLDER/" >> ~/.ansible/vars.yml
|
echo "config:" >> ~/.ansible/vars.yml
|
||||||
|
echo " identity:" >> ~/.ansible/vars.yml
|
||||||
echo " vault:" >> ~/.ansible/vars.yml
|
echo " vault:" >> ~/.ansible/vars.yml
|
||||||
echo " ansible:" >> ~/.ansible/vars.yml
|
|
||||||
echo " secret: $ANSIBLE_VAULT_SECRET" >> ~/.ansible/vars.yml
|
|
||||||
echo " hashicorp:" >> ~/.ansible/vars.yml
|
|
||||||
echo " domain: $VAULT_DOMAIN" >> ~/.ansible/vars.yml
|
echo " domain: $VAULT_DOMAIN" >> ~/.ansible/vars.yml
|
||||||
|
|
||||||
/opt/ansible/bin/ansible-vault encrypt --vault-password-file ~/.ansible/vault.yml ~/.ansible/vars.yml > /dev/null
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
GIT_DOMAIN="git.cwinfo.net"
|
GIT_DOMAIN="git.cwinfo.net"
|
||||||
@ -44,7 +36,7 @@ wi-init(){
|
|||||||
|
|
||||||
/opt/ansible/bin/ansible-galaxy collection install ansible.posix ansible.utils community.crypto community.dns community.docker community.general community.hashi_vault community.libvirt community.mongodb community.mysql community.postgresql containers.podman --upgrade &> /dev/null
|
/opt/ansible/bin/ansible-galaxy collection install ansible.posix ansible.utils community.crypto community.dns community.docker community.general community.hashi_vault community.libvirt community.mongodb community.mysql community.postgresql containers.podman --upgrade &> /dev/null
|
||||||
|
|
||||||
/opt/ansible/bin/ansible-pull -U ssh://git@$GIT_DOMAIN:$GIT_PORT/$GIT_REPOSITORY --accept-host-key --vault-password-file ~/.ansible/vault.yml --private-key ~/.ssh/keys/init playbooks/init.yml -t init
|
/opt/ansible/bin/ansible-pull -U ssh://git@$GIT_DOMAIN:$GIT_PORT/$GIT_REPOSITORY --accept-host-key --private-key ~/.ssh/keys/init playbooks/init.yml -t init
|
||||||
|
|
||||||
unset HVT
|
unset HVT
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user