semaphore
semaphore copied to clipboard
How does environment variables supposed to work? It does not work for me.
I have a very simple use case scenario and I cannot make environments variables to be passed to my playbook. Vars are working correctly.
Environment config:
Playbook:
- name: "Run"
hosts: hosts
roles:
- run
environment:
ENV_TO_TEST: "changeit"
vars:
variable_to_test: "changeit"
variable_to_test is being replaced as expected with "test1" value.
ENV_TO_TEST stays with value "changeit". It is not being replaced by the env defined in the semaphore.
Do I misunderstand something regarding environments functionality? Unfortunately I cannot find any info in docs about how does it work in deep.
I don't believe you can change Environment variables via the command line in Ansible. Semaphore is essentially running a command line Ansible playbook.
Are you able to do what you want when running Ansible command line manually, outside of Semaphore? If so, copy that command here, maybe that will help in determining how to translate that into Semaphore...
Greetings.
From what I've read in the code the 'environment variables' are essentially set at the 'ansible-playbook' execution.
You could, per example, set Ansible configuration parameters using them (instead of using an 'ansible.cfg' file).
References:
Also: I am unsure if the 'environment.ENV_TO_TEST' would be replaced by Ansible. Have you verified that on a manual run?
ENV_TO_TEST=blub ansible-playbook test.yml
For 'environment extra-vars' here would be the references:
NOTE: references do not exist any more
I'm having similar issues to this where any variable that I place under "environment variables" does not load. When variables are placed in the "extra variables" section of environment or when it's defined in an inventory file, it does load.
When I run a playbook that relies on semaphore_slack_webhook, I get an error that that variable is not defined.
However, when I place the variable under extra variables as such:
Then my playbook does work.
Tried with several playbooks including debug tasks that just list all variables and it seems to me that any variables put under environment variables does not load.
I'm having similar issues to this where any variable that I place under "environment variables" does not load. When variables are placed in the "extra variables" section of environment or when it's defined in an inventory file, it does load.
When I run a playbook that relies on semaphore_slack_webhook, I get an error that that variable is not defined.
+1 this. We cannot get this to work either for ANSIBLE_HOST_KEY_CHECKING. We tried every combination of variable, using extra vs environment and no success.
The only way I got it to work for me was to add
[defaults]
host_key_checking = False
In every inventory to turn it off. Its broken IMO unless we are missing something here.
I'm having similar issues to this where any variable that I place under "environment variables" does not load. When variables are placed in the "extra variables" section of environment or when it's defined in an inventory file, it does load. When I run a playbook that relies on semaphore_slack_webhook, I get an error that that variable is not defined.
+1 this. We cannot get this to work either for
ANSIBLE_HOST_KEY_CHECKING. We tried every combination of variable, using extra vs environment and no success.The only way I got it to work for me was to add
[defaults] host_key_checking = FalseIn every inventory to turn it off. Its broken IMO unless we are missing something here.
I had the same issue. But when is set "ANSIBLE_HOST_KEY_CHECKING": false to lower characters "ansible_host_key_checking": false it works for me.