-
Notifications
You must be signed in to change notification settings - Fork 223
Description
I've been trying to find a way to avoid typing a ton of flags when I run bolt. Currently, all my bolt commands require sudo, which requires tty. This means I have to pass all three of the following on the command line for each run of bolt: --sudo --tty --run-as root. This is in addition to having a unique inventory file for each of my role/profile type modules, which means I also have to use --inventoryfile inventory.yaml.
After reviewing the docs, it appears I could at least set some of these options in the group configs inside the inventory. So I did this:
groups:
- name: sbx_haproxy
config:
ssh:
run-as: root
tty: true
nodes:
- proxy1.test.example.org
- proxy2.test.example.org
- name: sbx_ha
config:
ssh:
run-as: root
tty: true
groups:
- name: sbx_application
nodes:
- app1.test.example.org
- app2.test.example.org
- app3.test.example.org
- app4.test.example.org
Then i ran this:
bolt script run "tasks/destroy.sh" --sudo --inventoryfile inventory.yaml --nodes sbx_ha
But this results in the following output (repeated for each node in the group):
Failed to clean up tempdir '/bolt/4812b322-71eb-4ef3-abc7-edc68da9f840': sudo: sorry, you must have a tty to run sudo
Failed on proxy1.test.example.org:
Could not change owner of '/bolt/4812b322-71eb-4ef3-abc7-edc68da9f840' to root: sudo: sorry, you must have a tty to run sudo
Failed to clean up tempdir '/bolt/67e3f85c-cf65-41ae-ad75-ed3bd809c0b9': sudo: sorry, you must have a tty to run sudo
It appears that by utilizing --sudo, the other configs listed for the group aren't loaded.