[ansible-project] Conditional variables

2020-01-23 Thread Yehuda Pinhas
*Hi!* *I want to make the variable qos_policy set on conditional basis:* *If bandwidth_mb == '50'* * then qos_policy == 'qos-nested-'* *else* * qos_policy == 'qos-nested-new-'* *My code is this (not working):* qos_policy: "{{ 'qos-nested-new-' + bandwidth_mb }}" qos_policy: "{{

Re: [ansible-project] conditional variables depending on time

2019-03-29 Thread olyx11
I figured it out by using set_fact and when for the conditionals. Thanks for the reply. > On Mar 29, 2019, at 1:03 PM, Kai Stian Olstad > wrote: > >> On 28.03.2019 21:17, James Gibson wrote: >> I am trying to output what shift an event has happened depending on the >> time of day, but keep

Re: [ansible-project] conditional variables depending on time

2019-03-29 Thread Kai Stian Olstad
On 28.03.2019 21:17, James Gibson wrote: > I am trying to output what shift an event has happened depending on the > time of day, but keep running into errors or getting nothing back. > > > --- > - hosts: localhost >vars: > shift: "{{ 'First Shift' if ansible_date_time.time >

[ansible-project] conditional variables depending on time

2019-03-28 Thread James Gibson
I am trying to output what shift an event has happened depending on the time of day, but keep running into errors or getting nothing back. --- - hosts: localhost vars: shift: "{{ 'First Shift' if ansible_date_time.time > '09:00:00' && ansible_date_time.time < '17:00:01' else '' }}"

Re: [ansible-project] Conditional variables

2016-06-15 Thread Brian Coca
file: path={{ (ssh_keygen_user == root)|ternary('/root','/home/' + ansible_user)}}/.ssh state=directory mode=0700 owner={{ ansible_user }} group={{ ansible_user }} -- Brian Coca -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To

[ansible-project] Conditional variables

2016-06-14 Thread Pavel Stratil
Hey all, i'm trying to write a task to manage ssh keys. depending on that the ansible_user, i want teo work either in /root/.ssh or /home/$user/.ssh. So I naively googled how to do that and only ended confused with - set_fact: userdir="/home/{{ ansible_user }}" when: ssh_keygen_user !=