Re: [ansible-project] Conditionals within roles

2023-03-23 Thread Chip Burke
Wow, I didn't know ternary existed. Jinja looks more flexible, but I think 
for this case the same line with different ternary statements should do the 
job. Thanks!

On Thursday, March 23, 2023 at 6:12:58 AM UTC-4 Dick Visser wrote:

> Use ternary, or some inline jinja statements
>
> On Wed, 22 Mar 2023 at 23:12, Chip Burke  wrote:
> >
> > I have a playbook with a role
> >
> > - hosts: somehost
> > roles:
> > - role: community.some.role
> > hostname: "{{ansible_hostname}}"
> > server: 192.168.1.2
> > api_server_url: https://some.server.com
> > url_path: /api
> > api_use_ssl: yes
> > userparameters:
> > - name: SomeName
> >
> > The last task I want to be dynamic. Based on a fact, I want SomeName to 
> change to a null, File1, File2, File3, etc.
> >
> > How does one do this in Ansible?
> >
> > --
> > You received this message because you are subscribed to the Google 
> Groups "Ansible Project" group.
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to ansible-proje...@googlegroups.com.
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/b393898b-2837-46ab-bda3-190323762280n%40googlegroups.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/7cd37294-af94-4bc5-a338-62614d9dfb0dn%40googlegroups.com.


Re: [ansible-project] Conditionals within roles

2023-03-23 Thread Dick Visser
Use ternary, or some inline jinja statements

On Wed, 22 Mar 2023 at 23:12, Chip Burke  wrote:
>
> I have a playbook with a role
>
> - hosts: somehost
>   roles:
> - role: community.some.role
>   hostname: "{{ansible_hostname}}"
>   server: 192.168.1.2
>   api_server_url: https://some.server.com
>   url_path: /api
>   api_use_ssl: yes
>   userparameters:
> - name: SomeName
>
> The last task I want to be dynamic. Based on a fact, I want SomeName to 
> change to a null, File1, File2, File3, etc.
>
> How does one do this in Ansible?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/b393898b-2837-46ab-bda3-190323762280n%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAF8BbLbXEZ7LZg6MJYyykcp9D1ADBQm-1b48zZgO-%3D2GQVMa6Q%40mail.gmail.com.


[ansible-project] Conditionals within roles

2023-03-22 Thread Chip Burke
I have a playbook with a role

- hosts: somehost
  roles:
- role: community.some.role
  hostname: "{{ansible_hostname}}"
  server: 192.168.1.2
  api_server_url: https://some.server.com
  url_path: /api
  api_use_ssl: yes
  userparameters:
- name: SomeName

The last task I want to be dynamic. Based on a fact, I want SomeName to 
change to a null, File1, File2, File3, etc. 

How does one do this in Ansible? 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b393898b-2837-46ab-bda3-190323762280n%40googlegroups.com.