Use sudo instead of root
This commit is contained in:
parent
e9410c4f8f
commit
3f728a9c22
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -4,3 +4,4 @@ playbook.retry
|
||||||
*.log
|
*.log
|
||||||
.idea/
|
.idea/
|
||||||
venv/
|
venv/
|
||||||
|
/ansible.cfg
|
||||||
|
|
10
Makefile
10
Makefile
|
@ -1,4 +1,10 @@
|
||||||
init: create_venv install_pre_commit install_ansible_galaxy_modules
|
init: create_ansible_cfg create_venv install_pre_commit install_ansible_galaxy_modules
|
||||||
|
|
||||||
|
.ONESHELL:
|
||||||
|
create_ansible_cfg:
|
||||||
|
read -rp "Enter remote username: " REMOTE_USER
|
||||||
|
cp ansible.cfg.sample ansible.cfg
|
||||||
|
sed -i "s/REMOTE_USER/$$REMOTE_USER/g" ansible.cfg
|
||||||
|
|
||||||
create_venv:
|
create_venv:
|
||||||
python3 -m venv venv
|
python3 -m venv venv
|
||||||
|
@ -9,4 +15,4 @@ install_pre_commit:
|
||||||
venv/bin/pre-commit install
|
venv/bin/pre-commit install
|
||||||
|
|
||||||
install_ansible_galaxy_modules:
|
install_ansible_galaxy_modules:
|
||||||
venv/bin/ansible-galaxy collection install community.general
|
venv/bin/ansible-galaxy collection install community.general
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
[defaults]
|
[defaults]
|
||||||
remote_user = root
|
remote_user = REMOTE_USER
|
||||||
inventory = datacoop_hosts
|
inventory = datacoop_hosts
|
|
@ -8,7 +8,7 @@ usage () {
|
||||||
} >&2
|
} >&2
|
||||||
}
|
}
|
||||||
|
|
||||||
BASE_CMD="ansible-playbook playbook.yml --ask-vault-pass"
|
BASE_CMD="ansible-playbook playbook.yml --ask-become-pass --ask-vault-pass"
|
||||||
|
|
||||||
if [ "$1" = "--vagrant" ]; then
|
if [ "$1" = "--vagrant" ]; then
|
||||||
BASE_CMD="$BASE_CMD --verbose --inventory=vagrant_host"
|
BASE_CMD="$BASE_CMD --verbose --inventory=vagrant_host"
|
||||||
|
|
Loading…
Reference in a new issue